Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

AMRLevelIdealMHD.H

Go to the documentation of this file.
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 #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   //Phi interpolation in time
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   // Create a load-balanced DisjointBoxLayout from a collection of Boxes
00202   DisjointBoxLayout loadBalance(const Vector<Box>& a_grids);
00203 
00204   // Setup menagerie of data structures
00205   void levelSetup();
00206 
00207   // Get the next coarser level
00208   AMRLevelIdealMHD* getCoarserLevel() const;
00209 
00210   // Get the next finer level
00211   AMRLevelIdealMHD* getFinerLevel() const;
00212 
00213   // Conserved state, U, at old and new time
00214   LevelData<FArrayBox> m_UOld,m_UNew;
00215 
00216   // Phi for projection at old and new time
00217   LevelData<FArrayBox> m_phiOld,m_phiNew;
00218   // rhs=(divB) for projection
00219   LevelData<FArrayBox> m_rhs;
00220   //Hyperbolic Fluxes
00221   LevelData<FArrayBox> m_flux[CH_SPACEDIM];
00222   //  LevelData<FArrayBox> m_xflux;
00223   //  LevelData<FArrayBox> m_yflux;
00224 
00225   // CFL number
00226   Real m_cfl;
00227 
00228   // Grid spacing
00229   Real m_dx;
00230 
00231   // Interpolation from fine to coarse level
00232   FineInterp m_fineInterp;
00233   // Interpolation from fine to coarse level of Phi
00234   FineInterp m_fineInterpPhi;
00235 
00236   // Averaging from coarse to fine level
00237   CoarseAverage m_coarseAverage;
00238 
00239   // Averaging from coarse to fine level for Phi
00240   CoarseAverage m_coarseAveragePhi;
00241 
00242   // New time step
00243   Real m_dtNew;
00244 
00245   // Number of converved states
00246   int m_numStates;
00247 
00248   // Number of fluxes
00249   int m_numFluxes;
00250 
00251   // Names of conserved states
00252   Vector<string> m_stateNames;
00253 
00254   // Names of plotting variables
00255   Vector<string> m_plotNames;
00256 
00257   // Number of ghost cells (in each direction)
00258   int m_numGhost;
00259 
00260   // Physical dimension of the longest side of the domain
00261   Real m_domainLength;
00262 
00263   // Level integrator
00264   LevelGodunov m_levelGodunov;
00265 
00266   // Level solver for elliptic problems
00267   LevelSolver m_levelSolver;
00268 
00269   //  PoissonOp m_levelop;
00270 
00271   // Flux register
00272   LevelFluxRegister m_fluxRegister;
00273 
00274   // Patch integrator (factory and object)
00275   PatchGodunov* m_patchGodunovFactory;
00276   PatchGodunov* m_patchGodunov;
00277 
00278   // Poisson operator (factory and object)
00279   PoissonOp* m_poissonOpFactory;
00280   PoissonOp* m_poissonOp;
00281 
00282   // Refinement threshold for gradient
00283   Real m_refineThresh;
00284 
00285   // Tag buffer size
00286   int m_tagBufferSize;
00287 
00288   // Flag coarser and finer levels
00289   bool m_hasCoarser;
00290   bool m_hasFiner;
00291 
00292   DisjointBoxLayout m_grids;
00293 
00294 private:
00295   // Disallowed for all the usual reasons
00296   void operator=(const AMRLevelIdealMHD& a_input)
00297   {
00298     MayDay::Error("invalid operator");
00299   }
00300 
00301   // Disallowed for all the usual reasons
00302   AMRLevelIdealMHD(const AMRLevelIdealMHD& a_input)
00303   {
00304     MayDay::Error("invalid operator");
00305   }
00306 };
00307 
00308 #endif

Generated on Fri Jul 2 17:53:41 2004 for Chombo by doxygen 1.3.2