00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _AMR_LEVEL_IDEAL_MHD_H_
00029 #define _AMR_LEVEL_IDEAL_MHD_H_
00030
00031 #include "FArrayBox.H"
00032 #include "LevelData.H"
00033 #include "AMRLevel.H"
00034 #include "CoarseAverage.H"
00035 #include "FineInterp.H"
00036 #include "LevelFluxRegister.H"
00037 #include "LevelSolver.H"
00038 #include "Poisson.H"
00039
00040 #include "LevelGodunov.H"
00041 #include "PhysIBC.H"
00042 #include "Box.H"
00043 #include "IntVectSet.H"
00044 #include "Vector.H"
00045 #include "DisjointBoxLayout.H"
00046
00048
00050 class AMRLevelIdealMHD : public AMRLevel
00051 {
00052 public:
00054
00056 AMRLevelIdealMHD();
00057
00059
00061 virtual ~AMRLevelIdealMHD();
00062
00064
00066 virtual void define(AMRLevel* a_coarserLevelPtr,
00067 const Box& a_problemDomain,
00068 int a_level,
00069 int a_refRatio);
00070
00072
00074 virtual void define(AMRLevel* a_coarserLevelPtr,
00075 const ProblemDomain& a_problemDomain,
00076 int a_level,
00077 int a_refRatio);
00078
00079
00081
00083 virtual Real advance();
00084
00086
00088 virtual void postTimeStep();
00089
00091
00093 virtual void tagCells(IntVectSet& a_tags);
00094
00096
00098 virtual void tagCellsInit(IntVectSet& a_tags);
00099
00101
00103 virtual void regrid(const Vector<Box>& a_newGrids);
00104
00106
00108 virtual void initialGrid(const Vector<Box>& a_newGrids);
00109
00111
00113 virtual void initialData();
00114
00116
00118 virtual void postInitialize();
00119
00121
00123 virtual void patchGodunov(const PatchGodunov* const a_patchGodunov);
00124
00126
00128 virtual void poissonOp(const PoissonOp* const a_poissonOp);
00129
00130 #ifdef HDF5
00131
00132
00134 virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
00135
00137
00139 virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
00140
00142
00144 virtual void readCheckpointHeader(HDF5Handle& a_handle);
00145
00147
00149 virtual void readCheckpointLevel(HDF5Handle& a_handle);
00150
00152
00154 virtual void writePlotHeader(HDF5Handle& a_handle) const;
00155
00157
00159 virtual void writePlotLevel(HDF5Handle& a_handle) const;
00160 #endif
00161
00163
00165 virtual Real computeDt();
00166
00168
00170 virtual Real computeInitialDt();
00171
00173
00175 virtual void CFL(Real a_cfl);
00176
00178
00180 virtual void domainLength(Real a_domainLength);
00181
00183
00185 virtual void refinementThreshold(Real a_refineThresh);
00186
00188
00190 void tagBufferSize(int a_tagBufferSize);
00191
00192
00193 void InterpolatePhiInTime(LevelData<FArrayBox> &a_Phi,
00194 const LevelData<FArrayBox> &a_PhiNew,
00195 const LevelData<FArrayBox> &a_PhiOld,
00196 const DisjointBoxLayout & a_grids,
00197 const Real& alpha);
00198
00199
00200 protected:
00201
00202 DisjointBoxLayout loadBalance(const Vector<Box>& a_grids);
00203
00204
00205 void levelSetup();
00206
00207
00208 AMRLevelIdealMHD* getCoarserLevel() const;
00209
00210
00211 AMRLevelIdealMHD* getFinerLevel() const;
00212
00213
00214 LevelData<FArrayBox> m_UOld,m_UNew;
00215
00216
00217 LevelData<FArrayBox> m_phiOld,m_phiNew;
00218
00219 LevelData<FArrayBox> m_rhs;
00220
00221 LevelData<FArrayBox> m_flux[CH_SPACEDIM];
00222
00223
00224
00225
00226 Real m_cfl;
00227
00228
00229 Real m_dx;
00230
00231
00232 FineInterp m_fineInterp;
00233
00234 FineInterp m_fineInterpPhi;
00235
00236
00237 CoarseAverage m_coarseAverage;
00238
00239
00240 CoarseAverage m_coarseAveragePhi;
00241
00242
00243 Real m_dtNew;
00244
00245
00246 int m_numStates;
00247
00248
00249 int m_numFluxes;
00250
00251
00252 Vector<string> m_stateNames;
00253
00254
00255 Vector<string> m_plotNames;
00256
00257
00258 int m_numGhost;
00259
00260
00261 Real m_domainLength;
00262
00263
00264 LevelGodunov m_levelGodunov;
00265
00266
00267 LevelSolver m_levelSolver;
00268
00269
00270
00271
00272 LevelFluxRegister m_fluxRegister;
00273
00274
00275 PatchGodunov* m_patchGodunovFactory;
00276 PatchGodunov* m_patchGodunov;
00277
00278
00279 PoissonOp* m_poissonOpFactory;
00280 PoissonOp* m_poissonOp;
00281
00282
00283 Real m_refineThresh;
00284
00285
00286 int m_tagBufferSize;
00287
00288
00289 bool m_hasCoarser;
00290 bool m_hasFiner;
00291
00292 DisjointBoxLayout m_grids;
00293
00294 private:
00295
00296 void operator=(const AMRLevelIdealMHD& a_input)
00297 {
00298 MayDay::Error("invalid operator");
00299 }
00300
00301
00302 AMRLevelIdealMHD(const AMRLevelIdealMHD& a_input)
00303 {
00304 MayDay::Error("invalid operator");
00305 }
00306 };
00307
00308 #endif