Chombo + EB  3.0
EBLevelAdvect.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 // dtg 1-29-2004
12 
13 #ifndef _EBLEVELADVECT_H_
14 #define _EBLEVELADVECT_H_
15 
16 #include "EBCellFAB.H"
17 #include "DisjointBoxLayout.H"
18 #include "LevelData.H"
20 #include "EBPWLFillPatch.H"
21 #include "EBFluxRegister.H"
22 #include "ProblemDomain.H"
23 #include "EBPatchGodunovFactory.H"
24 #include "EBPatchAdvect.H"
25 #include "NamespaceHeader.H"
26 
27 ///
28 /**
29  Advection and diffusion on a level using
30  */
32 {
33 public:
34  /// Default constructor
35  /**
36  Object requires define(..) to be called before all other functions.
37  */
38  EBLevelAdvect();
39 
40  /// Destructor
41  /**
42  destroys all objects created by define(..). Passed in
43  data references of define(..) are left alone.
44  */
46 
47  EBLevelAdvect(const DisjointBoxLayout& a_thisDBL,
48  const DisjointBoxLayout& a_coarDBL,
49  const EBISLayout& a_thisEBISL,
50  const EBISLayout& a_coarEBISL,
51  const ProblemDomain& a_DProblem,
52  const int& a_nRefine,
53  const RealVect& a_dx,
54  const bool& a_hasCoarser,
55  const bool& a_hasFiner,
56  const EBPatchGodunovFactory* const a_patchGodunov,
57  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
58 
59  /// Actual constructor.
60  /**
61  For the coarsest level, an empty DisjointBoxLayout
62  is passed in for coaserDisjointBoxLayout.
63  Inside the routine, we cast away const-ness on the data members
64  for the assignment. The arguments passed in are maintained const.
65  (coding standards). a_nRefine is the refinement ratio between
66  this level and the next coarser level. a_numGhosts is the number
67  of ghost cells in each direction.
68  */
69  void define(const DisjointBoxLayout& a_thisDBL,
70  const DisjointBoxLayout& a_coarDBL,
71  const EBISLayout& a_thisEBISL,
72  const EBISLayout& a_coarEBISL,
73  const ProblemDomain& a_DProblem,
74  const int& a_nRefine,
75  const RealVect& a_dx,
76  const bool& a_hasCoarser,
77  const bool& a_hasFiner,
78  const EBPatchGodunovFactory* const a_patchGodunov,
79  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
80 
81  ///
82  /**
83  1. Average advection velocity to cell centers to get unorm.
84  2. Do linear C/F interpolation on a_cellState and compute
85  the diffusion source term if necessary. Quadratic is unnecessary
86  because the laplacian does its own CF interpolation in the
87  viscous case.
88  3. Do linear C/F interpolation in space and time
89  4. Extrapolate cellState to to faces using patchgodunov->extrapolatePrim
90 
91  Notes: The advection velocity that is sent in is not used. It will be
92  taken out in later designs
93  */
94  void
96  LayoutData< Vector< BaseIVFAB<Real>* > >& a_coveredPrimLo,
97  LayoutData< Vector< BaseIVFAB<Real>* > >& a_coveredPrimHi,
98  const LayoutData< Vector< Vector<VolIndex> > >& a_coveredFaceLo,
99  const LayoutData< Vector< Vector<VolIndex> > >& a_coveredFaceHi,
100  const LayoutData< Vector< IntVectSet> >& a_coveredSetsLo,
101  const LayoutData< Vector< IntVectSet> >& a_coveredSetsHi,
102  const LevelData< EBCellFAB >& a_consState,
103  const LevelData< EBCellFAB >& a_normalVel,
104  const LevelData< EBFluxFAB >& a_advectionVel,
105  const LevelData< EBCellFAB >* a_consStateCoarseOld,
106  const LevelData< EBCellFAB >* a_consStateCoarseNew,
107  const LevelData< EBCellFAB >* a_normalVelCoarseOld,
108  const LevelData< EBCellFAB >* a_normalVelCoarseNew,
109  const Real& a_timeCoarseOld,
110  const Real& a_timeCoarseNew,
111  const Real& a_timeFine,
112  const Real& a_dt,
113  const LevelData<EBCellFAB>* const a_source = NULL,
114  const LevelData<EBCellFAB>* const a_sourceCoarOld = NULL,
115  const LevelData<EBCellFAB>* const a_sourceCoarNew = NULL);
116 
117 
118 
119  void
120  advectToFaces(EBFluxFAB& a_extrapState,
121  BaseIVFAB<Real>& a_boundaryPrim,
122  Vector< BaseIVFAB<Real>* >& a_coveredPrimLo,
123  Vector< BaseIVFAB<Real>* >& a_coveredPrimHi,
124  const Vector< Vector<VolIndex> >& a_coveredFaceLo,
125  const Vector< Vector<VolIndex> >& a_coveredFaceHi,
126  const Vector< IntVectSet >& a_coveredSetsLo,
127  const Vector< IntVectSet >& a_coveredSetsHi,
128  const EBCellFAB & a_consState,
129  const EBCellFAB & a_normalVel,
130  const EBFluxFAB & a_advectionVel,
131  const Box& a_cellBox,
132  const EBISBox& a_ebisBox,
133  const Real& a_dt,
134  const Real& a_time,
135  const EBCellFAB & a_source,
136  const DataIndex& a_dit,
137  bool a_doBoundaryPrim);
138 
139 
140 
141  void
143  const LevelData< EBCellFAB >& a_consState,
144  const LevelData< EBCellFAB >& a_normalVel,
145  const LevelData< EBFluxFAB >& a_advectionVel,
146  const LevelData< EBCellFAB >* a_consStateCoarseOld,
147  const LevelData< EBCellFAB >* a_consStateCoarseNew,
148  const LevelData< EBCellFAB >* a_normalVelCoarseOld,
149  const LevelData< EBCellFAB >* a_normalVelCoarseNew,
150  const Real& a_timeCoarseOld,
151  const Real& a_timeCoarseNew,
152  const Real& a_timeFine,
153  const Real& a_dt,
154  const LevelData<EBCellFAB>* const a_source = NULL,
155  const LevelData<EBCellFAB>* const a_sourceCoarOld = NULL,
156  const LevelData<EBCellFAB>* const a_sourceCoarNew = NULL);
157 
158 
159 
160  void
161  advectToFacesBCG(EBFluxFAB& a_extrapState,
162  BaseIVFAB<Real>& a_boundaryPrim,
163  const EBCellFAB & a_consState,
164  const EBCellFAB & a_normalVel,
165  const EBFluxFAB & a_advectionVel,
166  const Box& a_cellBox,
167  const EBISBox& a_ebisBox,
168  const Real& a_dt,
169  const Real& a_time,
170  const EBCellFAB & a_source,
171  const DataIndex& a_dit,
172  bool a_doBoundaryPrim);
173 
174 
175 
176  void
178  const LevelData<EBFluxFAB>& a_advectionVel,
179  const LayoutData<Vector<BaseIVFAB<Real> * > >& a_coveredVeloLo,
180  const LayoutData<Vector<BaseIVFAB<Real> * > >& a_coveredVeloHi,
181  const LayoutData<Vector<Vector<VolIndex> > >& a_coveredFaceLo,
182  const LayoutData<Vector<Vector<VolIndex> > >& a_coveredFaceHi) const;
183 
184  bool isDefined() const;
185 
187  {
188  return *m_ebPatchAdvect[a_dit];
189  }
190  void resetBCs(const RefCountedPtr<EBPhysIBCFactory>& a_advectBC);
191 protected:
192 
198  int m_nVar;
199  int m_nGhost;
200 
209 
210 private:
211  //disallowed for all the usual reasons
212  void operator=(const EBLevelAdvect& a_input)
213  {
214  MayDay::Error("invalid operator");
215  }
216  EBLevelAdvect(const EBLevelAdvect& a_input)
217  {
218  MayDay::Error("invalid operator");
219  }
220 };
221 
222 #include "NamespaceFooter.H"
223 #endif
EBPatchAdvect & getPatchAdvect(const DataIndex &a_dit)
Definition: EBLevelAdvect.H:186
bool m_hasFiner
Definition: EBLevelAdvect.H:194
Definition: EBPatchGodunovFactory.H:20
int m_nGhost
Definition: EBLevelAdvect.H:199
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
one dimensional dynamic array
Definition: Vector.H:52
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: LayoutData.H:46
Definition: EBPWLFillPatch.H:35
Definition: EBISBox.H:46
EBISLayout m_thisEBISL
Definition: EBLevelAdvect.H:203
Definition: EBPatchAdvect.H:25
void computeNormalVel(LevelData< EBCellFAB > &a_normalVel, const LevelData< EBFluxFAB > &a_advectionVel, const LayoutData< Vector< BaseIVFAB< Real > * > > &a_coveredVeloLo, const LayoutData< Vector< BaseIVFAB< Real > * > > &a_coveredVeloHi, const LayoutData< Vector< Vector< VolIndex > > > &a_coveredFaceLo, const LayoutData< Vector< Vector< VolIndex > > > &a_coveredFaceHi) const
Definition: EBLevelAdvect.H:31
EBLevelAdvect()
Default constructor.
bool m_isDefined
Definition: EBLevelAdvect.H:195
LayoutData< EBPatchAdvect * > m_ebPatchAdvect
Definition: EBLevelAdvect.H:208
DisjointBoxLayout m_thisGrids
Definition: EBLevelAdvect.H:201
A EBFaceFAB-like container for edge-centered fluxes.
Definition: EBFluxFAB.H:25
static EBIndexSpace * instance()
DisjointBoxLayout m_coarGrids
Definition: EBLevelAdvect.H:202
Definition: EBCellFAB.H:29
double Real
Definition: REAL.H:33
bool m_hasCoarser
Definition: EBLevelAdvect.H:193
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
int m_nVar
Definition: EBLevelAdvect.H:198
void define(const DisjointBoxLayout &a_thisDBL, const DisjointBoxLayout &a_coarDBL, const EBISLayout &a_thisEBISL, const EBISLayout &a_coarEBISL, const ProblemDomain &a_DProblem, const int &a_nRefine, const RealVect &a_dx, const bool &a_hasCoarser, const bool &a_hasFiner, const EBPatchGodunovFactory *const a_patchGodunov, const EBIndexSpace *const a_eb=Chombo_EBIS::instance())
Actual constructor.
void advectToFacesBCG(LevelData< EBFluxFAB > &a_extrapState, const LevelData< EBCellFAB > &a_consState, const LevelData< EBCellFAB > &a_normalVel, const LevelData< EBFluxFAB > &a_advectionVel, const LevelData< EBCellFAB > *a_consStateCoarseOld, const LevelData< EBCellFAB > *a_consStateCoarseNew, const LevelData< EBCellFAB > *a_normalVelCoarseOld, const LevelData< EBCellFAB > *a_normalVelCoarseNew, const Real &a_timeCoarseOld, const Real &a_timeCoarseNew, const Real &a_timeFine, const Real &a_dt, const LevelData< EBCellFAB > *const a_source=NULL, const LevelData< EBCellFAB > *const a_sourceCoarOld=NULL, const LevelData< EBCellFAB > *const a_sourceCoarNew=NULL)
EBISLayout m_coarEBISL
Definition: EBLevelAdvect.H:204
EBPWLFillPatch m_fillPatch
Definition: EBLevelAdvect.H:205
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
RealVect m_dx
Definition: EBLevelAdvect.H:196
EBLevelAdvect(const EBLevelAdvect &a_input)
Definition: EBLevelAdvect.H:216
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: DataIndex.H:112
void resetBCs(const RefCountedPtr< EBPhysIBCFactory > &a_advectBC)
bool isDefined() const
void advectToFacesCol(LevelData< EBFluxFAB > &a_extrapState, LayoutData< Vector< BaseIVFAB< Real > * > > &a_coveredPrimLo, LayoutData< Vector< BaseIVFAB< Real > * > > &a_coveredPrimHi, const LayoutData< Vector< Vector< VolIndex > > > &a_coveredFaceLo, const LayoutData< Vector< Vector< VolIndex > > > &a_coveredFaceHi, const LayoutData< Vector< IntVectSet > > &a_coveredSetsLo, const LayoutData< Vector< IntVectSet > > &a_coveredSetsHi, const LevelData< EBCellFAB > &a_consState, const LevelData< EBCellFAB > &a_normalVel, const LevelData< EBFluxFAB > &a_advectionVel, const LevelData< EBCellFAB > *a_consStateCoarseOld, const LevelData< EBCellFAB > *a_consStateCoarseNew, const LevelData< EBCellFAB > *a_normalVelCoarseOld, const LevelData< EBCellFAB > *a_normalVelCoarseNew, const Real &a_timeCoarseOld, const Real &a_timeCoarseNew, const Real &a_timeFine, const Real &a_dt, const LevelData< EBCellFAB > *const a_source=NULL, const LevelData< EBCellFAB > *const a_sourceCoarOld=NULL, const LevelData< EBCellFAB > *const a_sourceCoarNew=NULL)
void operator=(const EBLevelAdvect &a_input)
Definition: EBLevelAdvect.H:212
Definition: EBISLayout.H:39
~EBLevelAdvect()
Destructor.
EBPWLFillPatch m_fillPatchVel
Definition: EBLevelAdvect.H:206
ProblemDomain m_domain
Definition: EBLevelAdvect.H:207
int m_refRatCrse
Definition: EBLevelAdvect.H:197
void advectToFaces(EBFluxFAB &a_extrapState, BaseIVFAB< Real > &a_boundaryPrim, Vector< BaseIVFAB< Real > * > &a_coveredPrimLo, Vector< BaseIVFAB< Real > * > &a_coveredPrimHi, const Vector< Vector< VolIndex > > &a_coveredFaceLo, const Vector< Vector< VolIndex > > &a_coveredFaceHi, const Vector< IntVectSet > &a_coveredSetsLo, const Vector< IntVectSet > &a_coveredSetsHi, const EBCellFAB &a_consState, const EBCellFAB &a_normalVel, const EBFluxFAB &a_advectionVel, const Box &a_cellBox, const EBISBox &a_ebisBox, const Real &a_dt, const Real &a_time, const EBCellFAB &a_source, const DataIndex &a_dit, bool a_doBoundaryPrim)