Chombo + EB  3.2
LevelAdvect.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 #ifndef _LEVELADVECT_H_
12 #define _LEVELADVECT_H_
13 
14 #include "FArrayBox.H"
15 #include "FluxBox.H"
16 #include "DisjointBoxLayout.H"
17 #include "LevelData.H"
19 #include "LevelFluxRegister.H"
20 #include "ProblemDomain.H"
21 #include "Copier.H"
22 #include "PatchGodunov.H"
23 #include "AdvectPhysics.H"
24 
25 #include "NamespaceHeader.H"
26 
27 /// Advection integrator on a level
28 /**
29  */
31 {
32 public:
33  /// Default constructor
34  /**
35  Object requires define() to be called before all other functions.
36  */
38  {
39  m_dx = 0.0;
40  m_refineCoarse = 0;
41  m_isDefined = false;
42  }
43 
44  /// Destructor
45  /**
46  Destroys all objects created by define(). Passed in data references
47  of define() are left alone.
48  */
50  {
51  }
52 
53  /// Actual constructor.
54  /**
55  Inside the routine, we cast away const-ness on the data members
56  for the assignment. The arguments passed in are maintained const
57  (coding standards).
58  */
59  void define(/// advection physics class
60  const AdvectPhysics& a_gphys,
61  /// box layout at this level
62  const DisjointBoxLayout& a_thisDisjointBoxLayout,
63  /// box layout at next coarser level (or empty if this is coarsest level)
64  const DisjointBoxLayout& a_coarserDisjointBoxLayout,
65  /// problem domain at this level
66  const ProblemDomain& a_domain,
67  /// refinement ratio between this level and next coarser level
68  const int& a_refineCoarse,
69  /// whether to use limiting
70  const bool& a_useLimiting,
71  /// grid spacing at this level
72  const Real& a_dx,
73  /// whether there is a coarser level
74  const bool& a_hasCoarser,
75  /// whether there is a finer level
76  const bool& a_hasFiner);
77 
78  /// Advance the solution by one timestep on this grid level.
79  /**
80  */
81  Real step(/// conserved variables at this level, defined on a_thisDisjointBoxLayout in define(); gets updated in this routine
83  /// flux register with next finer level
84  LevelFluxRegister& a_finerFluxRegister,
85  /// flux register with next coarser level
86  LevelFluxRegister& a_coarserFluxRegister,
87  /// advection velocity on faces
88  LevelData<FluxBox>& a_advectionVelocity,
89  /// source term, or if no source term then this is null constructed and not defined
90  const LevelData<FArrayBox>& a_S,
91  /// conserved variables at coarser level at time of last coarser-level update, or empty if no coarser level; may be empty if interpolation not required
92  const LevelData<FArrayBox>& a_UCoarseOld,
93  /// time of last update at coarser level
94  const Real& a_TCoarseOld,
95  /// conserved variables at coarser level at time of next coarser-level update, or empty if no coarser level; may be empty if interpolation not required
96  const LevelData<FArrayBox>& a_UCoarseNew,
97  /// time of next update at coarser level
98  const Real& a_TCoarseNew,
99  /// current time
100  const Real& a_time,
101  /// time step
102  const Real& a_dt);
103 
104  /// Convert velocity from face-centered to cell-centered
105  /**
106  In each direction, take average of normal component of velocity
107  on the neighboring faces in that direction.
108  */
109  void averageVelToCC(/// cell-centered velocity
110  FArrayBox& a_normalVel,
111  /// face-centered velocity
112  const FluxBox & a_advectionVel,
113  /// Box on which to return a_normalVel
114  const Box& a_box) const;
115 
116  /// Fill in ghost cells by exchange at this level and then by interpolation from coarser level (if any).
117  void fillGhost(/// conserved variables at this level, with ghosts cells to be filled in
119  /// conserved variables at coarser level at time of last coarser-level update, or empty if no coarser level; may be empty if interpolation not required
120  const LevelData<FArrayBox>& a_UCoarseOld,
121  /// time of last update at coarser level
122  const Real& a_TCoarseOld,
123  /// conserved variables at coarser level at time of next coarser-level update, or empty if no coarser level; may be empty if interpolation not required
124  const LevelData<FArrayBox>& a_UCoarseNew,
125  /// time of next update at coarser level
126  const Real& a_TCoarseNew,
127  /// time step
128  const Real& a_dt,
129  /// current time
130  const Real& a_time);
131 
132  /// Get maximum wave speed
133  /**
134  */
135  Real getMaxWaveSpeed(/// conserved variables at this level
136  const LevelData<FArrayBox>& a_U,
137  /// face-centered velocities
138  LevelData<FluxBox>& a_advectionVelocity);
139 
140 protected:
141 
142  /// layout for this level
144 
145  /// patch integrator
147 
148  /// physics class
150 
151  /// number of ghost cells need locally for this level
153 
154  /// exchange copier
156 
157  /// interpolator for filling in ghost cells from the next coarser level
159 
160  /// grid spacing
162 
163  /// problem domain - index space for this level
165 
166  /// refinement ratio between this level and the next coarser
168 
169  /// whether a coarser level exists
171 
172  /// whether a finer level exists
174 
175  /// number of conserved variables (= 1)
176  int m_numCons;//=1
177 
178  /// order of normal predictor
180 
181  /// whether to use 4th-order slope computations (otherwise, use 2nd order)
183 
184  /// whether to do slope limiting in the primitive variables
186 
187  /// whether to do slope limiting in the characteristic variables
189 
190  /// whether to do slope flattening - MUST BE USING 4th-order slopes
192 
193  /// whether to apply artificial viscosity of a set value
195 
196  /// artificial viscosity coefficient
198 
199  /// whether this object has been defined
201 
202 private:
203 
204  // Disallowed for all the usual reasons
205  void operator=(const LevelAdvect&);
206  LevelAdvect(const LevelAdvect&);
207 };
208 
209 #include "NamespaceFooter.H"
210 
211 #endif
AdvectPhysics * m_advectPhysics
physics class
Definition: LevelAdvect.H:149
bool m_useCharLimiting
whether to do slope limiting in the characteristic variables
Definition: LevelAdvect.H:188
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Fills ghost cells by linear interpolation in space and time.
Definition: PiecewiseLinearFillPatch.H:128
bool m_usePrimLimiting
whether to do slope limiting in the primitive variables
Definition: LevelAdvect.H:185
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:145
void fillGhost(LevelData< FArrayBox > &a_U, const LevelData< FArrayBox > &a_UCoarseOld, const Real &a_TCoarseOld, const LevelData< FArrayBox > &a_UCoarseNew, const Real &a_TCoarseNew, const Real &a_dt, const Real &a_time)
Fill in ghost cells by exchange at this level and then by interpolation from coarser level (if any)...
bool m_useFlattening
whether to do slope flattening - MUST BE USING 4th-order slopes
Definition: LevelAdvect.H:191
Real getMaxWaveSpeed(const LevelData< FArrayBox > &a_U, LevelData< FluxBox > &a_advectionVelocity)
Get maximum wave speed.
PiecewiseLinearFillPatch m_patcher
interpolator for filling in ghost cells from the next coarser level
Definition: LevelAdvect.H:158
bool m_useFourthOrderSlopes
whether to use 4th-order slope computations (otherwise, use 2nd order)
Definition: LevelAdvect.H:182
ProblemDomain m_domain
problem domain - index space for this level
Definition: LevelAdvect.H:164
int m_numCons
number of conserved variables (= 1)
Definition: LevelAdvect.H:176
int m_numGhost
number of ghost cells need locally for this level
Definition: LevelAdvect.H:152
DisjointBoxLayout m_grids
layout for this level
Definition: LevelAdvect.H:143
Advection integrator on a level.
Definition: LevelAdvect.H:30
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
Copier m_exchangeCopier
exchange copier
Definition: LevelAdvect.H:155
bool m_useArtificialViscosity
whether to apply artificial viscosity of a set value
Definition: LevelAdvect.H:194
int m_normalPredOrder
order of normal predictor
Definition: LevelAdvect.H:179
bool m_isDefined
whether this object has been defined
Definition: LevelAdvect.H:200
bool m_hasCoarser
whether a coarser level exists
Definition: LevelAdvect.H:170
double Real
Definition: REAL.H:33
PatchGodunov m_patchGodunov
patch integrator
Definition: LevelAdvect.H:146
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LevelFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: LevelFluxRegister.H:29
Real m_artificialViscosity
artificial viscosity coefficient
Definition: LevelAdvect.H:197
A class derived from GodunovPhysics for simple advection-diffusion problems.
Definition: AdvectPhysics.H:22
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
void operator=(const LevelAdvect &)
bool m_hasFiner
whether a finer level exists
Definition: LevelAdvect.H:173
Real step(LevelData< FArrayBox > &a_U, LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, LevelData< FluxBox > &a_advectionVelocity, const LevelData< FArrayBox > &a_S, const LevelData< FArrayBox > &a_UCoarseOld, const Real &a_TCoarseOld, const LevelData< FArrayBox > &a_UCoarseNew, const Real &a_TCoarseNew, const Real &a_time, const Real &a_dt)
Advance the solution by one timestep on this grid level.
int m_refineCoarse
refinement ratio between this level and the next coarser
Definition: LevelAdvect.H:167
~LevelAdvect()
Destructor.
Definition: LevelAdvect.H:49
Definition: FArrayBox.H:45
LevelAdvect()
Default constructor.
Definition: LevelAdvect.H:37
Definition: PatchGodunov.H:33
Real m_dx
grid spacing
Definition: LevelAdvect.H:161
void define(const AdvectPhysics &a_gphys, const DisjointBoxLayout &a_thisDisjointBoxLayout, const DisjointBoxLayout &a_coarserDisjointBoxLayout, const ProblemDomain &a_domain, const int &a_refineCoarse, const bool &a_useLimiting, const Real &a_dx, const bool &a_hasCoarser, const bool &a_hasFiner)
Actual constructor.
void averageVelToCC(FArrayBox &a_normalVel, const FluxBox &a_advectionVel, const Box &a_box) const
Convert velocity from face-centered to cell-centered.