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

AmrProjector.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 
00007 // AmrProjector.H
00008 
00009 //
00010 // This software is copyright (C) by the Lawrence Berkeley
00011 // National Laboratory.  Permission is granted to reproduce
00012 // this software for non-commercial purposes provided that
00013 // this notice is left intact.
00014 // 
00015 // It is acknowledged that the U.S. Government has rights to
00016 // this software under Contract DE-AC03-765F00098 between
00017 // the U.S.  Department of Energy and the University of
00018 // California.
00019 //
00020 // This software is provided as a professional and academic
00021 // contribution for joint exchange. Thus it is experimental,
00022 // is provided ``as is'', with no warranties of any kind
00023 // whatsoever, no support, no promise of updates, or printed
00024 // documentation. By using this software, you acknowledge
00025 // that the Lawrence Berkeley National Laboratory and
00026 // Regents of the University of California shall have no
00027 // liability with respect to the infringement of other
00028 // copyrights by any part of this software.
00029 //
00030 // Dan Martin, Fri, Jan 14, 2000
00031 
00032 #ifndef _AmrProjector_H_
00033 #define _AmrProjector_H_
00034 
00035 
00036 #include <cstdlib>
00037 #include <cmath>
00038 #include <cassert>
00039 
00040 #include <iostream>
00041 using std::istream;
00042 using std::cout;
00043 using std::cerr;
00044 
00045 
00046 #include "REAL.H"
00047 #include "IntVect.H"
00048 #include "Box.H"
00049 #include "FArrayBox.H"
00050 #include "Vector.H"
00051 #include "IntVectSet.H"
00052 #include "DisjointBoxLayout.H"
00053 #include "LevelData.H"
00054 #include "AMRSolver.H"
00055 #include "QuadCFInterp.H"
00056 #include "GhostBC.H"
00057 #include "PhysBCUtil.H"
00058 
00059 #include "FluxBox.H"
00060 
00062 class AmrProjector
00067 {
00068 
00069 public:
00071   AmrProjector();
00072 
00074   AmrProjector(const Vector<DisjointBoxLayout>& a_vectGrids,
00075                const Vector<ProblemDomain>& a_vectDomain,
00076                const Vector<Real>&  a_vectDx,
00077                const Vector<int>& a_vectRefRatio,
00078                int a_lbase,
00079                const PhysBCUtil& a_physBC);
00080   
00082   ~AmrProjector();
00083   
00085   void define(const Vector<DisjointBoxLayout>& a_vectGrids,
00086               const Vector<ProblemDomain>& a_vectDomain,
00087               const Vector<Real>&  a_vectDx,
00088               const Vector<int>& a_vectRefRatio,
00089               int a_lbase,
00090               const PhysBCUtil& a_physBC);
00091 
00093   void regrid(const Vector<DisjointBoxLayout>& a_newGrids);
00094 
00095 
00097   void setDefaultValues();
00098 
00100   void init(const AmrProjector& a_oldProj);
00101   
00103   void variableSetUp();
00104   
00106   void writeCheckpointHeader(HDF5Handle& a_handle) const;
00107 
00109   void writeCheckpoint(HDF5Handle& a_handle) const;
00110 
00112   void readCheckpointHeader(HDF5Handle& a_handle);
00113   
00115   void readCheckpoint(HDF5Handle& a_handle);
00116   
00117   
00118   /*@ManMemo: do multilevel MAC projection, correct uEdge.  a_oldTime is
00119     old-time on AMRLevel which is calling the projection.  Assumes
00120     BC's already set on uEdge values.  a_vectPhi contains the correction 
00121     field generated by the projection */
00122   void MacProject(Vector<LevelData<FluxBox>* > & a_uEdge,
00123                   Vector<LevelData<FArrayBox>* >& a_vectPhi,
00124                   Real a_oldTime, Real a_dt);
00125   
00126   /*@ManMemo: do multilevel projection and correct (cell-centered)
00127     velocities; assumes physical and exchange (copy) boundary
00128     conditions already set.  a_vectPi contains the correction (pressure) 
00129     generated by the projection.
00130   */
00131   void CCProject(Vector<LevelData<FArrayBox>* >& a_velocity, 
00132                  Vector<LevelData<FArrayBox>* >& a_vectPi,
00133                  const Real a_newTime, const Real a_dt);
00134   
00135   
00136   /*@ManMemo: performs multilevel projection on velocity, modifies velocity
00137     in place. This differs from the other projections in that it does not 
00138     return a correction field.    
00139   */
00140   
00141   void initialVelocityProject(Vector<LevelData<FArrayBox>* >& a_velocity);
00142 
00143   
00145 
00147   int finestLevel() const;
00148   
00150   const ProblemDomain& dProblem(int a_level) const;
00151 
00153   const DisjointBoxLayout& getBoxes(int a_level) const;
00154 
00156   Real dx(int a_level) const;
00157 
00159 
00161   void gradPhi(LevelData<FArrayBox>& a_gradPhi, 
00162                const LevelData<FArrayBox>& a_phi,
00163                int a_dir, int a_level) const;
00164 
00166   void gradPhi(LevelData<FluxBox>& a_gradPhi, 
00167                const LevelData<FArrayBox>& a_phi,
00168                int a_level) const;
00169 
00171 
00173   void gradPi(LevelData<FArrayBox>& a_gradPi, 
00174               const LevelData<FArrayBox>& a_Pi,
00175               int a_dir, int a_level) const;
00176 
00178 
00180   void gradPi(LevelData<FArrayBox>& a_gradPi, 
00181               const LevelData<FArrayBox>& a_Pi,
00182               int a_level) const;
00183   
00184 
00186   void setPressureBCs(Vector<LevelData<FArrayBox>* >& a_vectPressure) const;
00187 
00189   bool isInitialized() const;
00190 
00192   bool doQuadInterp() const;
00193   
00195   void verbosity(int a_verbosity);
00196 
00198   int verbosity() const;
00199 
00201   void setPhysBC(const PhysBCUtil& a_bc);
00202 
00204   PhysBCUtil* getPhysBCPtr() const;
00205 
00206 protected:
00208   void applyMacCorrection(Vector<LevelData<FluxBox>* >& a_uEdge, 
00209                           Vector<LevelData<FArrayBox>* >& a_vectPhi);
00210 
00211   
00213   void correctCCVelocities(Vector<LevelData<FArrayBox>* >& a_velocity,
00214                            const Vector<LevelData<FArrayBox>* >& a_vectPi,
00215                            const Real scale) const;
00216   
00217   
00218   /*@ManMemo: defines Multilevel AMRSolver used for composite 
00219     projections -- uses grids in m_vectGrids, lBase is this level.
00220     Physical BC's come from the DomainGhostBC
00221   */
00222   void defineSolver(AMRSolver& a_solver, 
00223                     const DomainGhostBC& a_physBC);
00224 
00225 
00227   void postRestart();
00228 
00230   void clearStorage();
00231 
00232 
00234   bool isDefined() const {return m_isInitialized;};
00235 
00236 private:
00237 
00239   int m_finestLevel;
00240   
00242   int m_lbase;
00243 
00245   Vector<Real> m_vectDx;
00246 
00248   Vector<ProblemDomain> m_vectDomain; 
00249 
00251   Vector<DisjointBoxLayout> m_vectGrids;
00252 
00254   Vector<int> m_vectRefRatio;
00255 
00257   Vector<QuadCFInterp*> m_vectCFInterp;
00258 
00260   Vector<QuadCFInterp*> m_vectVelCFInterp;
00261 
00263   Vector<LevelFluxRegister*> m_vectFR;
00264 
00266   bool m_isInitialized;
00267 
00269   static bool s_doQuadInterp;
00270  
00272   static int s_num_smooth_up;
00273 
00275   static int s_num_smooth_down;
00276 
00278   static Real s_solver_tol;
00279 
00281   static bool s_limitSolverCoarsening;
00282 
00284   static bool pp_init;
00285 
00287   static int s_verbosity;
00288 
00290   PhysBCUtil* m_physBCPtr;
00291   
00292 };
00293 
00294 #endif
00295 
00296 

Generated on Wed Jan 19 17:51:22 2005 for Chombo&INSwithParticles by doxygen1.2.16