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

AMRLevelMHD.H

Go to the documentation of this file.
00001 /*   _______              __
00002     / ___/ /  ___  __ _  / /  ___
00003    / /__/ _ \/ _ \/  V \/ _ \/ _ \
00004    \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy).  All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners.  Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051 
00052 #ifndef _AMRLEVELMHD_H_
00053 #define _AMRLEVELMHD_H_
00054 
00055 #include "FArrayBox.H"
00056 #include "LevelData.H"
00057 #include "AMRLevel.H"
00058 #include "CoarseAverage.H"
00059 #include "FineInterp.H"
00060 #include "LevelFluxRegister.H"
00061 #include "LevelSolver.H"
00062 #include "PoissonOp.H"
00063 #include "Box.H"
00064 #include "IntVectSet.H"
00065 #include "Vector.H"
00066 #include "DisjointBoxLayout.H"
00067 
00068 #include "LevelGodunov.H"
00069 #include "PhysIBC.H"
00070 
00072 
00074 class AMRLevelMHD: public AMRLevel
00075 {
00076 public:
00078 
00080   AMRLevelMHD();
00081 
00083 
00085   virtual ~AMRLevelMHD();
00086 
00088 
00090   void defineParams(const Real&                 a_cfl,
00091                     const Real&                 a_domainLength,
00092                     const int&                  a_verbosity,
00093                     const Real&                 a_refineThresh,
00094                     const int&                  a_tagBufferSize,
00095                     const Real&                 a_initialDtMultiplier,
00096                     const GodunovPhysics* const a_godunovPhysics,
00097                     const int&                  a_normalPredOrder,
00098                     const bool&                 a_useFourthOrderSlopes,
00099                     const bool&                 a_usePrimLimiting,
00100                     const bool&                 a_useCharLimiting,
00101                     const bool&                 a_useFlattening,
00102                     const bool&                 a_useArtificialViscosity,
00103                     const Real&                 a_artificialViscosity,
00104                     const bool&                 a_doFilterBField);
00105 
00107 
00109   virtual void define(AMRLevel*  a_coarserLevelPtr,
00110                       const Box& a_problemDomain,
00111                       int        a_level,
00112                       int        a_refRatio);
00113 
00115 
00117   virtual void define(AMRLevel*            a_coarserLevelPtr,
00118                       const ProblemDomain& a_problemDomain,
00119                       int                  a_level,
00120                       int                  a_refRatio);
00121 
00123 
00125   virtual Real advance();
00126 
00128 
00130   virtual void postTimeStep();
00131 
00133 
00135   virtual void tagCells(IntVectSet& a_tags);
00136 
00138 
00140   virtual void tagCellsInit(IntVectSet& a_tags);
00141 
00143 
00145   virtual void regrid(const Vector<Box>& a_newGrids);
00146 
00148 
00150   virtual void initialGrid(const Vector<Box>& a_newGrids);
00151 
00153 
00155   virtual void initialData();
00156 
00158 
00160   virtual void postInitialize();
00161 
00162 #ifdef CH_USE_HDF5
00163 
00164 
00166   virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
00167 
00169 
00171   virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
00172 
00174 
00176   virtual void readCheckpointHeader(HDF5Handle& a_handle);
00177 
00179 
00181   virtual void readCheckpointLevel(HDF5Handle& a_handle);
00182 
00184 
00186   virtual void writePlotHeader(HDF5Handle& a_handle) const;
00187 
00189 
00191   virtual void writePlotLevel(HDF5Handle& a_handle) const;
00192 #endif
00193 
00195 
00197   virtual Real computeDt();
00198 
00200 
00202   virtual Real computeInitialDt();
00203 
00205   const LevelData<FArrayBox>& getStateNew() const;
00206 
00208   const LevelData<FArrayBox>& getStateOld() const;
00209 
00211   bool allDefined() const;
00212 
00213 
00214 protected:
00215   // Create a load-balanced DisjointBoxLayout from a collection of Boxes
00216   DisjointBoxLayout loadBalance(const Vector<Box>& a_grids);
00217 
00218   // Setup menagerie of data structures
00219   void levelSetup();
00220 
00221   // Compute Divergence
00222   void DivergenceB(LevelData<FArrayBox>&      a_divb,
00223                    const LayoutData<FluxBox>& a_WHalf);
00224 
00225   // Project the magnetic field
00226   void ProjectBField(LayoutData<FluxBox>&        a_WHalf,
00227                      const LevelData<FArrayBox>& a_phi);
00228 
00229   //Filter the magnetic field - Old function
00230   void FilterBFieldOld(LevelData<FArrayBox> &a_U);
00231 
00232   //Filter the magnetic field
00233   void FilterBField(LevelData<FArrayBox>& a_U,
00234                     LevelFluxRegister&    a_finerFluxRegister,
00235                     LevelFluxRegister&    a_coarserFluxRegister);
00236 
00237   // Get the next coarser level
00238   AMRLevelMHD* getCoarserLevel() const;
00239 
00240   // Get the next finer level
00241   AMRLevelMHD* getFinerLevel() const;
00242 
00243   // Conserved state, U, at old and new time
00244   LevelData<FArrayBox> m_UOld,m_UNew;
00245 
00246   // Phi for projection
00247   LevelData<FArrayBox> m_Phi;
00248 
00249   //Hyperbolic Fluxes
00250   LevelData<FArrayBox> m_flux[CH_SPACEDIM];
00251 
00252   //Whalf: Time centered face values of primitive variables
00253    LayoutData<FluxBox> m_whalf;
00254 
00255  //Source term which uses the parabolic fluxes
00256   LevelData<FArrayBox> m_source;
00257 
00258  // rhs=(divB) for projection
00259   LevelData<FArrayBox> m_rhs;
00260   // CFL number
00261   Real m_cfl;
00262 
00263   // Grid spacing
00264   Real m_dx;
00265 
00266   // Interpolation from coarse to fine level
00267   FineInterp m_fineInterp;
00268 
00269   // Averaging from fine to coarse level
00270   CoarseAverage m_coarseAverage;
00271 
00272   // New time step
00273   Real m_dtNew;
00274 
00275   // Number of conserved states
00276   int m_numStates;
00277 
00278   // Number of primitive states
00279   int m_numPrims;
00280 
00281   // Number of fluxes
00282   int m_numFluxes;
00283 
00284   // Names of conserved states
00285   Vector<string> m_stateNames;
00286 
00287   // Names of plot variables
00288   Vector<string> m_plotNames;
00289 
00290   // Number of ghost cells (in each direction)
00291   int m_numGhost;
00292 
00293   // Physical dimension of the longest side of the domain
00294   Real m_domainLength;
00295 
00296   // Level integrator
00297   LevelGodunov m_levelGodunov;
00298 
00299   // Level solver for Poisson equation for Phi
00300   LevelSolver m_levelSolver;
00301 
00302   // Flux register
00303   LevelFluxRegister m_fluxRegister;
00304 
00305   // Pointer to the class defining the physics of the problem
00306   GodunovPhysics* m_gdnvPhysics;
00307 
00308   //Poisson operator
00309   PoissonOp m_poissonOp;
00310   // Order of the normal predictor (1 -> PLM, 2-> PPM)
00311   int m_normalPredOrder;
00312 
00313   // Use 4th order slope computations (otherwise, use 2nd order)
00314   bool m_useFourthOrderSlopes;
00315 
00316   // Do slope limiting in the primitive or characteristic variables, respect.
00317   bool m_usePrimLimiting;
00318   bool m_useCharLimiting;
00319 
00320   // Do slope flattening - MUST BE USING 4th order slopes
00321   bool m_useFlattening;
00322 
00323   // Apply artificial viscosity of a set value
00324   bool m_useArtificialViscosity;
00325   Real m_artificialViscosity;
00326 
00327   // Apply filter to magnetic field
00328   bool m_doFilterBField;
00329 
00330   // Refinement threshold for gradient
00331   Real m_refineThresh;
00332 
00333   // Tag buffer size
00334   int m_tagBufferSize;
00335 
00336   // Flag coarser and finer levels
00337   bool m_hasCoarser;
00338   bool m_hasFiner;
00339 
00340   // Grid layout for this level
00341   DisjointBoxLayout m_grids;
00342 
00343   // True if all the parameters for this object are defined
00344   bool m_paramsDefined;
00345 
00346 
00347 private:
00348   // Disallowed for all the usual reasons
00349   void operator=(const AMRLevelMHD& a_input)
00350   {
00351     MayDay::Error("invalid operator");
00352   }
00353 
00354   // Disallowed for all the usual reasons
00355   AMRLevelMHD(const AMRLevelMHD& a_input)
00356   {
00357     MayDay::Error("invalid operator");
00358   }
00359 };
00360 
00361 #endif

Generated on Wed Oct 5 12:08:13 2005 for Chombo&AMRIdealMHD by  doxygen 1.4.1