Overture  Version 25
MappedGridOperators.h
Go to the documentation of this file.
1 /* -*-Mode: c++; -*- */
2 
3 #ifndef MAPPED_GRID_OPERATORS
4 #define MAPPED_GRID_OPERATORS
5 
8 // include "Overture.h"
9 // include "OGFunction.h"
10 
11 // extern BoundaryConditionParameters Overture::defaultBoundaryConditionParameters();
12 
13 //===========================================================================================
14 // This class defines spatial derivatives and Boundary Conditions of a MappedGridFunction
15 //
16 // Notes:
17 // o This class defines derivatives by finite differences and the "mapping method"
18 // thus u.x = (r.x)*u.r + (s.x)*u.s + (t.x)*u.t
19 // where u.r = second or fourth order finite differences
20 // o This class provides the "forward" derivatives of grid functions, member functions
21 // x,y,z,xx,xy,...
22 // o This class also provides functions that return the difference operator as a matrix,
23 // member functions X,Y,Z,XX,XY,.... These matrices can be used by sparse solvers
24 // such as the Oges Class.
25 // o To define the derivatives in a different way you should derive from this class
26 // and redefine any functions that you want to. If you provide the virtualConstructor
27 // member function then your derived class can be used by the GridCollectionOperators
28 // and CompositeGridOperators classes which define derivatives for GridCollectionFunction's
29 // and CompositeGridFunction's.
30 //
31 // o Boundary conditions are described in more detail in BoundaryOperators.C
32 
33 // o see also the grid function documentation for more details
34 //
35 // Who to blame: Bill Henshaw, CIC-19, henshaw@lanl.gov
36 // Date of last revision: 95/04/05
37 //===========================================================================================
38 
41 class FourierOperators;
42 
43 // This typedef is used to define the derivativeFunction array which keeps pointers
44 // to functions that compute derivatives
46  RealDistributedArray & derivative,
47  const Index & I1,
48  const Index & I2,
49  const Index & I3,
50  const Index & N,
51  MappedGridOperators & mgop );
52 // This typedef is used to define the derivativeFunction array which keeps pointers
53 // to functions that compute the coefficients of derivatives
55  const Index & I1,
56  const Index & I2,
57  const Index & I3,
58  const Index & E,
59  const Index & C,
60  MappedGridOperators & mgop );
61 
63 {
64 
65  public:
66 
67  // This enumerator lists values that are used for default arguments
68  enum
69  {
74  };
75  // This enumerator contains a list of all the derivatives that we know how to evaluate
77  {
116  divergenceTensorGradient, // *new* 050920
117  numberOfDifferentDerivatives // counts number of entries in this list
118  };
119 
120 
121  // -------------- public member functions ----------------------------
123  MappedGridOperators( MappedGrid & mg ); // use this MappedGrid
124  MappedGridOperators( const MappedGridOperators & mgfd ); // copy constructor
125  virtual GenericMappedGridOperators* virtualConstructor() const; // create a new object of this class
126 
127  virtual ~MappedGridOperators();
128 
129  virtual MappedGridOperators & operator= ( const MappedGridOperators & dmgf );
131 
132  virtual void useConservativeApproximations(bool trueOrFalse = TRUE );
133 
134  // return size of this object
135  virtual real sizeOf(FILE *file = NULL ) const;
136 
137  virtual void updateToMatchGrid( MappedGrid & mg ); // here is a new MappedGrid
138  virtual void updateToMatchUnstructuredGrid( MappedGrid & mg ); // kkc 030404
139 
140  FourierOperators* getFourierOperators(const bool abortIfNull=TRUE) const; // return a pointer to the Fourier operators
141 
142  // get from a database file
143  virtual int get( const GenericDataBase & dir, const aString & name);
144  // put to a database file
145  virtual int put( GenericDataBase & dir, const aString & name) const;
146 
147  void setOrderOfAccuracy( const int & orderOfAccuracy );
148 
149  // Indicate if twilight-zone forcing should be added to boundary conditions
150  virtual void setTwilightZoneFlow( const int & TwilightZoneFlow );
151 
152 #define FUNCTION(type) \
153  virtual realMappedGridFunction type(const realMappedGridFunction & u, \
154  const Index & I1 = nullIndex, \
155  const Index & I2 = nullIndex, \
156  const Index & I3 = nullIndex, \
157  const Index & I4 = nullIndex, \
158  const Index & I5 = nullIndex, \
159  const Index & I6 = nullIndex, \
160  const Index & I7 = nullIndex, \
161  const Index & I8 = nullIndex ); \
162  \
163  virtual realMappedGridFunction type(const realMappedGridFunction & u, \
164  const GridFunctionParameters & gfType, \
165  const Index & I1 = nullIndex, \
166  const Index & I2 = nullIndex, \
167  const Index & I3 = nullIndex, \
168  const Index & I4 = nullIndex, \
169  const Index & I5 = nullIndex, \
170  const Index & I6 = nullIndex, \
171  const Index & I7 = nullIndex, \
172  const Index & I8 = nullIndex );
173 
174 #define FUNCTION_COEFFICIENTS(type) \
175  virtual realMappedGridFunction type(const Index & I1 = nullIndex, \
176  const Index & I2 = nullIndex, \
177  const Index & I3 = nullIndex, \
178  const Index & I4 = nullIndex, \
179  const Index & I5 = nullIndex, \
180  const Index & I6 = nullIndex, \
181  const Index & I7 = nullIndex, \
182  const Index & I8 = nullIndex ); \
183  \
184  virtual realMappedGridFunction type(const GridFunctionParameters & gfType, \
185  const Index & I1 = nullIndex, \
186  const Index & I2 = nullIndex, \
187  const Index & I3 = nullIndex, \
188  const Index & I4 = nullIndex, \
189  const Index & I5 = nullIndex, \
190  const Index & I6 = nullIndex, \
191  const Index & I7 = nullIndex, \
192  const Index & I8 = nullIndex );
193 
194 
195  // parametric derivatives in the r1,r2,r3 directions
196  FUNCTION(r1)
197  FUNCTION_COEFFICIENTS(r1Coefficients)
198  FUNCTION(r2)
199  FUNCTION_COEFFICIENTS(r2Coefficients)
200  FUNCTION(r3)
201  FUNCTION_COEFFICIENTS(r3Coefficients)
202  FUNCTION(r1r1)
203  FUNCTION_COEFFICIENTS(r1r1Coefficients)
204  FUNCTION(r1r2)
205  FUNCTION_COEFFICIENTS(r1r2Coefficients)
206  FUNCTION(r1r3)
207  FUNCTION_COEFFICIENTS(r1r3Coefficients)
208  FUNCTION(r2r2)
209  FUNCTION_COEFFICIENTS(r2r2Coefficients)
210  FUNCTION(r2r3)
211  FUNCTION_COEFFICIENTS(r2r3Coefficients)
212  FUNCTION(r3r3)
213  FUNCTION_COEFFICIENTS(r3r3Coefficients)
214 
215  // FUNCTIONs in the x,y,z directions
216  FUNCTION(x)
217  FUNCTION_COEFFICIENTS(xCoefficients)
218  FUNCTION(y)
219  FUNCTION_COEFFICIENTS(yCoefficients)
220  FUNCTION(z)
221  FUNCTION_COEFFICIENTS(zCoefficients)
222  FUNCTION(xx)
223  FUNCTION_COEFFICIENTS(xxCoefficients)
224  FUNCTION(xy)
225  FUNCTION_COEFFICIENTS(xyCoefficients)
226  FUNCTION(xz)
227  FUNCTION_COEFFICIENTS(xzCoefficients)
228  FUNCTION(yy)
229  FUNCTION_COEFFICIENTS(yyCoefficients)
230  FUNCTION(yz)
231  FUNCTION_COEFFICIENTS(yzCoefficients)
232  FUNCTION(zz)
233  FUNCTION_COEFFICIENTS(zzCoefficients)
234 
235  // other forms of derivatives
236 
237  FUNCTION(div)
238  FUNCTION_COEFFICIENTS(divCoefficients)
239 
240  FUNCTION(grad)
241  FUNCTION_COEFFICIENTS(gradCoefficients)
242 
243  FUNCTION(identity)
244  FUNCTION_COEFFICIENTS(identityCoefficients)
245 
246  FUNCTION(laplacian)
247  FUNCTION_COEFFICIENTS(laplacianCoefficients)
248 
249  FUNCTION(vorticity)
250  // FUNCTION_COEFFICIENTS(gradCoefficients)
251 #undef FUNCTION
252 #undef FUNCTION_COEFFICIENTS
253 
254 #define SCALAR_FUNCTION(type) \
255  virtual realMappedGridFunction type(const realMappedGridFunction & u, \
256  const realMappedGridFunction & s, \
257  const Index & I1 = nullIndex, \
258  const Index & I2 = nullIndex, \
259  const Index & I3 = nullIndex, \
260  const Index & I4 = nullIndex, \
261  const Index & I5 = nullIndex, \
262  const Index & I6 = nullIndex, \
263  const Index & I7 = nullIndex, \
264  const Index & I8 = nullIndex ); \
265  \
266  virtual realMappedGridFunction type(const realMappedGridFunction & u, \
267  const GridFunctionParameters & gfType, \
268  const realMappedGridFunction & s, \
269  const Index & I1 = nullIndex, \
270  const Index & I2 = nullIndex, \
271  const Index & I3 = nullIndex, \
272  const Index & I4 = nullIndex, \
273  const Index & I5 = nullIndex, \
274  const Index & I6 = nullIndex, \
275  const Index & I7 = nullIndex, \
276  const Index & I8 = nullIndex );
277 
278 #define SCALAR_FUNCTION_COEFFICIENTS(type) \
279  virtual realMappedGridFunction type(const realMappedGridFunction & s, \
280  const Index & I1 = nullIndex, \
281  const Index & I2 = nullIndex, \
282  const Index & I3 = nullIndex, \
283  const Index & I4 = nullIndex, \
284  const Index & I5 = nullIndex, \
285  const Index & I6 = nullIndex, \
286  const Index & I7 = nullIndex, \
287  const Index & I8 = nullIndex ); \
288  \
289  virtual realMappedGridFunction type(const GridFunctionParameters & gfType, \
290  const realMappedGridFunction & s, \
291  const Index & I1 = nullIndex, \
292  const Index & I2 = nullIndex, \
293  const Index & I3 = nullIndex, \
294  const Index & I4 = nullIndex, \
295  const Index & I5 = nullIndex, \
296  const Index & I6 = nullIndex, \
297  const Index & I7 = nullIndex, \
298  const Index & I8 = nullIndex );
299 SCALAR_FUNCTION(divScalarGrad)
300 SCALAR_FUNCTION_COEFFICIENTS(divScalarGradCoefficients)
301 SCALAR_FUNCTION(scalarGrad)
302 SCALAR_FUNCTION_COEFFICIENTS(scalarGradCoefficients)
303 SCALAR_FUNCTION(divVectorScalar)
304 SCALAR_FUNCTION_COEFFICIENTS(divVectorScalarCoefficients)
305 
306 #undef SCALAR_FUNCTION
307 #undef SCALAR_FUNCTION_COEFFICIENTS
308 
309  // scalar times identityCoefficients
311  const realMappedGridFunction & s,
312  const Index & I1 = nullIndex,
313  const Index & I2 = nullIndex,
314  const Index & I3 = nullIndex,
315  const Index & I4 = nullIndex,
316  const Index & I5 = nullIndex,
317  const Index & I6 = nullIndex,
318  const Index & I7 = nullIndex,
319  const Index & I8 = nullIndex
320  );
321 
322  // scalar array times identityCoefficients -- use this to multiply an array of values
323  // times a coefficient matrix that represents a system of equations
325 
326 
327 
328 
330  const realMappedGridFunction & s,
331  const int & direction1,
332  const int & direction2,
333  const Index & I1 = nullIndex,
334  const Index & I2 = nullIndex,
335  const Index & I3 = nullIndex,
336  const Index & I4 = nullIndex,
337  const Index & I5 = nullIndex,
338  const Index & I6 = nullIndex,
339  const Index & I7 = nullIndex,
340  const Index & I8 = nullIndex );
341 
343  const GridFunctionParameters & gfType,
344  const realMappedGridFunction & s,
345  const int & direction1,
346  const int & direction2,
347  const Index & I1 = nullIndex,
348  const Index & I2 = nullIndex,
349  const Index & I3 = nullIndex,
350  const Index & I4 = nullIndex,
351  const Index & I5 = nullIndex,
352  const Index & I6 = nullIndex,
353  const Index & I7 = nullIndex,
354  const Index & I8 = nullIndex );
355 
357  const int & direction1,
358  const int & direction2,
359  const Index & I1 = nullIndex,
360  const Index & I2 = nullIndex,
361  const Index & I3 = nullIndex,
362  const Index & I4 = nullIndex,
363  const Index & I5 = nullIndex,
364  const Index & I6 = nullIndex,
365  const Index & I7 = nullIndex,
366  const Index & I8 = nullIndex );
367 
369  const realMappedGridFunction & s,
370  const int & direction1,
371  const int & direction2,
372  const Index & I1 = nullIndex,
373  const Index & I2 = nullIndex,
374  const Index & I3 = nullIndex,
375  const Index & I4 = nullIndex,
376  const Index & I5 = nullIndex,
377  const Index & I6 = nullIndex,
378  const Index & I7 = nullIndex,
379  const Index & I8 = nullIndex );
380 
381 
382  // Here are functions used to evaluate a whole set of derivatives at a time (for efficiency)
383  // Make a list of derivatives to be evaluated and supply arrays to save the results in
384  virtual void setNumberOfDerivativesToEvaluate( const int & numberOfDerivatives );
385  virtual void setDerivativeType(const int & index,
387  RealDistributedArray & ux1x2 );
388  virtual void getDerivatives(const realMappedGridFunction & u,
389  const Index & I1 = nullIndex,
390  const Index & I2 = nullIndex,
391  const Index & I3 = nullIndex,
392  const Index & I4 = nullIndex,
393  const Index & Evalute = nullIndex ); // evaluate these
394 
395  // return true if the grid is rectangular
396  virtual bool isRectangular();
397 
398  // Indicate the stencil size for functions returning coefficients
399  virtual void setStencilSize(const int stencilSize);
400 
401  // evaluate the coefficients for a derivative
402  // this is an efficient version (in both memory and speed).
403  virtual int coefficients(const derivativeTypes & derivativeType,
404  realMappedGridFunction & coeff,
405  const Index & I1 = nullIndex,
406  const Index & I2 = nullIndex,
407  const Index & I3 = nullIndex,
408  const Index & E =nullIndex,
409  const Index & C =nullIndex );
410 
411  // efficient version for derivatives requiring a scalar too.
412  virtual int coefficients(const derivativeTypes & derivativeType,
413  realMappedGridFunction & coeff,
414  const realMappedGridFunction & scalar,
415  const Index & I1 = nullIndex,
416  const Index & I2 = nullIndex,
417  const Index & I3 = nullIndex,
418  const Index & E =nullIndex,
419  const Index & C =nullIndex );
420 
421  // evaluate the coefficients for a derivative *** this version fills in an array ***
422  // this is an efficient version (in both memory and speed).
424  realArray & coeff,
425  const Index & I1 = nullIndex,
426  const Index & I2 = nullIndex,
427  const Index & I3 = nullIndex,
428  const Index & E =nullIndex,
429  const Index & C =nullIndex );
430 
431  // efficient version for derivatives requiring a scalar too.*** this version fills in an array ***
433  realArray & coeff,
434  const realArray & scalar,
435  const Index & I1 = nullIndex,
436  const Index & I2 = nullIndex,
437  const Index & I3 = nullIndex,
438  const Index & E =nullIndex,
439  const Index & C =nullIndex );
440  // evaluate a derivative
441  // this is an efficient version (in both memory and speed).
442  virtual int derivative(const derivativeTypes & derivativeType,
443  const realArray & u,
444  realArray & ux,
445  const Index & I1 = nullIndex,
446  const Index & I2 = nullIndex,
447  const Index & I3 = nullIndex,
448  const Index & C =nullIndex );
449  // version that takes a scalar
450  virtual int derivative(const derivativeTypes & derivativeType,
451  const realArray & u,
452  const realArray & scalar,
453  realArray & ux,
454  const Index & I1 = nullIndex,
455  const Index & I2 = nullIndex,
456  const Index & I3 = nullIndex,
457  const Index & C =nullIndex );
458  #ifdef USE_PPP
459  // *** these versions fill in a serial array ***
460  // this is an efficient version (in both memory and speed).
462  realSerialArray & coeff,
463  const Index & I1 = nullIndex,
464  const Index & I2 = nullIndex,
465  const Index & I3 = nullIndex,
466  const Index & E =nullIndex,
467  const Index & C =nullIndex );
468 
469  // efficient version for derivatives requiring a scalar too.*** this version fills in an array ***
471  realSerialArray & coeff,
472  const realSerialArray & scalar,
473  const Index & I1 = nullIndex,
474  const Index & I2 = nullIndex,
475  const Index & I3 = nullIndex,
476  const Index & E =nullIndex,
477  const Index & C =nullIndex );
478  // evaluate a derivative
479  // this is an efficient version (in both memory and speed).
480  virtual int derivative(const derivativeTypes & derivativeType,
481  const realSerialArray & u,
482  realSerialArray & ux,
483  const Index & I1 = nullIndex,
484  const Index & I2 = nullIndex,
485  const Index & I3 = nullIndex,
486  const Index & C =nullIndex );
487  // version that takes a scalar
488  virtual int derivative(const derivativeTypes & derivativeType,
489  const realSerialArray & u,
490  const realSerialArray & scalar,
491  realSerialArray & ux,
492  const Index & I1 = nullIndex,
493  const Index & I2 = nullIndex,
494  const Index & I3 = nullIndex,
495  const Index & C =nullIndex );
496 
497  #endif
498 
499  int derivativeInternal(const derivativeTypes & derivativeType_,
500  const realSerialArray & u,
501  const realSerialArray & scalar,
502  realSerialArray & ux,
503  const Index & I1_ = nullIndex,
504  const Index & I2_ = nullIndex,
505  const Index & I3_ = nullIndex,
506  const Index & C =nullIndex );
507 
508  int assignCoefficientsInternal(const derivativeTypes & derivativeType_,
509  realSerialArray & coeff,
510  const realSerialArray & scalar,
511  const Index & I1 = nullIndex ,
512  const Index & I2 = nullIndex ,
513  const Index & I3 = nullIndex ,
514  const Index & E = nullIndex ,
515  const Index & C = nullIndex );
516 
517 
518 protected:
519 // enum BoundaryConditionOption
520 // {
521 // scalarForcing=0,
522 // arrayForcing,
523 // gridFunctionForcing
524 // };
525  // Here are different ways we can assign the data for boundary conditions -- these are the same as
526  // in BoundaryConditionsParameters --
528  {
535  };
536 
537 
538  void setup(); // used by constructors
539 
540  // This routine computes the general derivative (protected because it returns by reference)
542  const realMappedGridFunction & u,
543  const Index & I1 = nullIndex,
544  const Index & I2 = nullIndex,
545  const Index & I3 = nullIndex,
546  const Index & C1 = nullIndex,
547  const Index & C2 = nullIndex,
548  const Index & C3 = nullIndex );
549 
551  const Index & I1 = nullIndex,
552  const Index & I2 = nullIndex,
553  const Index & I3 = nullIndex,
554  const Index & E = nullIndex,
555  const Index & C = nullIndex );
556 
557  virtual void computeDerivatives(const int & numberOfDerivatives,
558  const IntegerArray & derivativesToEvaluate,
560  const realMappedGridFunction & u,
561  const Index & I1,
562  const Index & I2,
563  const Index & I3,
564  const Index & N,
565  const bool & checkArrayDimensions = TRUE );
566 
567  // compute pseudo-spectral derivatives
568  virtual void spectralDerivatives(const int & numberOfDerivatives,
569  const IntegerArray & derivativesToEvaluate,
571  const realMappedGridFunction & u,
572  const Range & R1,
573  const Range & R2,
574  const Range & R3,
575  const Range & R4);
576 
577  virtual void updateDerivativeFunctions();
578 
579 
580  // ------------- Here we define the Boundary Conditions ---------------
581 
582  public:
583 
584 
585  // new BC interface:
587  const Index & Components,
588  const BCTypes::BCNames & boundaryConditionType=BCTypes::dirichlet,
589  const int & boundaryCondition = allBoundaries,
590  const real & forcing = 0.,
591  const real & time = 0.,
592  const BoundaryConditionParameters & bcParameters
594  const int & grid=0 );
595 
596 
598  const Index & Components,
599  const BCTypes::BCNames & boundaryConditionType,
600  const int & boundaryCondition,
601  const RealArray & forcing,
602  const real & time = 0.,
603  const BoundaryConditionParameters & bcParameters
605  const int & grid=0 );
606 
608  const Index & Components,
609  const BCTypes::BCNames & boundaryConditionType,
610  const int & boundaryCondition,
611  const RealArray & forcing,
612  RealArray *forcinga[2][3],
613  const real & time = 0.,
614  const BoundaryConditionParameters & bcParameters
616  const int & grid=0 );
617 
619  const Index & Components,
620  const BCTypes::BCNames & boundaryConditionType,
621  const int & boundaryCondition,
622  const realMappedGridFunction & forcing,
623  const real & time = 0.,
624  const BoundaryConditionParameters & bcParameters
626  const int & grid=0 );
627 
628 #ifdef USE_PPP
629  // this version takes a distributed array "forcing"
630 // void applyBoundaryCondition(realMappedGridFunction & u,
631 // const Index & Components,
632 // const BCTypes::BCNames & boundaryConditionType,
633 // const int & boundaryCondition,
634 // const RealDistributedArray & forcing,
635 // const real & time = 0.,
636 // const BoundaryConditionParameters & bcParameters
637 // = Overture::defaultBoundaryConditionParameters(),
638 // const int & grid=0 );
639 #endif
640  // fill in the BC's for a coefficient grid function
642  const Index & Equations,
643  const Index & Components,
644  const BCTypes::BCNames & boundaryConditionType=BCTypes::dirichlet,
645  const int & boundaryCondition= allBoundaries,
646  const BoundaryConditionParameters & bcParameters
648  const int & grid=0 );
649 
650  // fix corners and periodic update:
651 
652 
653  // private function to update arrays to be the correct size
654  void updateBoundaryConditionArrays(const int newNumberOfBoundaryConditions,
655  const int newNumberOfComponents );
656 
657  // private boundary condition routine:
659  const Index & Components,
660  const BCTypes::BCNames & boundaryConditionType,
661  const int & boundaryCondition,
662  const real & forcing1,
663  const RealArray & forcing2,
664  const RealArray & forcing2d,
665  RealArray *forcinga[2][3],
666  const realMappedGridFunction & forcing3,
667  const real & time,
668  const BoundaryConditionParameters & bcParameters,
669  const BoundaryConditionOption bcOption,
670  const int & grid=0 );
671 
672  // Here are functions that implement particular boundary conditions
673 
674  int getVelocityComponents(int & n1,
675  int & n2,
676  int & n3,
677  int & m1,
678  int & m2,
679  int & m3,
681  const BoundaryConditionParameters & bcParameters,
682  const aString & bcName, const IntegerArray & uC, const IntegerArray & fC );
683 
684 
686  const int side,
687  const int axis,
688  const Index & Components,
689  const BCTypes::BCNames & boundaryConditionType,
690  const int & boundaryCondition,
691  const real & forcing1,
692  const RealArray & forcing2,
693  const RealArray & forcing2d,
694  const realMappedGridFunction & forcing3,
695  const real & time,
696  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
697  const BoundaryConditionParameters & bcParameters,
698  const BoundaryConditionOption bcOption,
699  const int & grid=0 );
700 
702  const int side,
703  const int axis,
704  const Index & Components,
705  const BCTypes::BCNames & boundaryConditionType,
706  const int & boundaryCondition,
707  const real & forcing1,
708  const RealArray & forcing2,
709  const RealArray & forcing2d,
710  const realMappedGridFunction & forcing3,
711  const real & time,
712  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
713  const BoundaryConditionParameters & bcParameters,
714  const BoundaryConditionOption bcOption,
715  const int & grid=0 );
716 
718  const int side,
719  const int axis,
720  const Index & Components,
721  const BCTypes::BCNames & boundaryConditionType,
722  const int & boundaryCondition,
723  const real & forcing1,
724  const RealArray & forcing2,
725  const RealArray & forcing2d,
726  const realMappedGridFunction & forcing3,
727  const real & time,
728  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
729  const BoundaryConditionParameters & bcParameters,
730  const BoundaryConditionOption bcOption,
731  const int & grid=0 );
732 
734  const int side,
735  const int axis,
736  const Index & Components,
737  const BCTypes::BCNames & boundaryConditionType,
738  const int & boundaryCondition,
739  const real & forcing1,
740  const RealArray & forcing2,
741  const RealArray & forcing2d,
742  const realMappedGridFunction & forcing3,
743  const real & time,
744  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
745  const BoundaryConditionParameters & bcParameters,
746  const BoundaryConditionOption bcOption,
747  const int & grid=0 );
748 
750  const int side,
751  const int axis,
752  const Index & Components,
753  const BCTypes::BCNames & boundaryConditionType,
754  const int & boundaryCondition,
755  const real & forcing1,
756  const RealArray & forcing2,
757  const RealArray & forcing2d,
758  const realMappedGridFunction & forcing3,
759  const real & time,
760  const IntegerArray & uC, const IntegerArray & fC, IntegerDistributedArray & mask,
761  const BoundaryConditionParameters & bcParameters,
762  const BoundaryConditionOption bcOption,
763  const int & grid=0 );
764 
766  const int side,
767  const int axis,
768  const Index & Components,
769  const BCTypes::BCNames & boundaryConditionType,
770  const int & boundaryCondition,
771  const real & forcing1,
772  const RealArray & forcing2,
773  const RealArray & forcing2d,
774  const realMappedGridFunction & forcing3,
775  const real & time,
776  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
777  const BoundaryConditionParameters & bcParameters,
778  const BoundaryConditionOption bcOption,
779  const int & grid=0 );
780 
782  const int side,
783  const int axis,
784  const Index & Components,
785  const BCTypes::BCNames & boundaryConditionType,
786  const int & boundaryCondition,
787  const real & forcing1,
788  const RealArray & forcing2,
789  const RealArray & forcing2d,
790  const realMappedGridFunction & forcing3,
791  const real & time,
792  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
793  const BoundaryConditionParameters & bcParameters,
794  const BoundaryConditionOption bcOption,
795  const int & grid=0 );
796 
798  const int side,
799  const int axis,
800  const Index & Components,
801  const BCTypes::BCNames & boundaryConditionType,
802  const int & boundaryCondition,
803  const real & forcing1,
804  const RealArray & forcing2,
805  const RealArray & forcing2d,
806  const realMappedGridFunction & forcing3,
807  const real & time,
808  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
809  const BoundaryConditionParameters & bcParameters,
810  const BoundaryConditionOption bcOption,
811  const int & grid=0 );
812 
814  const int side,
815  const int axis,
816  const Index & Components,
817  const BCTypes::BCNames & boundaryConditionType,
818  const int & boundaryCondition,
819  const real & forcing1,
820  const RealArray & forcing2,
821  const RealArray & forcing2d,
822  const realMappedGridFunction & forcing3,
823  const real & time,
824  const IntegerArray & uC, const IntegerArray & fC, IntegerDistributedArray & mask,
825  const BoundaryConditionParameters & bcParameters,
826  const BoundaryConditionOption bcOption ,
827  const int & grid=0 );
828 
830  const int side,
831  const int axis,
832  const Index & Components,
833  const BCTypes::BCNames & boundaryConditionType,
834  const int & boundaryCondition,
835  const real & forcing1,
836  const RealArray & forcing2,
837  const RealArray & forcing2d,
838  const realMappedGridFunction & forcing3,
839  const real & time,
840  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
841  const BoundaryConditionParameters & bcParameters,
842  const BoundaryConditionOption bcOption,
843  const int & grid=0 );
844 
845 
847  const int side,
848  const int axis,
849  const real & scalarData,
850  const RealArray & arrayData,
851  const RealArray & forcing2d,
852  const realMappedGridFunction & gfData,
853  const real & t,
854  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
855  const BoundaryConditionParameters & bcParameters,
856  const BoundaryConditionOption bcOption,
857  const int & grid=0 );
858 
860  const int side,
861  const int axis,
862  const real & scalarData,
863  const RealArray & arrayData,
864  const RealArray & forcing2d,
865  const realMappedGridFunction & gfData,
866  const real & t,
867  const IntegerArray & uC, const IntegerArray & fC, const IntegerDistributedArray & mask,
868  const BoundaryConditionParameters & bcParameters,
869  const BoundaryConditionOption bcOption,
870  const int & grid=0 );
871 
873  const int side,
874  const int axis,
875  const Index & Components,
876  const BCTypes::BCNames & boundaryConditionType,
877  const int & boundaryCondition,
878  const real & forcing1,
879  const RealArray & forcing2,
880  const RealArray & forcing2d,
881  const realMappedGridFunction & forcing3,
882  const real & time,
883  const IntegerArray & uC, const IntegerArray & fC, IntegerDistributedArray & mask,
884  const BoundaryConditionParameters & bcParameters,
885  const BoundaryConditionOption bcOption ,
886  const int & grid=0 );
887 
888 
891  realSerialArray & nmCoeff, Index & M, Index &I1, Index &I2,Index &I3,
892  realSerialArray & normalLocal, real b0, real b1, int numberOfDimensions,
893  int side, int axis, const BoundaryConditionParameters & bcParameters );
894 
895 
896  public:
897  // RealDistributedArray ur,us,ut;
899  real dx[3]; // holds grid spacing for rectangular grids
901  int useNewOperators; // use new optimized operators
902 
903  protected:
904 
905  // allocate coeff. matrix for a boundary condition is necessary
906  bool createBoundaryMatrix(const int & side,
907  const int & axis,
908  const BCTypes::BCNames & boundaryConditionType);
909 
911  bool rectangular; // true if the grid is rectangular
912 
913 
914  int numberOfDerivativesToEvaluate; // holds user specified values
916  IntegerArray derivativeType; // holds user specified values
917 
918  bool boundaryData; // true if a rhs is supplied for the boundary conditions
919 
920  // This next array holds pointers to derivative functions
921  // derivativeFunction[0]= a function to compute the x derivative
922  // derivativeFunction[1]= a function to compute the y derivative, etc.
925 
926 
928  int nCoeffIsSet[3][2]; // true if neumannCoeff is used on the boundary
930  int mCoeffIsSet[3][2]; real mCoeffValues[3*2*2]; // we save the coefficents that define the mixed BC
932  int aCoeffIsSet[3][2]; real aCoeffValues[3*2*3];
934  int gCoeffIsSet[3][2]; real gCoeffValues[3*2*4];
936  int gdCoeffIsSet[3][2];
939 
941 
942  bool boundaryNormalsUsed; // indicates if any BC's use the vertexBoundaryNormal
943  bool boundaryTangentsUsed; // indicates if any BC's use the centerBoundaryTangent vectors
944 
946 
947  real useWhereMaskOnBoundary[3][2]; // TRUE if we should use a where mask on a given boundary
948 
949 
950  public:
951 
952 /* ----
953  // ****** These are from the OLD BC interface -- keep here in case we want to resurrect them *****
954 
955  // indicate how many boundary conditions are applied on each side
956  void setNumberOfBoundaryConditions(const int & number,
957  const int & side=forAll,
958  const int & axis=forAll );
959 
960  // associate a boundary condition with a given boundary
961  void setBoundaryCondition(const int & index, // boundary condition number
962  const int & side, // which boundary side
963  const int & axis, // which boundary axis
964  const boundaryConditionTypes & boundaryConditionType,
965  const int & component, // apply to this component
966  const int & parameter1=defaultValue, // optional parameters
967  const int & parameter2=defaultValue,
968  const int & parameter3=defaultValue );
969 
970  // associate a boundary condition with a given boundary
971  // use this function when a boundary condition involves more than one component such
972  // as setting the normal component of a vector
973  void setBoundaryCondition(const int & index, // boundary condition number
974  const int & side, // which boundary side
975  const int & axis, // which boundary axis
976  const boundaryConditionTypes & boundaryConditionType,
977  const IntegerArray & component ); // apply to these components
978 
979 
980  // set all boundary conditions to the given type
981  void setBoundaryCondition(const boundaryConditionTypes & boundaryConditionType );
982 
983  // General mixed derivative boundary condition with constant coefficients:
984  // B(0)*u + B(1)*u.x + B(2)*u.y + B(3)*u.z =
985  void setBoundaryCondition(const int & index, // boundary condition number
986  const int & side, // which boundary side
987  const int & axis, // which boundary axis
988  const boundaryConditionTypes & boundaryConditionType,
989  const int & component, // apply to this component
990  const RealArray & B );
991 
992  // supply scale values b(i) and multiple components, use this for aDotGradU
993  void setBoundaryCondition(const int & index,
994  const int & side,
995  const int & axis,
996  const boundaryConditionTypes & boundaryConditionType,
997  const IntegerArray & component,
998  const RealArray & b );
999 
1000 
1001  // General mixed derivative boundary condition with non-constant coefficients:
1002  // B(0,I1,I2,I3)*u + B(1,I1,I2,I3)*u.x + B(2,I1,I2,I3)*u.y + B(3,I1,I2,I3)*u.z =
1003  void setBoundaryCondition(const int & index, // boundary condition number
1004  const int & side, // which boundary side
1005  const int & axis, // which boundary axis
1006  const boundaryConditionTypes & boundaryConditionType,
1007  const int & component, // apply to this component
1008  const realMappedGridFunction & B );
1009 
1010  //
1011  // Supply a boundary value for a boundary condition (or turn off this option)
1012  //
1013  void setBoundaryConditionValue(const real & value,
1014  const int & index,
1015  const int & side,
1016  const int & axis,
1017  const bool & trueOrFalse=TRUE);
1018 
1019 
1020  // Indicate which faces should use the boundaryConditionRightHandSide array
1021  void setBoundaryConditionRightHandSide(const int & index,
1022  const int & side,
1023  const int & axis,
1024  const bool & trueOrFalse=TRUE);
1025 
1026  // supply a grid function that gives the "data" for the boundary condition
1027  void setBoundaryConditionRightHandSide( const realMappedGridFunction & boundaryConditionRightHandSide );
1028 
1029 
1030 
1031  void applyBoundaryConditions(realMappedGridFunction & u, const real & time = 0.);
1032  void ApplyBoundaryConditions(realMappedGridFunction & coeff, const real & time = 0.); // fill in coefficients
1033 // void fixBoundaryCorners(realMappedGridFunction & u);
1034 
1035 ----------- */
1036 };
1037 
1038 
1039 
1040 
1041 
1042 
1043 #endif