Chombo + EB  3.0
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  // Number of ghost cells need locally for this level
181 
182  // Exchange copier
184 
185  // Temporary storage space for conserved variables
187 
188  // Interpolator for filling in ghost cells from the next coarser level
190 
191  // Grid spacing
193 
194  // Problem domain - index space for this level
196 
197  // Refinement ratio between this level and the next coarser
199 
200  // Number of conserved variables
202 
203  // Number of conservative fluxes and other face centered quantities
205 
206  // Flags for the existence of coarser and finer levels, respectively
209 
210  // Order of the normal predictor (1 -> PLM, 2-> PPM)
212 
213  // Use 4th order slope computations (otherwise, use 2nd order)
215 
216  // Do slope limiting in the primitive or characteristic variables, respect.
219 
220  // Do slope flattening - MUST BE USING 4th order slopes
222 
223  // Apply artificial viscosity of a set value
226 
227  // Has this object been defined
229 
230 
231 private:
232 
233  // Disallowed for all the usual reasons
234  void operator=(const LevelGodunov&);
235  LevelGodunov(const LevelGodunov&);
236 };
237 
238 #include "NamespaceFooter.H"
239 #endif
int m_refineCoarse
Definition: LevelGodunov.H:198
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:189
#define CH_SPACEDIM
Definition: SPACE.H:52
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:130
~LevelGodunov()
Destructor.
Real m_dx
Definition: LevelGodunov.H:192
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:137
int m_numCons
Definition: LevelGodunov.H:201
bool m_usePrimLimiting
Definition: LevelGodunov.H:217
void operator=(const LevelGodunov &)
PatchGodunov m_patchGodunov
Definition: LevelGodunov.H:177
LevelData< FArrayBox > m_U
Definition: LevelGodunov.H:186
int m_numGhost
Definition: LevelGodunov.H:180
LevelGodunov()
Default constructor.
double Real
Definition: REAL.H:33
int m_numFluxes
Definition: LevelGodunov.H:204
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
const GodunovPhysics * getGodunovPhysicsPtrConst() const
bool m_useFourthOrderSlopes
Definition: LevelGodunov.H:214
bool m_isDefined
Definition: LevelGodunov.H:228
bool m_hasFiner
Definition: LevelGodunov.H:208
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:224
void highOrderLimiter(bool a_highOrderLimiter)
Set whether to use high-order limiter.
int m_normalPredOrder
Definition: LevelGodunov.H:211
bool m_useCharLimiting
Definition: LevelGodunov.H:218
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.
DisjointBoxLayout m_grids
Definition: LevelGodunov.H:174
Real m_artificialViscosity
Definition: LevelGodunov.H:225
Copier m_exchangeCopier
Definition: LevelGodunov.H:183
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:195
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:207
bool m_useFlattening
Definition: LevelGodunov.H:221