Chombo + EB  3.2
AMRLevelPolytropicGas.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 _AMRLEVELPOLYTROPICGAS_H_
12 #define _AMRLEVELPOLYTROPICGAS_H_
13 
14 #include "FArrayBox.H"
15 #include "LevelData.H"
16 #include "AMRLevel.H"
17 #include "CoarseAverage.H"
18 #include "FineInterp.H"
19 #include "LevelFluxRegister.H"
20 #include "Box.H"
21 #include "IntVectSet.H"
22 #include "Vector.H"
23 #include "DisjointBoxLayout.H"
24 
25 #include "LevelGodunov.H"
26 #include "PhysIBC.H"
27 
28 #include "NamespaceHeader.H"
29 
30 /// AMR Godunov
31 /**
32  */
34 {
35 public:
36  /// Constructor
37  /**
38  */
40 
41  /// Destructor
42  /**
43  */
44  virtual ~AMRLevelPolytropicGas();
45 
46  /// Define the parameters the object needs
47  /**
48  */
49  void defineParams(/// CFL number
50  const Real& a_cfl,
51  /// physical dimension of the longest side of the domain
52  const Real& a_domainLength,
53  /// verbosity level
54  const int& a_verbosity,
55  /// undivided gradient size over which a cell will be tagged for refinement
56  const Real& a_refineThresh,
57  /// number of buffer cells around each tagged cell that will also be tagged
58  const int& a_tagBufferSize,
59  /// CFL number at beginning of calculation
60  const Real& a_initialDtMultiplier,
61  /// physics class
62  const GodunovPhysics* const a_godunovPhysics,
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 to apply source term
78  const bool& a_useSourceTerm,
79  /// scaling of source term
80  const Real& a_sourceTermScaling,
81  /// whether to apply 4th-order limiter
82  const bool& a_highOrderLimiter);
83 
84  /// This instance should never get called - historical
85  /**
86  */
87  virtual void define(AMRLevel* a_coarserLevelPtr,
88  const Box& a_problemDomain,
89  int a_level,
90  int a_refRatio);
91 
92  /// Define new AMRLevelPolytropicGas
93  /**
94  */
95  virtual void define(AMRLevel* a_coarserLevelPtr,
96  const ProblemDomain& a_problemDomain,
97  int a_level,
98  int a_refRatio);
99 
100  /// Advance by one timestep
101  /**
102  */
103  virtual Real advance();
104 
105  /// Things to do after a timestep
106  /**
107  */
108  virtual void postTimeStep();
109 
110  /// Create tags for regridding
111  /**
112  */
113  virtual void tagCells(IntVectSet& a_tags);
114 
115  /// Create tags at initialization
116  /**
117  */
118  virtual void tagCellsInit(IntVectSet& a_tags);
119 
120  /// Set up data on this level after regridding
121  /**
122  */
123  virtual void regrid(const Vector<Box>& a_newGrids);
124 
125  /// Initialize grids
126  /**
127  */
128  virtual void initialGrid(const Vector<Box>& a_newGrids);
129 
130  /// Initialize data
131  /**
132  */
133  virtual void initialData();
134 
135  /// Things to do after initialization
136  /**
137  */
138  virtual void postInitialize();
139 
140 #ifdef CH_USE_HDF5
141  /// Write checkpoint header
142  /**
143  */
144  virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
145 
146  /// Write checkpoint data for this level
147  /**
148  */
149  virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
150 
151  /// Read checkpoint header
152  /**
153  */
154  virtual void readCheckpointHeader(HDF5Handle& a_handle);
155 
156  /// Read checkpoint data for this level
157  /**
158  */
159  virtual void readCheckpointLevel(HDF5Handle& a_handle);
160 
161  /// Write plotfile header
162  /**
163  */
164  virtual void writePlotHeader(HDF5Handle& a_handle) const;
165 
166  /// Write plotfile data for this level
167  /**
168  */
169  virtual void writePlotLevel(HDF5Handle& a_handle) const;
170 #endif
171 
172  /// Returns the dt computed earlier for this level
173  /**
174  */
175  virtual Real computeDt();
176 
177  /// Compute dt using initial data
178  /**
179  */
180  virtual Real computeInitialDt();
181 
182  ///
183  const LevelData<FArrayBox>& getStateNew() const;
184 
185  ///
186  const LevelData<FArrayBox>& getStateOld() const;
187 
188  ///
189  bool allDefined() const;
190 
191 
192 protected:
193  // Create a load-balanced DisjointBoxLayout from a collection of Boxes
194  DisjointBoxLayout loadBalance(const Vector<Box>& a_grids);
195 
196  // Setup menagerie of data structures
197  void levelSetup();
198 
199  // Get the next coarser level
201 
202  // Get the next finer level
204 
205  // Conserved state, U, at old and new time
207 
208  // CFL number
210 
211  // Grid spacing
213 
214  // Interpolation from coarse to fine level
216 
217  // Averaging from fine to coarse level
219 
220  // New time step
222 
223  // Number of conserved states
225 
226  // Names of conserved states
228 
229  // Number of ghost cells (in each direction)
231 
232  // Physical dimension of the longest side of the domain
234 
235  // Level integrator
237 
238  // Flux register
240 
241  // Pointer to the class defining the physics of the problem
243 
244  // Order of the normal predictor (1 -> PLM, 2-> PPM)
246 
247  // Use 4th order slope computations (otherwise, use 2nd order)
249 
250  // Do slope limiting in the primitive or characteristic variables, respect.
253 
254  // Do slope flattening - MUST BE USING 4th order slopes
256 
257  // Apply artificial viscosity of a set value
260 
261  // Supply a source term to the computation
264 
265  // Use a high-order limiter?
267 
268  // Refinement threshold for gradient
270 
271  // Tag buffer size
273 
274  // Flag coarser and finer levels
277 
278  // Grid layout for this level
280 
281  // True if all the parameters for this object are defined
283 
284 private:
285 
286  // Disallowed for all the usual reasons
287  void operator=(const AMRLevelPolytropicGas&);
289 };
290 
291 #include "NamespaceFooter.H"
292 
293 #endif
replaces coarse level data with an average of fine level data.
Definition: CoarseAverage.H:30
virtual void tagCellsInit(IntVectSet &a_tags)
Create tags at initialization.
bool m_hasFiner
Definition: AMRLevelPolytropicGas.H:276
virtual void writeCheckpointHeader(HDF5Handle &a_handle) const
Write checkpoint header.
AMR Godunov.
Definition: AMRLevelPolytropicGas.H:33
bool m_paramsDefined
Definition: AMRLevelPolytropicGas.H:282
bool m_useCharLimiting
Definition: AMRLevelPolytropicGas.H:252
virtual void regrid(const Vector< Box > &a_newGrids)
Set up data on this level after regridding.
virtual void define(AMRLevel *a_coarserLevelPtr, const Box &a_problemDomain, int a_level, int a_refRatio)
This instance should never get called - historical.
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
AMRLevelPolytropicGas * getCoarserLevel() const
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
int m_tagBufferSize
Definition: AMRLevelPolytropicGas.H:272
Real m_dtNew
Definition: AMRLevelPolytropicGas.H:221
bool m_useFlattening
Definition: AMRLevelPolytropicGas.H:255
bool m_hasCoarser
Definition: AMRLevelPolytropicGas.H:275
Real m_dx
Definition: AMRLevelPolytropicGas.H:212
bool m_useFourthOrderSlopes
Definition: AMRLevelPolytropicGas.H:248
const LevelData< FArrayBox > & getStateNew() const
bool allDefined() const
virtual void postTimeStep()
Things to do after a timestep.
LevelFluxRegister m_fluxRegister
Definition: AMRLevelPolytropicGas.H:239
Abstract base class for time-dependent data at a level of refinement.
Definition: AMRLevel.H:47
LevelData< FArrayBox > m_UNew
Definition: AMRLevelPolytropicGas.H:206
Real m_domainLength
Definition: AMRLevelPolytropicGas.H:233
virtual Real computeInitialDt()
Compute dt using initial data.
int m_numGhost
Definition: AMRLevelPolytropicGas.H:230
virtual void initialData()
Initialize data.
virtual void tagCells(IntVectSet &a_tags)
Create tags for regridding.
Vector< string > m_stateNames
Definition: AMRLevelPolytropicGas.H:227
replaces fine level data with interpolation of coarse level data.
Definition: FineInterp.H:32
virtual Real computeDt()
Returns the dt computed earlier for this level.
int m_numStates
Definition: AMRLevelPolytropicGas.H:224
void defineParams(const Real &a_cfl, const Real &a_domainLength, const int &a_verbosity, const Real &a_refineThresh, const int &a_tagBufferSize, const Real &a_initialDtMultiplier, const GodunovPhysics *const a_godunovPhysics, 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_useSourceTerm, const Real &a_sourceTermScaling, const bool &a_highOrderLimiter)
Define the parameters the object needs.
virtual void writePlotLevel(HDF5Handle &a_handle) const
Write plotfile data for this level.
void operator=(const AMRLevelPolytropicGas &)
Real m_refineThresh
Definition: AMRLevelPolytropicGas.H:269
double Real
Definition: REAL.H:33
virtual void readCheckpointLevel(HDF5Handle &a_handle)
Read checkpoint data for this level.
virtual void writeCheckpointLevel(HDF5Handle &a_handle) const
Write checkpoint data for this level.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
const LevelData< FArrayBox > & getStateOld() const
virtual Real advance()
Advance by one timestep.
DisjointBoxLayout loadBalance(const Vector< Box > &a_grids)
Definition: GodunovPhysics.H:40
LevelFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: LevelFluxRegister.H:29
virtual void writePlotHeader(HDF5Handle &a_handle) const
Write plotfile header.
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
virtual void postInitialize()
Things to do after initialization.
Handle to a particular group in an HDF file.
Definition: CH_HDF5.H:294
bool m_highOrderLimiter
Definition: AMRLevelPolytropicGas.H:266
virtual void initialGrid(const Vector< Box > &a_newGrids)
Initialize grids.
bool m_useArtificialViscosity
Definition: AMRLevelPolytropicGas.H:258
int m_normalPredOrder
Definition: AMRLevelPolytropicGas.H:245
virtual ~AMRLevelPolytropicGas()
Destructor.
CoarseAverage m_coarseAverage
Definition: AMRLevelPolytropicGas.H:218
LevelData< FArrayBox > m_UOld
Definition: AMRLevelPolytropicGas.H:206
bool m_useSourceTerm
Definition: AMRLevelPolytropicGas.H:262
bool m_usePrimLimiting
Definition: AMRLevelPolytropicGas.H:251
GodunovPhysics * m_gdnvPhysics
Definition: AMRLevelPolytropicGas.H:242
FineInterp m_fineInterp
Definition: AMRLevelPolytropicGas.H:215
LevelGodunov m_levelGodunov
Definition: AMRLevelPolytropicGas.H:236
Real m_cfl
Definition: AMRLevelPolytropicGas.H:209
Level Godunov - really a hyperbolic level integrator.
Definition: LevelGodunov.H:29
AMRLevelPolytropicGas()
Constructor.
Real m_sourceTermScaling
Definition: AMRLevelPolytropicGas.H:263
AMRLevelPolytropicGas * getFinerLevel() const
virtual void readCheckpointHeader(HDF5Handle &a_handle)
Read checkpoint header.
Real m_artificialViscosity
Definition: AMRLevelPolytropicGas.H:259
DisjointBoxLayout m_grids
Definition: AMRLevelPolytropicGas.H:279