Chombo + EB  3.2
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 "AggEBPWLFillPatch.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  ///
48  /**
49  forceNoEBCF = true promises that the embedded boundary
50  will not cross the coarse-fine interface. This will save you
51  a lot of compute time if you are certain you are tagging all irregulkar cells.
52  */
53  EBLevelAdvect(const DisjointBoxLayout& a_thisDBL,
54  const DisjointBoxLayout& a_coarDBL,
55  const EBISLayout& a_thisEBISL,
56  const EBISLayout& a_coarEBISL,
57  const ProblemDomain& a_DProblem,
58  const int& a_nRefine,
59  const RealVect& a_dx,
60  const bool& a_hasCoarser,
61  const bool& a_hasFiner,
62  const EBPatchGodunovFactory* const a_patchGodunov,
63  const bool& a_forceNoEBCF = false,
64  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
65 
66  /// Actual constructor.
67  /**
68  For the coarsest level, an empty DisjointBoxLayout
69  is passed in for coaserDisjointBoxLayout.
70  Inside the routine, we cast away const-ness on the data members
71  for the assignment. The arguments passed in are maintained const.
72  (coding standards). a_nRefine is the refinement ratio between
73  this level and the next coarser level. a_numGhosts is the number
74  of ghost cells in each direction.
75  forceNoEBCF = true promises that the embedded boundary
76  will not cross the coarse-fine interface. This will save you
77  a lot of compute time if you are certain you are tagging all irregulkar cells.
78  */
79  void define(const DisjointBoxLayout& a_thisDBL,
80  const DisjointBoxLayout& a_coarDBL,
81  const EBISLayout& a_thisEBISL,
82  const EBISLayout& a_coarEBISL,
83  const ProblemDomain& a_DProblem,
84  const int& a_nRefine,
85  const RealVect& a_dx,
86  const bool& a_hasCoarser,
87  const bool& a_hasFiner,
88  const EBPatchGodunovFactory* const a_patchGodunov,
89  const bool& a_forceNoEBCF = false,
90  const EBIndexSpace* const a_eb = Chombo_EBIS::instance());
91 
92  ///
93  /**
94  1. Average advection velocity to cell centers to get unorm.
95  2. Do linear C/F interpolation on a_cellState and compute
96  the diffusion source term if necessary. Quadratic is unnecessary
97  because the laplacian does its own CF interpolation in the
98  viscous case.
99  3. Do linear C/F interpolation in space and time
100  4. Extrapolate cellState to to faces using patchgodunov->extrapolatePrim
101 
102  Notes: The advection velocity that is sent in is not used. It will be
103  taken out in later designs
104  */
105  void
107  LayoutData< Vector< BaseIVFAB<Real>* > >& a_coveredPrimLo,
108  LayoutData< Vector< BaseIVFAB<Real>* > >& a_coveredPrimHi,
109  const LayoutData< Vector< Vector<VolIndex> > >& a_coveredFaceLo,
110  const LayoutData< Vector< Vector<VolIndex> > >& a_coveredFaceHi,
111  const LayoutData< Vector< IntVectSet> >& a_coveredSetsLo,
112  const LayoutData< Vector< IntVectSet> >& a_coveredSetsHi,
113  const LevelData< EBCellFAB >& a_consState,
114  const LevelData< EBCellFAB >& a_normalVel,
115  const LevelData< EBFluxFAB >& a_advectionVel,
116  const LevelData< EBCellFAB >* a_consStateCoarseOld,
117  const LevelData< EBCellFAB >* a_consStateCoarseNew,
118  const LevelData< EBCellFAB >* a_normalVelCoarseOld,
119  const LevelData< EBCellFAB >* a_normalVelCoarseNew,
120  const Real& a_timeCoarseOld,
121  const Real& a_timeCoarseNew,
122  const Real& a_timeFine,
123  const Real& a_dt,
124  const LevelData<EBCellFAB>* const a_source = NULL,
125  const LevelData<EBCellFAB>* const a_sourceCoarOld = NULL,
126  const LevelData<EBCellFAB>* const a_sourceCoarNew = NULL);
127 
128 
129 
130  void
131  advectToFaces(EBFluxFAB& a_extrapState,
132  BaseIVFAB<Real>& a_boundaryPrim,
133  Vector< BaseIVFAB<Real>* >& a_coveredPrimLo,
134  Vector< BaseIVFAB<Real>* >& a_coveredPrimHi,
135  const Vector< Vector<VolIndex> >& a_coveredFaceLo,
136  const Vector< Vector<VolIndex> >& a_coveredFaceHi,
137  const Vector< IntVectSet >& a_coveredSetsLo,
138  const Vector< IntVectSet >& a_coveredSetsHi,
139  const EBCellFAB & a_consState,
140  const EBCellFAB & a_normalVel,
141  const EBFluxFAB & a_advectionVel,
142  const Box& a_cellBox,
143  const EBISBox& a_ebisBox,
144  const Real& a_dt,
145  const Real& a_time,
146  const EBCellFAB & a_source,
147  const DataIndex& a_dit,
148  bool a_doBoundaryPrim);
149 
150 
151 
152  void
154  const LevelData< EBCellFAB >& a_consState,
155  const LevelData< EBCellFAB >& a_normalVel,
156  const LevelData< EBFluxFAB >& a_advectionVel,
157  const LevelData< EBCellFAB >* a_consStateCoarseOld,
158  const LevelData< EBCellFAB >* a_consStateCoarseNew,
159  const LevelData< EBCellFAB >* a_normalVelCoarseOld,
160  const LevelData< EBCellFAB >* a_normalVelCoarseNew,
161  const Real& a_timeCoarseOld,
162  const Real& a_timeCoarseNew,
163  const Real& a_timeFine,
164  const Real& a_dt,
165  const LevelData<EBCellFAB>* const a_source = NULL,
166  const LevelData<EBCellFAB>* const a_sourceCoarOld = NULL,
167  const LevelData<EBCellFAB>* const a_sourceCoarNew = NULL);
168 
169 
170 
171  void
172  advectToFacesBCG(EBFluxFAB& a_extrapState,
173  BaseIVFAB<Real>& a_boundaryPrim,
174  const EBCellFAB & a_consState,
175  const EBCellFAB & a_normalVel,
176  const EBFluxFAB & a_advectionVel,
177  const Box& a_cellBox,
178  const EBISBox& a_ebisBox,
179  const Real& a_dt,
180  const Real& a_time,
181  const EBCellFAB & a_source,
182  const DataIndex& a_dit,
183  bool a_doBoundaryPrim);
184 
185 
186 
187  void
189  const LevelData<EBFluxFAB>& a_advectionVel,
190  const LayoutData<Vector<BaseIVFAB<Real> * > >& a_coveredVeloLo,
191  const LayoutData<Vector<BaseIVFAB<Real> * > >& a_coveredVeloHi,
192  const LayoutData<Vector<Vector<VolIndex> > >& a_coveredFaceLo,
193  const LayoutData<Vector<Vector<VolIndex> > >& a_coveredFaceHi) const;
194 
195  bool isDefined() const;
196 
198  {
199  return *m_ebPatchAdvect[a_dit];
200  }
201  void resetBCs(const RefCountedPtr<EBPhysIBCFactory>& a_advectBC);
202 protected:
203 
210  int m_nVar;
211  int m_nGhost;
212 
221 
222 private:
223  //disallowed for all the usual reasons
224  void operator=(const EBLevelAdvect& a_input)
225  {
226  MayDay::Error("invalid operator");
227  }
228  EBLevelAdvect(const EBLevelAdvect& a_input)
229  {
230  MayDay::Error("invalid operator");
231  }
232 };
233 
234 #include "NamespaceFooter.H"
235 #endif
EBPatchAdvect & getPatchAdvect(const DataIndex &a_dit)
Definition: EBLevelAdvect.H:197
AggEBPWLFillPatch m_fillPatch
Definition: EBLevelAdvect.H:217
bool m_hasFiner
Definition: EBLevelAdvect.H:205
Definition: EBPatchGodunovFactory.H:20
int m_nGhost
Definition: EBLevelAdvect.H:211
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
bool isDefined() const
one dimensional dynamic array
Definition: Vector.H:53
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
Definition: AggEBPWLFillPatch.H:36
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: EBISBox.H:46
EBISLayout m_thisEBISL
Definition: EBLevelAdvect.H:215
Definition: EBPatchAdvect.H:25
Definition: EBLevelAdvect.H:31
EBLevelAdvect()
Default constructor.
bool m_isDefined
Definition: EBLevelAdvect.H:207
LayoutData< EBPatchAdvect * > m_ebPatchAdvect
Definition: EBLevelAdvect.H:220
DisjointBoxLayout m_thisGrids
Definition: EBLevelAdvect.H:213
A EBFaceFAB-like container for edge-centered fluxes.
Definition: EBFluxFAB.H:25
static EBIndexSpace * instance()
DisjointBoxLayout m_coarGrids
Definition: EBLevelAdvect.H:214
Definition: EBCellFAB.H:29
double Real
Definition: REAL.H:33
bool m_forceNoEBCF
Definition: EBLevelAdvect.H:206
bool m_hasCoarser
Definition: EBLevelAdvect.H:204
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
int m_nVar
Definition: EBLevelAdvect.H:210
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 bool &a_forceNoEBCF=false, 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:216
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:208
EBLevelAdvect(const EBLevelAdvect &a_input)
Definition: EBLevelAdvect.H:228
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
AggEBPWLFillPatch m_fillPatchVel
Definition: EBLevelAdvect.H:218
Definition: DataIndex.H:112
void resetBCs(const RefCountedPtr< EBPhysIBCFactory > &a_advectBC)
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:224
Definition: EBISLayout.H:39
~EBLevelAdvect()
Destructor.
ProblemDomain m_domain
Definition: EBLevelAdvect.H:219
int m_refRatCrse
Definition: EBLevelAdvect.H:209
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)