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_POLYTROPIC_GAS_H_ 00029 #define _AMR_LEVEL_POLYTROPIC_GAS_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 AMRLevelPolytropicGas : public AMRLevel 00049 { 00050 public: 00052 00054 AMRLevelPolytropicGas(); 00055 00057 00059 virtual ~AMRLevelPolytropicGas(); 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 00186 const LevelData<FArrayBox>& getStateNew() const; 00187 00189 const LevelData<FArrayBox>& getStateOld() const; 00190 protected: 00191 // Create a load-balanced DisjointBoxLayout from a collection of Boxes 00192 DisjointBoxLayout loadBalance(const Vector<Box>& a_grids); 00193 00194 // Setup menagerie of data structures 00195 void levelSetup(); 00196 00197 // Get the next coarser level 00198 AMRLevelPolytropicGas* getCoarserLevel() const; 00199 00200 // Get the next finer level 00201 AMRLevelPolytropicGas* getFinerLevel() const; 00202 00203 // Conserved state, U, at old and new time 00204 LevelData<FArrayBox> m_UOld,m_UNew; 00205 00206 // CFL number 00207 Real m_cfl; 00208 00209 // Grid spacing 00210 Real m_dx; 00211 00212 // Interpolation from fine to coarse level 00213 FineInterp m_fineInterp; 00214 00215 // Averaging from coarse to fine level 00216 CoarseAverage m_coarseAverage; 00217 00218 // New time step 00219 Real m_dtNew; 00220 00221 // Number of converved states 00222 int m_numStates; 00223 00224 // Names of conserved states 00225 Vector<string> m_stateNames; 00226 00227 // Number of ghost cells (in each direction) 00228 int m_numGhost; 00229 00230 // Physical dimension of the longest side of the domain 00231 Real m_domainLength; 00232 00233 // Level integrator 00234 LevelGodunov m_levelGodunov; 00235 00236 // Flux register 00237 LevelFluxRegister m_fluxRegister; 00238 00239 // Patch integrator (factory and object) 00240 PatchGodunov* m_patchGodunovFactory; 00241 PatchGodunov* m_patchGodunov; 00242 00243 // Refinement threshold for gradient 00244 Real m_refineThresh; 00245 00246 // Tag buffer size 00247 int m_tagBufferSize; 00248 00249 // Flag coarser and finer levels 00250 bool m_hasCoarser; 00251 bool m_hasFiner; 00252 00253 DisjointBoxLayout m_grids; 00254 00255 private: 00256 // Disallowed for all the usual reasons 00257 void operator=(const AMRLevelPolytropicGas& a_input) 00258 { 00259 MayDay::Error("invalid operator"); 00260 } 00261 00262 // Disallowed for all the usual reasons 00263 AMRLevelPolytropicGas(const AMRLevelPolytropicGas& a_input) 00264 { 00265 MayDay::Error("invalid operator"); 00266 } 00267 }; 00268 00269 #endif