00001 /* _______ __ 00002 / ___/ / ___ __ _ / / ___ 00003 / /__/ _ \/ _ \/ ' \/ _ \/ _ \ 00004 \___/_//_/\___/_/_/_/_.__/\___/ 00005 */ 00006 // 00007 // This software is copyright (C) by the Lawrence Berkeley 00008 // National Laboratory. Permission is granted to reproduce 00009 // this software for non-commercial purposes provided that 00010 // this notice is left intact. 00011 // 00012 // It is acknowledged that the U.S. Government has rights to 00013 // this software under Contract DE-AC03-765F00098 between 00014 // the U.S. Department of Energy and the University of 00015 // California. 00016 // 00017 // This software is provided as a professional and academic 00018 // contribution for joint exchange. Thus it is experimental, 00019 // is provided ``as is'', with no warranties of any kind 00020 // whatsoever, no support, no promise of updates, or printed 00021 // documentation. By using this software, you acknowledge 00022 // that the Lawrence Berkeley National Laboratory and 00023 // Regents of the University of California shall have no 00024 // liability with respect to the infringement of other 00025 // copyrights by any part of this software. 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 00038 #include "LevelGodunov.H" 00039 #include "PhysIBC.H" 00040 #include "Box.H" 00041 #include "IntVectSet.H" 00042 #include "Vector.H" 00043 #include "DisjointBoxLayout.H" 00044 00046 00048 class AMRLevelIdealMHD : public AMRLevel 00049 { 00050 public: 00052 00054 AMRLevelIdealMHD(); 00055 00057 00059 virtual ~AMRLevelIdealMHD(); 00060 00062 00064 virtual void define(AMRLevel* a_coarserLevelPtr, 00065 const Box& a_problemDomain, 00066 int a_level, 00067 int a_refRatio); 00068 00070 00072 virtual void define(AMRLevel* a_coarserLevelPtr, 00073 const ProblemDomain& a_problemDomain, 00074 int a_level, 00075 int a_refRatio); 00076 00077 00079 00081 virtual Real advance(); 00082 00084 00086 virtual void postTimeStep(); 00087 00089 00091 virtual void tagCells(IntVectSet& a_tags); 00092 00094 00096 virtual void tagCellsInit(IntVectSet& a_tags); 00097 00099 00101 virtual void regrid(const Vector<Box>& a_newGrids); 00102 00104 00106 virtual void initialGrid(const Vector<Box>& a_newGrids); 00107 00109 00111 virtual void initialData(); 00112 00114 00116 virtual void postInitialize(); 00117 00119 00121 virtual void patchGodunov(const PatchGodunov* const a_patchGodunov); 00122 00123 #ifdef HDF5 00124 00125 00127 virtual void writeCheckpointHeader(HDF5Handle& a_handle) const; 00128 00130 00132 virtual void writeCheckpointLevel(HDF5Handle& a_handle) const; 00133 00135 00137 virtual void readCheckpointHeader(HDF5Handle& a_handle); 00138 00140 00142 virtual void readCheckpointLevel(HDF5Handle& a_handle); 00143 00145 00147 virtual void writePlotHeader(HDF5Handle& a_handle) const; 00148 00150 00152 virtual void writePlotLevel(HDF5Handle& a_handle) const; 00153 #endif 00154 00156 00158 virtual Real computeDt(); 00159 00161 00163 virtual Real computeInitialDt(); 00164 00166 00168 virtual void CFL(Real a_cfl); 00169 00171 00173 virtual void domainLength(Real a_domainLength); 00174 00176 00178 virtual void refinementThreshold(Real a_refineThresh); 00179 00181 00183 void tagBufferSize(int a_tagBufferSize); 00184 00185 protected: 00186 // Create a load-balanced DisjointBoxLayout from a collection of Boxes 00187 DisjointBoxLayout loadBalance(const Vector<Box>& a_grids); 00188 00189 // Setup menagerie of data structures 00190 void levelSetup(); 00191 00192 // Get the next coarser level 00193 AMRLevelIdealMHD* getCoarserLevel() const; 00194 00195 // Get the next finer level 00196 AMRLevelIdealMHD* getFinerLevel() const; 00197 00198 // Conserved state, U, at old and new time 00199 LevelData<FArrayBox> m_UOld,m_UNew; 00200 00201 // CFL number 00202 Real m_cfl; 00203 00204 // Grid spacing 00205 Real m_dx; 00206 00207 // Interpolation from fine to coarse level 00208 FineInterp m_fineInterp; 00209 00210 // Averaging from coarse to fine level 00211 CoarseAverage m_coarseAverage; 00212 00213 // New time step 00214 Real m_dtNew; 00215 00216 // Number of converved states 00217 int m_numStates; 00218 00219 // Names of conserved states 00220 Vector<string> m_stateNames; 00221 00222 // Number of ghost cells (in each direction) 00223 int m_numGhost; 00224 00225 // Physical dimension of the longest side of the domain 00226 Real m_domainLength; 00227 00228 // Level integrator 00229 LevelGodunov m_levelGodunov; 00230 00231 // Flux register 00232 LevelFluxRegister m_fluxRegister; 00233 00234 // Patch integrator (factory and object) 00235 PatchGodunov* m_patchGodunovFactory; 00236 PatchGodunov* m_patchGodunov; 00237 00238 // Refinement threshold for gradient 00239 Real m_refineThresh; 00240 00241 // Tag buffer size 00242 int m_tagBufferSize; 00243 00244 // Flag coarser and finer levels 00245 bool m_hasCoarser; 00246 bool m_hasFiner; 00247 00248 DisjointBoxLayout m_grids; 00249 00250 private: 00251 // Disallowed for all the usual reasons 00252 void operator=(const AMRLevelIdealMHD& a_input) 00253 { 00254 MayDay::Error("invalid operator"); 00255 } 00256 00257 // Disallowed for all the usual reasons 00258 AMRLevelIdealMHD(const AMRLevelIdealMHD& a_input) 00259 { 00260 MayDay::Error("invalid operator"); 00261 } 00262 }; 00263 00264 #endif