Chombo + EB  3.2
EBAMRGodunov.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 _EBAMRGODUNOV_H_
12 #define _EBAMRGODUNOV_H_
13 
14 #include "AMRLevel.H"
15 #include "EBCellFAB.H"
16 #include "BaseIVFAB.H"
17 #include "LevelData.H"
18 #include "EBLevelRedist.H"
19 #include "EBCoarToCoarRedist.H"
20 #include "EBCoarToFineRedist.H"
21 #include "EBFineToCoarRedist.H"
22 #include "EBCoarseAverage.H"
23 #include "EBPWLFineInterp.H"
24 #include "EBFluxRegister.H"
25 #include "EBLevelGodunov.H"
26 #include "Box.H"
27 #include "IntVectSet.H"
28 #include "Vector.H"
29 #include "DisjointBoxLayout.H"
30 #include "NamespaceHeader.H"
31 
32 ///interface for load balancing
33 typedef int(*LoadBalanceFunc)(Vector<int>& a_procs,
34  const Vector<Box>& a_boxes,
35  const ProblemDomain& a_domain,
36  bool a_verbose);
37 
38 
39 ///
40 /**
41  */
42 class EBAMRGodunov : public AMRLevel
43 {
44 public:
45 
46  EBAMRGodunov();
47 
48  virtual ~EBAMRGodunov();
49 
50  void sumConserved(Real& a_sumcons,
51  const int& a_ivar) const;
52 
53  virtual void define(AMRLevel* a_coarser_level_ptr,
54  const Box& a_problem_domain,
55  int a_level,
56  int a_ref_ratio);
57 
58  virtual void define(AMRLevel* a_coarser_level_ptr,
59  const ProblemDomain& a_problem_domain,
60  int a_level,
61  int a_ref_ratio);
62 
63  /// advance by one timestep
64  virtual Real advance();
65 
66  /// things to do after a timestep
67  virtual void postTimeStep();
68 
69  /// setup fine->coarse stuff
70  /**
71  stuff that needs to be setup from the finer
72  level. A bunch of objects depend upon the layouts
73  from both levels and the finer level changes more
74  often from regrid so this needs to be called from the finer
75  level
76  */
77  virtual void syncWithFineLevel();
78 
79  void dumpDebug();
80 
81  /// create tags
82  virtual void tagCells(IntVectSet& a_tags) ;
83 
84  /// create tags at initialization
85  virtual void tagCellsInit(IntVectSet& a_tags) ;
86 
87  /// regrid
88  virtual void regrid(const Vector<Box>& a_new_grids);
89 
90  /// initialize grids
91  virtual void initialGrid(const Vector<Box>& a_new_grids);
92 
93  /// initialize data
94  virtual void initialData();
95 
96  /// things to do after initialization
97  virtual void postInitialize();
98 
99  /// object for physics integration
100  virtual void patchGodunov(const EBPatchGodunovFactory* const a_ebpatchGodunovFactory);
101  void dumpDebug(const string& a_debstring);
102 #ifdef CH_USE_HDF5
103  /// write checkpoint header
104  virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
105 
106  /// write checkpoint data for this level
107  virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
108 
109  /// read checkpoint header
110  virtual void readCheckpointHeader(HDF5Handle& a_handle);
111 
112  /// read checkpoint data for this level
113  virtual void readCheckpointLevel(HDF5Handle& a_handle);
114 
115  /// write plotfile header
116  virtual void writePlotHeader(HDF5Handle& a_handle) const;
117 
118  void writePlotHeaderOld(HDF5Handle& a_handle) const;
119 
120  /// write plot file data for this level
121  virtual void writePlotLevel(HDF5Handle& a_handle) const;
122 
123  void writePlotLevelOld(HDF5Handle& a_handle) const;
124 
125 #endif
126 
127  ///
128  virtual Real getDt() const;
129 
130  /// compute dt
131  virtual Real computeDt();
132 
133  /// compute dt with initial data
134  virtual Real computeInitialDt();
135 
136  /// CFL
137  virtual void CFL(Real a_cfl);
138 
139  ///
140  virtual void doSmushing(bool a_doSmushing);
141 
142  ///
143  virtual void doRZCoords(bool a_doRZCoords);
144 
145  ///
146  virtual void hasSourceTerm(bool a_hasSourceTerm);
147 
148  ///redistribution radius
149  virtual void redistRadius(int a_redistRad);
150 
151  /// longest length of the domain in real space
152  virtual void domainLength(RealVect a_domainLength);
153 
154  /// refinement threshold
155  virtual void refinementThreshold(Real a_refine_thresh);
156 
157  /// tag buffer size
158  virtual void tagBufferSize(int a_tag_buffer_size);
159 
160  virtual void useMassRedistribution(bool a_useMassRedist);
161 
162  virtual void levelSetup();
163 
164  const EBISLayout& getEBISLayout() const;
165  virtual void fillConsAndPrim(LevelData<EBCellFAB>& a_data) const;
166 
167  void tagAll(bool a_tagAll);
168 
169  // state vector at old time
171 
172  // state vector at new time
174 
175  static int s_NewPlotFile;
176 
177  static void setLoadBalance(LoadBalanceFunc a_func)
178  {
179  s_loadBalance = a_func;
180  s_isLoadBalanceSet = true;
181  }
182 protected:
183 
185  static bool s_isLoadBalanceSet;
186  bool m_tagAll;
189  Real calculateMass() const;
190 
191  EBAMRGodunov* getCoarserLevel() const;
192  EBAMRGodunov* getFinerLevel() const;
193 
196 
197  // state vector at old time
199 
200  // state vector at new time
202 
203  // number of components of m_state
204  int m_nComp;
205 
206  int m_nGhost ;
207  // names of components
210 
211  // grid spacing
215 
216  // domain length
218 
219  // cfl number
221 
222  // new time step
224 
225  // averaging from coarse to fine level
227 
228  // interpolation from fine to coarse level
230 
231  // level solver
233 
234  // flux register
236 
237  // patch integrator
239 
240  // patch integrator
242 
243  // refinement threshold for gradient
245 
246  //redistribution mass
249 
254 
255  // tag buffer size
258 
265 
266 
267 private:
268  //disallowed for all the usual reasons
269  void operator=(const EBAMRGodunov& a_input)
270  {
271  MayDay::Error("invalid operator");
272  }
273  EBAMRGodunov(const EBAMRGodunov& a_input)
274  {
275  MayDay::Error("invalid operator");
276  }
277 
278 };
279 
280 #include "NamespaceFooter.H"
281 #endif
bool m_useMassRedist
Definition: EBAMRGodunov.H:187
LevelData< EBCellFAB > m_stateNew
Definition: EBAMRGodunov.H:201
virtual void tagBufferSize(int a_tag_buffer_size)
tag buffer size
virtual Real computeInitialDt()
compute dt with initial data
virtual void tagCellsInit(IntVectSet &a_tags)
create tags at initialization
virtual void domainLength(RealVect a_domainLength)
longest length of the domain in real space
virtual void tagCells(IntVectSet &a_tags)
create tags
Definition: EBPatchGodunovFactory.H:20
replaces coarse level data with an average of fine level data.
Definition: EBCoarseAverage.H:38
static void setLoadBalance(LoadBalanceFunc a_func)
Definition: EBAMRGodunov.H:177
virtual void writePlotLevel(HDF5Handle &a_handle) const
write plot file data for this level
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
virtual void readCheckpointHeader(HDF5Handle &a_handle)
read checkpoint header
int m_nComp
Definition: EBAMRGodunov.H:204
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual void doRZCoords(bool a_doRZCoords)
EBFineToCoarRedist m_ebFineToCoarRedist
Definition: EBAMRGodunov.H:253
bool m_hasSourceTerm
Definition: EBAMRGodunov.H:260
EBAMRGodunov * getFinerLevel() const
virtual void CFL(Real a_cfl)
CFL.
virtual void initialData()
initialize data
EBCoarToCoarRedist m_ebCoarToCoarRedist
Definition: EBAMRGodunov.H:252
bool m_tagAll
Definition: EBAMRGodunov.H:186
RealVect m_domainLength
Definition: EBAMRGodunov.H:217
Definition: EBAMRGodunov.H:42
EBISLayout m_ebisl
Definition: EBAMRGodunov.H:195
virtual void fillConsAndPrim(LevelData< EBCellFAB > &a_data) const
Abstract base class for time-dependent data at a level of refinement.
Definition: AMRLevel.H:47
virtual ~EBAMRGodunov()
virtual void useMassRedistribution(bool a_useMassRedist)
RedistStencil m_redStencil
Definition: EBAMRGodunov.H:250
void dumpDebug()
Coarse to fine redistribution class.
Definition: EBCoarToFineRedist.H:35
virtual void writeCheckpointHeader(HDF5Handle &a_handle) const
write checkpoint header
virtual void postTimeStep()
things to do after a timestep
void writePlotHeaderOld(HDF5Handle &a_handle) const
bool m_hasFiner
Definition: EBAMRGodunov.H:263
bool m_isDefined
Definition: EBAMRGodunov.H:264
int m_nGhost
Definition: EBAMRGodunov.H:206
virtual void doSmushing(bool a_doSmushing)
Definition: EBPatchGodunov.H:31
virtual void patchGodunov(const EBPatchGodunovFactory *const a_ebpatchGodunovFactory)
object for physics integration
EBPatchGodunov * m_ebPatchGodunov
Definition: EBAMRGodunov.H:238
EBLevelGodunov m_ebLevelGodunov
Definition: EBAMRGodunov.H:232
RealVect m_dx
Definition: EBAMRGodunov.H:213
Real m_dtNew
Definition: EBAMRGodunov.H:223
virtual void syncWithFineLevel()
setup fine->coarse stuff
void sumConserved(Real &a_sumcons, const int &a_ivar) const
LevelData< EBCellFAB > m_stateOld
Definition: EBAMRGodunov.H:198
int m_tagBufferSize
Definition: EBAMRGodunov.H:256
virtual void define(AMRLevel *a_coarser_level_ptr, const Box &a_problem_domain, int a_level, int a_ref_ratio)
virtual void postInitialize()
things to do after initialization
EBCoarToFineRedist m_ebCoarToFineRedist
Definition: EBAMRGodunov.H:251
virtual void readCheckpointLevel(HDF5Handle &a_handle)
read checkpoint data for this level
Vector< string > m_primNames
Definition: EBAMRGodunov.H:209
Real calculateMass() const
virtual Real getDt() const
void operator=(const EBAMRGodunov &a_input)
Definition: EBAMRGodunov.H:269
bool m_doSmushing
Definition: EBAMRGodunov.H:261
double Real
Definition: REAL.H:33
Definition: EBCoarToCoarRedist.H:36
void writePlotLevelOld(HDF5Handle &a_handle) const
Definition: EBFineToCoarRedist.H:35
static int s_NewPlotFile
Definition: EBAMRGodunov.H:175
virtual Real advance()
advance by one timestep
static LoadBalanceFunc s_loadBalance
Definition: EBAMRGodunov.H:184
Real m_refineThresh
Definition: EBAMRGodunov.H:244
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
int(* LoadBalanceFunc)(Vector< int > &a_procs, const Vector< Box > &a_boxes, const ProblemDomain &a_domain, bool a_verbose)
interface for load balancing
Definition: EBAMRGodunov.H:33
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.
virtual void writeCheckpointLevel(HDF5Handle &a_handle) const
write checkpoint data for this level
LayoutData< IntVectSet > m_sets
Definition: EBAMRGodunov.H:248
Definition: EBPWLFineInterp.H:31
virtual void levelSetup()
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Level Godunov.
Definition: EBLevelGodunov.H:30
Real m_cfl
Definition: EBAMRGodunov.H:220
const EBPatchGodunovFactory * m_ebPatchGodunovFactory
Definition: EBAMRGodunov.H:241
stencil for mass redistribution
Definition: RedistStencil.H:38
EBAMRGodunov(const EBAMRGodunov &a_input)
Definition: EBAMRGodunov.H:273
static bool s_isLoadBalanceSet
Definition: EBAMRGodunov.H:185
RealVect m_aspect
Definition: EBAMRGodunov.H:214
EBPWLFineInterp m_ebFineInterp
Definition: EBAMRGodunov.H:229
EBCoarseAverage m_ebCoarseAverage
Definition: EBAMRGodunov.H:226
virtual void redistRadius(int a_redistRad)
redistribution radius
Handle to a particular group in an HDF file.
Definition: CH_HDF5.H:294
LevelData< BaseIVFAB< Real > > m_massDiff
Definition: EBAMRGodunov.H:247
virtual void writePlotHeader(HDF5Handle &a_handle) const
write plotfile header
virtual void initialGrid(const Vector< Box > &a_new_grids)
initialize grids
bool m_doRZCoords
Definition: EBAMRGodunov.H:259
DisjointBoxLayout m_grids
Definition: EBAMRGodunov.H:194
int m_redistRad
Definition: EBAMRGodunov.H:257
Box m_domainBox
Definition: EBAMRGodunov.H:188
LevelData< EBCellFAB > & getStateNew()
virtual Real computeDt()
compute dt
Vector< string > m_stateNames
Definition: EBAMRGodunov.H:208
void tagAll(bool a_tagAll)
Definition: EBISLayout.H:39
LevelData< EBCellFAB > & getStateOld()
virtual void hasSourceTerm(bool a_hasSourceTerm)
RealVect m_origin
Definition: EBAMRGodunov.H:212
EBAMRGodunov * getCoarserLevel() const
EBFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: EBFluxRegister.H:37
virtual void regrid(const Vector< Box > &a_new_grids)
regrid
EBFluxRegister m_ebFluxRegister
Definition: EBAMRGodunov.H:235
const EBISLayout & getEBISLayout() const
virtual void refinementThreshold(Real a_refine_thresh)
refinement threshold
bool m_hasCoarser
Definition: EBAMRGodunov.H:262