00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBAMRGODUNOV_H_
00012 #define _EBAMRGODUNOV_H_
00013
00014 #include "AMRLevel.H"
00015 #include "EBCellFAB.H"
00016 #include "BaseIVFAB.H"
00017 #include "LevelData.H"
00018 #include "EBLevelRedist.H"
00019 #include "EBCoarToCoarRedist.H"
00020 #include "EBCoarToFineRedist.H"
00021 #include "EBFineToCoarRedist.H"
00022 #include "EBCoarseAverage.H"
00023 #include "EBPWLFineInterp.H"
00024 #include "EBFluxRegister.H"
00025 #include "EBLevelGodunov.H"
00026 #include "Box.H"
00027 #include "IntVectSet.H"
00028 #include "Vector.H"
00029 #include "DisjointBoxLayout.H"
00030 #include "NamespaceHeader.H"
00031
00033 typedef int(*LoadBalanceFunc)(Vector<int>& a_procs,
00034 const Vector<Box>& a_boxes,
00035 const ProblemDomain& a_domain,
00036 bool a_verbose);
00037
00038
00040
00042 class EBAMRGodunov : public AMRLevel
00043 {
00044 public:
00045
00046 EBAMRGodunov();
00047
00048 virtual ~EBAMRGodunov();
00049
00050 void sumConserved(Real& a_sumcons,
00051 const int& a_ivar) const;
00052
00053 virtual void define(AMRLevel* a_coarser_level_ptr,
00054 const Box& a_problem_domain,
00055 int a_level,
00056 int a_ref_ratio);
00057
00058 virtual void define(AMRLevel* a_coarser_level_ptr,
00059 const ProblemDomain& a_problem_domain,
00060 int a_level,
00061 int a_ref_ratio);
00062
00064 virtual Real advance();
00065
00067 virtual void postTimeStep();
00068
00070
00077 virtual void syncWithFineLevel();
00078
00080 virtual void tagCells(IntVectSet& a_tags) ;
00081
00083 virtual void tagCellsInit(IntVectSet& a_tags) ;
00084
00086 virtual void regrid(const Vector<Box>& a_new_grids);
00087
00089 virtual void initialGrid(const Vector<Box>& a_new_grids);
00090
00092 virtual void initialData();
00093
00095 virtual void postInitialize();
00096
00098 virtual void patchGodunov(const EBPatchGodunovFactory* const a_ebpatchGodunovFactory);
00099
00100 #ifdef CH_USE_HDF5
00102 virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
00103
00105 virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
00106
00108 virtual void readCheckpointHeader(HDF5Handle& a_handle);
00109
00111 virtual void readCheckpointLevel(HDF5Handle& a_handle);
00112
00114 virtual void writePlotHeader(HDF5Handle& a_handle) const;
00115
00116 void writePlotHeaderOld(HDF5Handle& a_handle) const;
00117
00119 virtual void writePlotLevel(HDF5Handle& a_handle) const;
00120
00121 void writePlotLevelOld(HDF5Handle& a_handle) const;
00122
00123 #endif
00124
00126 virtual Real getDt() const;
00127
00129 virtual Real computeDt();
00130
00132 virtual Real computeInitialDt();
00133
00135 virtual void CFL(Real a_cfl);
00136
00138 virtual void doSmushing(bool a_doSmushing);
00139
00141 virtual void doRZCoords(bool a_doRZCoords);
00142
00144 virtual void hasSourceTerm(bool a_hasSourceTerm);
00145
00147 virtual void redistRadius(int a_redistRad);
00148
00150 virtual void domainLength(RealVect a_domainLength);
00151
00153 virtual void refinementThreshold(Real a_refine_thresh);
00154
00156 virtual void tagBufferSize(int a_tag_buffer_size);
00157
00158 virtual void useMassRedistribution(bool a_useMassRedist);
00159
00160 virtual void levelSetup();
00161
00162 const EBISLayout& getEBISLayout() const;
00163 virtual void fillConsAndPrim(LevelData<EBCellFAB>& a_data) const;
00164
00165 void tagAll(bool a_tagAll);
00166
00167
00168 LevelData<EBCellFAB>& getStateOld();
00169
00170
00171 LevelData<EBCellFAB>& getStateNew();
00172
00173 static int s_NewPlotFile;
00174
00175 static void setLoadBalance(LoadBalanceFunc a_func)
00176 {
00177 s_loadBalance = a_func;
00178 s_isLoadBalanceSet = true;
00179 }
00180 protected:
00181
00182 static LoadBalanceFunc s_loadBalance;
00183 static bool s_isLoadBalanceSet;
00184 bool m_tagAll;
00185 bool m_useMassRedist;
00186 Box m_domainBox;
00187 Real calculateMass() const;
00188
00189 EBAMRGodunov* getCoarserLevel() const;
00190 EBAMRGodunov* getFinerLevel() const;
00191
00192 DisjointBoxLayout m_grids;
00193 EBISLayout m_ebisl;
00194
00195
00196 LevelData<EBCellFAB> m_stateOld;
00197
00198
00199 LevelData<EBCellFAB> m_stateNew;
00200
00201
00202 int m_nComp;
00203
00204 int m_nGhost ;
00205
00206 Vector<string> m_stateNames;
00207 Vector<string> m_primNames;
00208
00209
00210 RealVect m_dx;
00211
00212
00213 RealVect m_domainLength;
00214
00215
00216 Real m_cfl;
00217
00218
00219 Real m_dtNew;
00220
00221
00222 EBCoarseAverage m_ebCoarseAverage;
00223
00224
00225 EBPWLFineInterp m_ebFineInterp;
00226
00227
00228 EBLevelGodunov m_ebLevelGodunov;
00229
00230
00231 EBFluxRegister m_ebFluxRegister;
00232
00233
00234 EBPatchGodunov* m_ebPatchGodunov;
00235
00236
00237 const EBPatchGodunovFactory* m_ebPatchGodunovFactory;
00238
00239
00240 Real m_refineThresh;
00241
00242
00243 LevelData<BaseIVFAB<Real> > m_massDiff;
00244 LayoutData<IntVectSet> m_sets;
00245
00246 RedistStencil m_redStencil;
00247 EBCoarToFineRedist m_ebCoarToFineRedist;
00248 EBCoarToCoarRedist m_ebCoarToCoarRedist;
00249 EBFineToCoarRedist m_ebFineToCoarRedist;
00250
00251
00252 int m_tagBufferSize;
00253 int m_redistRad;
00254
00255 bool m_doRZCoords;
00256 bool m_hasSourceTerm;
00257 bool m_doSmushing;
00258 bool m_hasCoarser;
00259 bool m_hasFiner;
00260 bool m_isDefined;
00261
00262
00263 private:
00264
00265 void operator=(const EBAMRGodunov& a_input)
00266 {
00267 MayDay::Error("invalid operator");
00268 }
00269 EBAMRGodunov(const EBAMRGodunov& a_input)
00270 {
00271 MayDay::Error("invalid operator");
00272 }
00273
00274 };
00275
00276 #include "NamespaceFooter.H"
00277 #endif