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
00032
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
00039
00040
00041
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
00063
00064 virtual Real advance();
00065
00066
00067 virtual void postTimeStep();
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 virtual void syncWithFineLevel();
00078
00079 void dumpDebug();
00080
00081
00082 virtual void tagCells(IntVectSet& a_tags) ;
00083
00084
00085 virtual void tagCellsInit(IntVectSet& a_tags) ;
00086
00087
00088 virtual void regrid(const Vector<Box>& a_new_grids);
00089
00090
00091 virtual void initialGrid(const Vector<Box>& a_new_grids);
00092
00093
00094 virtual void initialData();
00095
00096
00097 virtual void postInitialize();
00098
00099
00100 virtual void patchGodunov(const EBPatchGodunovFactory* const a_ebpatchGodunovFactory);
00101 void dumpDebug(const string& a_debstring);
00102 #ifdef CH_USE_HDF5
00103
00104 virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
00105
00106
00107 virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
00108
00109
00110 virtual void readCheckpointHeader(HDF5Handle& a_handle);
00111
00112
00113 virtual void readCheckpointLevel(HDF5Handle& a_handle);
00114
00115
00116 virtual void writePlotHeader(HDF5Handle& a_handle) const;
00117
00118 void writePlotHeaderOld(HDF5Handle& a_handle) const;
00119
00120
00121 virtual void writePlotLevel(HDF5Handle& a_handle) const;
00122
00123 void writePlotLevelOld(HDF5Handle& a_handle) const;
00124
00125 #endif
00126
00127
00128 virtual Real getDt() const;
00129
00130
00131 virtual Real computeDt();
00132
00133
00134 virtual Real computeInitialDt();
00135
00136
00137 virtual void CFL(Real a_cfl);
00138
00139
00140 virtual void doSmushing(bool a_doSmushing);
00141
00142
00143 virtual void doRZCoords(bool a_doRZCoords);
00144
00145
00146 virtual void hasSourceTerm(bool a_hasSourceTerm);
00147
00148
00149 virtual void redistRadius(int a_redistRad);
00150
00151
00152 virtual void domainLength(RealVect a_domainLength);
00153
00154
00155 virtual void refinementThreshold(Real a_refine_thresh);
00156
00157
00158 virtual void tagBufferSize(int a_tag_buffer_size);
00159
00160 virtual void useMassRedistribution(bool a_useMassRedist);
00161
00162 virtual void levelSetup();
00163
00164 const EBISLayout& getEBISLayout() const;
00165 virtual void fillConsAndPrim(LevelData<EBCellFAB>& a_data) const;
00166
00167 void tagAll(bool a_tagAll);
00168
00169
00170 LevelData<EBCellFAB>& getStateOld();
00171
00172
00173 LevelData<EBCellFAB>& getStateNew();
00174
00175 static int s_NewPlotFile;
00176
00177 static void setLoadBalance(LoadBalanceFunc a_func)
00178 {
00179 s_loadBalance = a_func;
00180 s_isLoadBalanceSet = true;
00181 }
00182 protected:
00183
00184 static LoadBalanceFunc s_loadBalance;
00185 static bool s_isLoadBalanceSet;
00186 bool m_tagAll;
00187 bool m_useMassRedist;
00188 Box m_domainBox;
00189 Real calculateMass() const;
00190
00191 EBAMRGodunov* getCoarserLevel() const;
00192 EBAMRGodunov* getFinerLevel() const;
00193
00194 DisjointBoxLayout m_grids;
00195 EBISLayout m_ebisl;
00196
00197
00198 LevelData<EBCellFAB> m_stateOld;
00199
00200
00201 LevelData<EBCellFAB> m_stateNew;
00202
00203
00204 int m_nComp;
00205
00206 int m_nGhost ;
00207
00208 Vector<string> m_stateNames;
00209 Vector<string> m_primNames;
00210
00211
00212 RealVect m_origin;
00213 RealVect m_dx;
00214 RealVect m_aspect;
00215
00216
00217 RealVect m_domainLength;
00218
00219
00220 Real m_cfl;
00221
00222
00223 Real m_dtNew;
00224
00225
00226 EBCoarseAverage m_ebCoarseAverage;
00227
00228
00229 EBPWLFineInterp m_ebFineInterp;
00230
00231
00232 EBLevelGodunov m_ebLevelGodunov;
00233
00234
00235 EBFluxRegister m_ebFluxRegister;
00236
00237
00238 EBPatchGodunov* m_ebPatchGodunov;
00239
00240
00241 const EBPatchGodunovFactory* m_ebPatchGodunovFactory;
00242
00243
00244 Real m_refineThresh;
00245
00246
00247 LevelData<BaseIVFAB<Real> > m_massDiff;
00248 LayoutData<IntVectSet> m_sets;
00249
00250 RedistStencil m_redStencil;
00251 EBCoarToFineRedist m_ebCoarToFineRedist;
00252 EBCoarToCoarRedist m_ebCoarToCoarRedist;
00253 EBFineToCoarRedist m_ebFineToCoarRedist;
00254
00255
00256 int m_tagBufferSize;
00257 int m_redistRad;
00258
00259 bool m_doRZCoords;
00260 bool m_hasSourceTerm;
00261 bool m_doSmushing;
00262 bool m_hasCoarser;
00263 bool m_hasFiner;
00264 bool m_isDefined;
00265
00266
00267 private:
00268
00269 void operator=(const EBAMRGodunov& a_input)
00270 {
00271 MayDay::Error("invalid operator");
00272 }
00273 EBAMRGodunov(const EBAMRGodunov& a_input)
00274 {
00275 MayDay::Error("invalid operator");
00276 }
00277
00278 };
00279
00280 #include "NamespaceFooter.H"
00281 #endif