Overture  Version 25
GenericCompositeGridOperators.h
Go to the documentation of this file.
1 // **** THIS FILE WAS AUTOMATICALLY GENERATED BY makeOperators.p from GenericGridCollectionOperators.h ******
2 /* -*-Mode: c++; -*- */
3 
4 #ifndef GENERIC_COMPOSITE_GRID_OPERATORS
5 #define GENERIC_COMPOSITE_GRID_OPERATORS
6 
7 // The file GenericCompositeGridOperators.h is created from GenericCompositeGridOperators.h by the
8 // perl script makeOperators.p
9 
10 #undef COMPOSITE_GRID_OPERATORS
11 // The next line is uncommented in GenericCompositeGridOperators.h
12 #define COMPOSITE_GRID_OPERATORS
13 
14 
19 
20 // extern BoundaryConditionParameters Overture::defaultBoundaryConditionParameters();
21 
23 
24 
25 //-----------------------------------------------------------------------------------
26 //
27 // Define differential and Boundary operators associated with GridCollections,
28 // GridCollectionFunctions (and CompositeGrid/CompositeGridFunctions)
29 //
30 //-----------------------------------------------------------------------------------
31 
33 {
34 
35  public:
36 
37  enum
38  {
41  };
42 
43 
44  CompositeGrid gridCollection; // operators are defined for this CompositeGrid
45 
46  // ********************************************************************
47  // **************** Miscellaneous Functions **************************
48  // ********************************************************************
49 
50  // default constructor
52  // contructor taking a CompositeGrid
54  // copy constructor
56 
59  // create a new object of this class
61 
63 
65 
66  // here is the operator for a GenericMappedGrid
67  GenericMappedGridOperators & operator[]( const int grid ) const;
68 
69  // return size of this object
70  virtual real sizeOf(FILE *file = NULL ) const;
71 
72  // supply a new grid to use
73  virtual void updateToMatchGrid( CompositeGrid & g );
74  // Use some new operators
76 
77  // get from a database file
78  virtual int get( const GenericDataBase & dir, const aString & name);
79  // put to a database file
80  virtual int put( GenericDataBase & dir, const aString & name) const;
81 
82  // set the order of accuracy
83  virtual void setOrderOfAccuracy( const int & orderOfAccuracy );
84  // get the order of accuracy
85  int getOrderOfAccuracy() const;
86 
87  // Indicate the stencil size for functions returning coefficients
88  virtual void setStencilSize(const int stencilSize);
89 
90  // Indicate the number of components (system size) for functions returning coefficients
91  virtual void setNumberOfComponentsForCoefficients(const int number);
92 
93  // Indicate if twilight-zone forcing should be added to boundary conditions
94  void setTwilightZoneFlow( const int & twilightZoneFlow );
95 
96  // Supply a twilight-zone forcing to use for boundary conditions
98 
99  virtual void useConservativeApproximations(bool trueOrFalse = TRUE );
101 
102  // ************************************************
103  // ***** DIFFERENTIATION CLASS FUNCTIONS **********
104  // ************************************************
105 
106 
107 // Macro to define a typical function call
108 #define FUNCTION(type) \
109  virtual realCompositeGridFunction type(const realCompositeGridFunction & u, \
110  const Index & C1 = nullIndex, \
111  const Index & C2 = nullIndex, \
112  const Index & C3 = nullIndex, \
113  const Index & C4 = nullIndex, \
114  const Index & C5 = nullIndex ); \
115  virtual realCompositeGridFunction type(const realCompositeGridFunction & u, \
116  const GridFunctionParameters & gfType, \
117  const Index & C1 = nullIndex, \
118  const Index & C2 = nullIndex, \
119  const Index & C3 = nullIndex, \
120  const Index & C4 = nullIndex, \
121  const Index & C5 = nullIndex );
122 
123 
124 #define FUNCTION_COEFFICIENTS(type) \
125  virtual realCompositeGridFunction type(const Index & C0 = nullIndex, \
126  const Index & C1 = nullIndex, \
127  const Index & C2 = nullIndex, \
128  const Index & C3 = nullIndex ); \
129  \
130  virtual realCompositeGridFunction type(const GridFunctionParameters & gfType, \
131  const Index & C0 = nullIndex, \
132  const Index & C1 = nullIndex, \
133  const Index & C2 = nullIndex, \
134  const Index & C3 = nullIndex );
135 
136  // parametric derivatives in the r1,r2,r3 directions
137  FUNCTION(r1)
138  FUNCTION_COEFFICIENTS(r1Coefficients)
139  FUNCTION(r2)
140  FUNCTION_COEFFICIENTS(r2Coefficients)
141  FUNCTION(r3)
142  FUNCTION_COEFFICIENTS(r3Coefficients)
143  FUNCTION(r1r1)
144  FUNCTION_COEFFICIENTS(r1r1Coefficients)
145  FUNCTION(r1r2)
146  FUNCTION_COEFFICIENTS(r1r2Coefficients)
147  FUNCTION(r1r3)
148  FUNCTION_COEFFICIENTS(r1r3Coefficients)
149  FUNCTION(r2r2)
150  FUNCTION_COEFFICIENTS(r2r2Coefficients)
151  FUNCTION(r2r3)
152  FUNCTION_COEFFICIENTS(r2r3Coefficients)
153  FUNCTION(r3r3)
154  FUNCTION_COEFFICIENTS(r3r3Coefficients)
155 
156  // FUNCTIONs in the x,y,z directions
157  FUNCTION(x)
158  FUNCTION_COEFFICIENTS(xCoefficients)
159  FUNCTION(y)
160  FUNCTION_COEFFICIENTS(yCoefficients)
161  FUNCTION(z)
162  FUNCTION_COEFFICIENTS(zCoefficients)
163  FUNCTION(xx)
164  FUNCTION_COEFFICIENTS(xxCoefficients)
165  FUNCTION(xy)
166  FUNCTION_COEFFICIENTS(xyCoefficients)
167  FUNCTION(xz)
168  FUNCTION_COEFFICIENTS(xzCoefficients)
169  FUNCTION(yy)
170  FUNCTION_COEFFICIENTS(yyCoefficients)
171  FUNCTION(yz)
172  FUNCTION_COEFFICIENTS(yzCoefficients)
173  FUNCTION(zz)
174  FUNCTION_COEFFICIENTS(zzCoefficients)
175 
176  // other forms of derivatives
177 
178  // compute face-centered variable from cell-centered variable
179  FUNCTION(cellsToFaces)
180 
181  //compute (u.grad)u (convective derivative)
183 
184  // compute contravariant velocity from either cell-centered or face-centered input velocity
185  FUNCTION(contravariantVelocity)
186 
187  FUNCTION(div)
188  FUNCTION_COEFFICIENTS(divCoefficients)
189 
190  //returns cell-centered divergence given normal velocities
191  FUNCTION(divNormal)
192 
193  // compute faceArea-weighted normal velocity from either cell-centered or
194  // face-centered input velocity (this is just an alias for contravariantVelocity)
195  FUNCTION(normalVelocity)
196 
197  FUNCTION(grad)
198  FUNCTION_COEFFICIENTS(gradCoefficients)
199 
200  FUNCTION(identity)
201  FUNCTION_COEFFICIENTS(identityCoefficients)
202 
203  FUNCTION(laplacian)
204  FUNCTION_COEFFICIENTS(laplacianCoefficients)
205 
206  FUNCTION(vorticity)
207 
208 #undef FUNCTION
209 #undef FUNCTION_COEFFICIENTS
210  // ******* derivatives in non-standard form ***********
211 
212  //compute (u.grad)w (convective derivative of passive variable(s))
214  const realCompositeGridFunction &u,
215  const realCompositeGridFunction &w,
216  const Index & C1 = nullIndex,
217  const Index & C2 = nullIndex,
218  const Index & C3 = nullIndex
219  );
221  const realCompositeGridFunction &u,
222  const GridFunctionParameters & gfType,
223  const realCompositeGridFunction &w,
224  const Index & C1 = nullIndex,
225  const Index & C2 = nullIndex,
226  const Index & C3 = nullIndex
227  );
228 
229 // Macro to define a typical function call
230 #define SCALAR_FUNCTION(type) \
231  virtual realCompositeGridFunction type(const realCompositeGridFunction & u, \
232  const realCompositeGridFunction & s, \
233  const Index & C1 = nullIndex, \
234  const Index & C2 = nullIndex, \
235  const Index & C3 = nullIndex, \
236  const Index & C4 = nullIndex ); \
237  virtual realCompositeGridFunction type(const realCompositeGridFunction & u, \
238  const GridFunctionParameters & gfType, \
239  const realCompositeGridFunction & s, \
240  const Index & C1 = nullIndex, \
241  const Index & C2 = nullIndex, \
242  const Index & C3 = nullIndex, \
243  const Index & C4 = nullIndex );
244 
245 
246 #define SCALAR_FUNCTION_COEFFICIENTS(type) \
247  virtual realCompositeGridFunction type(const realCompositeGridFunction & s, \
248  const Index & C0 = nullIndex, \
249  const Index & C1 = nullIndex, \
250  const Index & C2 = nullIndex, \
251  const Index & C3 = nullIndex ); \
252  \
253  virtual realCompositeGridFunction type(const GridFunctionParameters & gfType, \
254  const realCompositeGridFunction & s, \
255  const Index & C0 = nullIndex, \
256  const Index & C1 = nullIndex, \
257  const Index & C2 = nullIndex, \
258  const Index & C3 = nullIndex );
259 
260 
261  // div(s grad(u)), s=scalar field
262  SCALAR_FUNCTION(divScalarGrad)
263  SCALAR_FUNCTION_COEFFICIENTS(divScalarGradCoefficients)
264 
265  SCALAR_FUNCTION(divInverseScalarGrad)
266  SCALAR_FUNCTION_COEFFICIENTS(divInverseScalarGradCoefficients)
267 
268  SCALAR_FUNCTION(scalarGrad)
269  SCALAR_FUNCTION_COEFFICIENTS(scalarGradCoefficients)
270 
271  SCALAR_FUNCTION(divVectorScalar)
272  SCALAR_FUNCTION_COEFFICIENTS(divVectorScalarCoefficients)
273 
274 
275 #undef SCALAR_FUNCTION
276 #undef SCALAR_FUNCTION_COEFFICIENTS
277 
278 
280  const realCompositeGridFunction & s,
281  const int & direction1,
282  const int & direction2,
283  const Index & C1 = nullIndex,
284  const Index & C2 = nullIndex,
285  const Index & C3 = nullIndex,
286  const Index & C4 = nullIndex );
288  const GridFunctionParameters & gfType,
289  const realCompositeGridFunction & s,
290  const int & direction1,
291  const int & direction2,
292  const Index & C1 = nullIndex,
293  const Index & C2 = nullIndex,
294  const Index & C3 = nullIndex,
295  const Index & C4 = nullIndex );
296 
297 
299  const int & direction1,
300  const int & direction2,
301  const Index & C0 = nullIndex,
302  const Index & C1 = nullIndex,
303  const Index & C2 = nullIndex,
304  const Index & C3 = nullIndex );
305 
307  const realCompositeGridFunction & s,
308  const int & direction1,
309  const int & direction2,
310  const Index & C0 = nullIndex,
311  const Index & C1 = nullIndex,
312  const Index & C2 = nullIndex,
313  const Index & C3 = nullIndex );
314 
315 
316  //returns face-centered gradients
318  const int c0 = 0,
319  const int c1 = 0,
320  const int c2 = 0,
321  const int c3 = 0,
322  const int c4 = 0
323  );
325  const GridFunctionParameters & gfType,
326  const int c0 = 0,
327  const int c1 = 0,
328  const int c2 = 0,
329  const int c3 = 0,
330  const int c4 = 0
331  );
332 
333 
334 
335  // ********************************************************************
336  // ------------- Here we define the Boundary Conditions ---------------
337  // ********************************************************************
338 
339  public:
340 
342  const real & time = 0.,
343  const int & grid =forAll);
344  // fill in coefficients for the boundary conditions
346  const real & time = 0.,
347  const int & grid =forAll);
348 
349 
350  // new BC interface:
352  const Index & Components,
353  const BCTypes::BCNames & boundaryConditionType=BCTypes::dirichlet,
354  const int & boundaryCondition = BCTypes::allBoundaries,
355  const real & forcing = 0.,
356  const real & time = 0.,
357  const BoundaryConditionParameters & bcParameters
359 
360 
362  const Index & Components,
363  const BCTypes::BCNames & boundaryConditionType,
364  const int & boundaryCondition,
365  const RealArray & forcing,
366  const real & time = 0.,
367  const BoundaryConditionParameters & bcParameters
369 
371  const Index & Components,
372  const BCTypes::BCNames & boundaryConditionType,
373  const int & boundaryCondition,
374  const realCompositeGridFunction & forcing,
375  const real & time = 0.,
376  const BoundaryConditionParameters & bcParameters
378 
379 #ifdef USE_PPP
380 // virtual void applyBoundaryCondition(realCompositeGridFunction & u,
381 // const Index & Components,
382 // const BCTypes::BCNames & boundaryConditionType,
383 // const int & boundaryCondition,
384 // const RealDistributedArray & forcing,
385 // const real & time = 0.,
386 // const BoundaryConditionParameters & bcParameters
387 // = Overture::defaultBoundaryConditionParameters());
388 #endif
389  // fix corners and periodic update:
390  virtual void finishBoundaryConditions
393  const Range & C0=nullRange,
394  const IntegerArray & gridsToUpdate = Overture::nullIntArray() );
395 
396  // fill in the BC's for a coefficient grid function
398  const Index & Equations,
399  const Index & Components,
400  const BCTypes::BCNames & boundaryConditionType=BCTypes::dirichlet,
401  const int & boundaryCondition= BCTypes::allBoundaries,
402  const BoundaryConditionParameters & bcParameters
404  protected:
405 
406 // this next function is only found in GenericCompositeGridOperators:
407 #ifdef COMPOSITE_GRID_OPERATORS
409  const IntegerArray & gridsToUpdate = Overture::nullIntArray() );
410 #endif
411 
412 #undef COMPOSITE_GRID_OPERATORS
413 
415 
416  Index I1,I2,I3;
417  // realCompositeGridFunction result; // derivative is returned in this grid function
419  GenericMappedGridOperators *mappedGridOperatorsPointer; // pointer to an MappedGridOperators object
420  // (this may point to a derived class object)
423 
424  void setup();
425 
426 };
427 
428 
429 
430 
431 
432 
433 #endif