Chombo + EB + MF  3.2
LevelGodunov.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 _LEVELGODUNOV_H_
12 #define _LEVELGODUNOV_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 
23 #include "PatchGodunov.H"
24 #include "NamespaceHeader.H"
25 
26 /// Level Godunov - really a hyperbolic level integrator
27 /**
28  */
30 {
31 public:
32  /// Default constructor
33  /**
34  Object requires define() to be called before all other functions.
35  */
36  LevelGodunov();
37 
38  /// Destructor
39  /**
40  Destroys all objects created by define(). Passed in data references
41  of define() are left alone.
42  */
43  ~LevelGodunov();
44 
45  /// Actual constructor.
46  /**
47  Inside the routine, we cast away const-ness on the data members
48  for the assignment. The arguments passed in are maintained const
49  (coding standards).
50  */
51  void define(/// box layout at this level
52  const DisjointBoxLayout& a_thisDisjointBoxLayout,
53  /// box layout at next coarser level (or empty if this is coarsest level)
54  const DisjointBoxLayout& a_coarserDisjointBoxLayout,
55  /// problem domain at this level
56  const ProblemDomain& a_domain,
57  /// refinement ratio between this level and next coarser level
58  const int& a_refineCoarse,
59  /// grid spacing at this level
60  const Real& a_dx,
61  /// pointer to GodunovPhysics class
62  const GodunovPhysics* const a_godunovFactory,
63  /// order of the normal predictor: 1 for PLM, 2 for PPM
64  const int& a_normalPredOrder,
65  /// whether to use 4th-order slopes
66  const bool& a_useFourthOrderSlopes,
67  /// whether to apply slope limiting to primitive variables
68  const bool& a_usePrimLimiting,
69  /// whether to apply slope limiting to characteristic variables
70  const bool& a_useCharLimiting,
71  /// whether to apply slope flattening
72  const bool& a_useFlattening,
73  /// whether to apply artificial viscosity
74  const bool& a_useArtificialViscosity,
75  /// artificial viscosity coefficient
76  const Real& a_artificialViscosity,
77  /// whether there is a coarser level
78  const bool& a_hasCoarser,
79  /// whether there is a finer level
80  const bool& a_hasFiner);
81 
82  /// Take one timestep for this grid level.
83  Real step(/// conserved variables at this level, defined on a_thisDisjointBoxLayout in define()
85  /// flux, for passing face-centered data in and out of the function
87  /// flux register with next finer level
88  LevelFluxRegister& a_finerFluxRegister,
89  /// flux register with next coarser level
90  LevelFluxRegister& a_coarserFluxRegister,
91  /// source term, or if no source term then this is null constructed and not defined
92  const LevelData<FArrayBox>& a_S,
93  /// 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
94  const LevelData<FArrayBox>& a_UCoarseOld,
95  /// time of last update at coarser level
96  const Real& a_TCoarseOld,
97  /// 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
98  const LevelData<FArrayBox>& a_UCoarseNew,
99  /// time of next update at coarser level
100  const Real& a_TCoarseNew,
101  /// current time
102  const Real& a_time,
103  /// time step
104  const Real& a_dt);
105 
106  /// Compute the time-centered values of the primitive variables on cell faces.
107  /**
108  This API is used in cases where some operation over the whole
109  level must be performed on the face-centered variables prior to
110  the final difference update. Examples include incompressible
111  flow and MHD, in which it is necessary to compute the projection
112  of a face-centered vector field on its divergence-free part. To
113  complete the differencing, it is necessary to call the member
114  function computeUpdate().
115  */
116  void computeWHalf(/// primitive variables extrapolated to cell faces and a half time step
117  LayoutData<FluxBox>& a_WHalf,
118  /// conserved variables on current grids
120  /// source term on current grid
121  const LevelData<FArrayBox>& a_S,
122  /// 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
123  const LevelData<FArrayBox>& a_UCoarseOld,
124  /// time of last update at coarser level
125  const Real& a_TCoarseOld,
126  /// 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
127  const LevelData<FArrayBox>& a_UCoarseNew,
128  /// time of next update at coarser level
129  const Real& a_TCoarseNew,
130  /// current time
131  const Real& a_time,
132  /// time step
133  const Real& a_dt);
134 
135  /// Compute the increment in the conserved variables from face variables.
136  /**
137  Compute dU = dt*dU/dt, the change in the conserved variables over
138  the time step. Function returns the maximum stable time step.
139  */
140  Real computeUpdate(/// change in conserved variables over the time step
141  LevelData<FArrayBox>& a_dU,
142  /// flux register with next finer level
143  LevelFluxRegister& a_finerFluxRegister,
144  /// flux register with next coarser level
145  LevelFluxRegister& a_coarserFluxRegister,
146  /// conserved variables at beginning of time step
147  const LevelData<FArrayBox>& a_U,
148  /// primitive variables extrapolated to cell faces and a half time step
149  const LayoutData<FluxBox>& a_WHalf,
150  /// current time
151  const Real& a_time,
152  /// time step
153  const Real& a_dt);
154 
155  /// Return maximum wave speed
156  /**
157  */
159 
160  /// Get the GodunovPhysics pointer from the PatchGodunov member
161  /**
162  Returns the pointer to the GodunovPhysics object that is
163  used in the PatchGodunov class.
164  */
166 
168 
169  /// Set whether to use high-order limiter.
170  void highOrderLimiter(bool a_highOrderLimiter);
171 
172 protected:
173  // Box layout for this level
175 
176  // Patch integrator
178 
179  ///just for global calls
181  // Number of ghost cells need locally for this level
183 
184  // Exchange copier
186 
187  // Temporary storage space for conserved variables
189 
190  // Interpolator for filling in ghost cells from the next coarser level
192 
193  // Grid spacing
195 
196  // Problem domain - index space for this level
198 
199  // Refinement ratio between this level and the next coarser
201 
202  // Number of conserved variables
204 
205  // Number of conservative fluxes and other face centered quantities
207 
208  // Flags for the existence of coarser and finer levels, respectively
211 
212  // Order of the normal predictor (1 -> PLM, 2-> PPM)
214 
215  // Use 4th order slope computations (otherwise, use 2nd order)
217 
218  // Do slope limiting in the primitive or characteristic variables, respect.
221 
222  // Do slope flattening - MUST BE USING 4th order slopes
224 
225  // Apply artificial viscosity of a set value
228 
229  // Has this object been defined
231 
232 
233 private:
234 
235  // Disallowed for all the usual reasons
236  void operator=(const LevelGodunov&);
237  LevelGodunov(const LevelGodunov&);
238 };
239 
240 #include "NamespaceFooter.H"
241 #endif
int m_refineCoarse
Definition: LevelGodunov.H:200
void define(const DisjointBoxLayout &a_thisDisjointBoxLayout, const DisjointBoxLayout &a_coarserDisjointBoxLayout, const ProblemDomain &a_domain, const int &a_refineCoarse, const Real &a_dx, const GodunovPhysics *const a_godunovFactory, const int &a_normalPredOrder, const bool &a_useFourthOrderSlopes, const bool &a_usePrimLimiting, const bool &a_useCharLimiting, const bool &a_useFlattening, const bool &a_useArtificialViscosity, const Real &a_artificialViscosity, const bool &a_hasCoarser, const bool &a_hasFiner)
Actual constructor.
PiecewiseLinearFillPatch m_patcher
Definition: LevelGodunov.H:191
#define CH_SPACEDIM
Definition: SPACE.H:51
Real computeUpdate(LevelData< FArrayBox > &a_dU, LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, const LevelData< FArrayBox > &a_U, const LayoutData< FluxBox > &a_WHalf, const Real &a_time, const Real &a_dt)
Compute the increment in the conserved variables from face variables.
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
~LevelGodunov()
Destructor.
Real m_dx
Definition: LevelGodunov.H:194
Fills ghost cells by linear interpolation in space and time.
Definition: PiecewiseLinearFillPatch.H:128
GodunovPhysics * getGodunovPhysicsPtr()
Get the GodunovPhysics pointer from the PatchGodunov member.
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
int m_numCons
Definition: LevelGodunov.H:203
bool m_usePrimLimiting
Definition: LevelGodunov.H:219
void operator=(const LevelGodunov &)
LevelData< FArrayBox > m_U
Definition: LevelGodunov.H:188
int m_numGhost
Definition: LevelGodunov.H:182
LevelGodunov()
Default constructor.
double Real
Definition: REAL.H:33
int m_numFluxes
Definition: LevelGodunov.H:206
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
const GodunovPhysics * getGodunovPhysicsPtrConst() const
bool m_useFourthOrderSlopes
Definition: LevelGodunov.H:216
bool m_isDefined
Definition: LevelGodunov.H:230
bool m_hasFiner
Definition: LevelGodunov.H:210
Definition: GodunovPhysics.H:40
LevelFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: LevelFluxRegister.H:29
bool m_useArtificialViscosity
Definition: LevelGodunov.H:226
void highOrderLimiter(bool a_highOrderLimiter)
Set whether to use high-order limiter.
int m_normalPredOrder
Definition: LevelGodunov.H:213
bool m_useCharLimiting
Definition: LevelGodunov.H:220
void computeWHalf(LayoutData< FluxBox > &a_WHalf, LevelData< FArrayBox > &a_U, 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)
Compute the time-centered values of the primitive variables on cell faces.
LayoutData< PatchGodunov > m_patchGodunov
Definition: LevelGodunov.H:177
DisjointBoxLayout m_grids
Definition: LevelGodunov.H:174
Real m_artificialViscosity
Definition: LevelGodunov.H:227
Copier m_exchangeCopier
Definition: LevelGodunov.H:185
Real step(LevelData< FArrayBox > &a_U, LevelData< FArrayBox > a_flux[CH_SPACEDIM], LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, 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)
Take one timestep for this grid level.
Definition: PatchGodunov.H:33
ProblemDomain m_domain
Definition: LevelGodunov.H:197
Real getMaxWaveSpeed(const LevelData< FArrayBox > &a_U)
Return maximum wave speed.
Level Godunov - really a hyperbolic level integrator.
Definition: LevelGodunov.H:29
bool m_hasCoarser
Definition: LevelGodunov.H:209
PatchGodunov m_patchGodunovNoBox
just for global calls
Definition: LevelGodunov.H:180
bool m_useFlattening
Definition: LevelGodunov.H:223