Overture  Version 25
EllipticGridGenerator.h
Go to the documentation of this file.
1 #ifndef ELLIPTIC_GRID_GENERATOR_H
2 #define ELLIPTIC_GRID_GENERATOR_H
3 
4 #include "GenericDataBase.h"
6 
7 class doubleMappedGridFunction; // forward declarations
9 #ifdef OV_USE_DOUBLE
11 #else
13 #endif
14 
15 class Mapping;
18 class DataPointMapping;
19 //class PlotStuff;
20 class TridiagonalSolver;
21 
23 {
24  // A class to solve pde using the multigrid method
25 
26  public:
27 
29 
31  {
37  };
38 
40  {
49  };
50 
51 
52 
54 
55  EllipticGridGenerator(const EllipticGridGenerator & oldEllipticGridGenerator); // The copy constructor
56 
57  ~EllipticGridGenerator(); // The destructor
58 
59 
60  // perform iterations
61  int generateGrid();
62 
63  void setup(Mapping & map, Mapping *projectionMapping=NULL );
64 
65 
66  // return the current solution.
67  const RealMappedGridFunction & solution() const;
68 
69  // supply a weight function for adaptation.
70  int weightFunction( RealMappedGridFunction & weight );
71 
72  // supply a starting grid.
73  int startingGrid(const realArray & u0,
75  const IntegerArray & indexBounds=Overture::nullIntArray() );
76 
77  // Interactively choose parameters and compute elliptic grid.
78  int update(DataPointMapping & dpm,
81 
82  protected:
83 
84 // void applyBC(realArray &u1, realArray &v1, int i);
85 
86 
87  int applyBoundaryConditions(const int & level,
89 
90  int coarseToFine(const int & level,
91  const RealMappedGridFunction & uCoarse,
92  RealMappedGridFunction & uFine,
93  const bool & isAGridFunction = FALSE );
94 
96 
98 
99  int determineBoundarySpacing(const int & side,
100  const int & axis,
101  real & averageSpacing,
102  real & minimumSpacing,
103  real & maximumSpacing );
104 
105  // dot product
106  realArray dot( const realArray & a,
107  const realArray & b,
108  const Index & I1=nullIndex,
109  const Index & I2=nullIndex,
110  const Index & I3=nullIndex);
111 
113 
114  int fineToCoarse(const int & level,
115  const RealMappedGridFunction & uFine,
116  RealMappedGridFunction & uCoarse,
117  const bool & isAGridFunction = FALSE );
118 
119  // get coefficients of the elliptic system
120  int getCoefficients(realArray & coeff,
121  const Index & J1,
122  const Index & J2,
123  const Index & J3,
124  const realArray & ur,
125  const realArray & us,
127 
128  int getControlFunctions(const int & level );
129 
130  int jacobi(const int & level,
131  RealMappedGridFunction & uu );
132 
133  int restrictMovement(const int & level,
134  const RealMappedGridFunction & u0,
136  const Index & I1 =nullIndex,
137  const Index & I2 =nullIndex,
138  const Index & I3 =nullIndex);
139 
140 
141  // For smoothing the weight function:
142  int smoothJacobi( RealMappedGridFunction & w, const int & numberOfSmooths= 4 );
143 
144  int lineSmoother(const int & direction,
145  const int & level,
147 
148  int multigridVcycle(const int & level );
149 
150  int redBlack(const int & level,
151  RealMappedGridFunction & uu );
152 
153  void getResidual(realArray &resid1,
154  const int & level);
155 
156  void getResidual(realArray &resid1,
157  const int & level,
158  Index Jv[3],
159  realArray & coeff,
160  const bool & computeCoefficients =TRUE,
161  const bool & includeRightHandSide=TRUE,
162  const bool & computeControlFunctions=TRUE,
163  const SmoothingTypes & lineSmoothType =jacobiSmooth );
164 
165  int projectBoundaryPoints(const int & level,
167  const int & side,
168  const int & axis,
169  const Index & I1,
170  const Index & I2,
171  const Index & I3 );
172 
173  // this periodic update knows about the derivativePeriodic case
175  const Range & C=nullRange,
176  const bool & isAGridFunction = TRUE );
177 
178  int plot( const RealMappedGridFunction & v, const aString & label );
179 
180  realArray signOf(const realArray & uarray);
181 
182  int smooth(const int & level,
183  const SmoothingTypes & smoothingType,
184  const int & numberOfSubIterations =1 );
185 
186  int stretchTheGrid(Mapping & mapToStretch);
187 
189 
190  void updateRightHandSideWithFASCorrection(int level );
191 
192 
193  Mapping *userMap; // Defines mapping from r -> x
194  Mapping *projectionMap; // Use this mapping when projecting boundaries.
195  Mapping *boundaryProjectionMap[2][3]; // points to Mappings to use to project boundaries.
196 
199 
203 
205 
206  Mapping *map; // for unit interval
210 
211  Range Rx,Rr;
212 
214  RealMappedGridFunction *rhs, *w; //The right hand side and linearized solution
215 
217  RealMappedGridFunction *pWeight; // weight function for adaption.
218 
220 
221  real residualTolerance; // convergence criteria for the maximum residual
222 
223  //for the smoother
224  real omega; // Optimal omega for underelaxed jacobi
225  RealArray omegaMax; // maximum omega as determined from the control functions.
226 
227  // when there is a gridBc=3
228  int numberOfPeriods; // For doing many sheets in the periodic case
230 
232  realArray boundarySpacing; //The specified boundary thickness
233 
234  RealMappedGridFunction *rBoundary; // holds unit square coordinates of boundary values.
235  RealMappedGridFunction *xBoundary; // holds x values corresponding to rBoundary
236 
237  IntegerArray gridIndex; // holds interior points plus boundary where equations are applied.
241 
244 
245  real normalCurvatureWeight; // for surface control function.
246  real residualNormalizationFactor; // scaling for residual
247 
249 
250  int debug;
251 
253 
254  bool controlFunctions; // true if there are control functions.
257 
258 // PlotStuff *ps;
261 
262  int initializeParameters();
264 
265  int numberOfCoefficients; // number of coefficients int the coeff array
266  char buff[80];
267  FILE *debugFile;
268 
270 
272 
273 };
274 
275 #endif