00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _LEVELADVECT_H_ 00012 #define _LEVELADVECT_H_ 00013 00014 #include "FArrayBox.H" 00015 #include "FluxBox.H" 00016 #include "DisjointBoxLayout.H" 00017 #include "LevelData.H" 00018 #include "PiecewiseLinearFillPatch.H" 00019 #include "LevelFluxRegister.H" 00020 #include "ProblemDomain.H" 00021 #include "Copier.H" 00022 #include "PatchGodunov.H" 00023 #include "AdvectPhysics.H" 00024 00025 #include "NamespaceHeader.H" 00026 00027 /// Advection integrator on a level 00028 /** 00029 */ 00030 class LevelAdvect 00031 { 00032 public: 00033 /// Default constructor 00034 /** 00035 Object requires define() to be called before all other functions. 00036 */ 00037 LevelAdvect() 00038 { 00039 m_dx = 0.0; 00040 m_refineCoarse = 0; 00041 m_isDefined = false; 00042 } 00043 00044 /// Destructor 00045 /** 00046 Destroys all objects created by define(). Passed in data references 00047 of define() are left alone. 00048 */ 00049 ~LevelAdvect() 00050 { 00051 } 00052 00053 /// Actual constructor. 00054 /** 00055 Inside the routine, we cast away const-ness on the data members 00056 for the assignment. The arguments passed in are maintained const 00057 (coding standards). 00058 */ 00059 void define(/// advection physics class 00060 const AdvectPhysics& a_gphys, 00061 /// box layout at this level 00062 const DisjointBoxLayout& a_thisDisjointBoxLayout, 00063 /// box layout at next coarser level (or empty if this is coarsest level) 00064 const DisjointBoxLayout& a_coarserDisjointBoxLayout, 00065 /// problem domain at this level 00066 const ProblemDomain& a_domain, 00067 /// refinement ratio between this level and next coarser level 00068 const int& a_refineCoarse, 00069 /// whether to use limiting 00070 const bool& a_useLimiting, 00071 /// grid spacing at this level 00072 const Real& a_dx, 00073 /// whether there is a coarser level 00074 const bool& a_hasCoarser, 00075 /// whether there is a finer level 00076 const bool& a_hasFiner); 00077 00078 /// Advance the solution by one timestep on this grid level. 00079 /** 00080 */ 00081 Real step(/// conserved variables at this level, defined on a_thisDisjointBoxLayout in define(); gets updated in this routine 00082 LevelData<FArrayBox>& a_U, 00083 /// flux register with next finer level 00084 LevelFluxRegister& a_finerFluxRegister, 00085 /// flux register with next coarser level 00086 LevelFluxRegister& a_coarserFluxRegister, 00087 /// advection velocity on faces 00088 LevelData<FluxBox>& a_advectionVelocity, 00089 /// source term, or if no source term then this is null constructed and not defined 00090 const LevelData<FArrayBox>& a_S, 00091 /// conserved variables at coarser level at time of last coarser-level update, or empty if no coarser level; may be empty if interpolation not required 00092 const LevelData<FArrayBox>& a_UCoarseOld, 00093 /// time of last update at coarser level 00094 const Real& a_TCoarseOld, 00095 /// conserved variables at coarser level at time of next coarser-level update, or empty if no coarser level; may be empty if interpolation not required 00096 const LevelData<FArrayBox>& a_UCoarseNew, 00097 /// time of next update at coarser level 00098 const Real& a_TCoarseNew, 00099 /// current time 00100 const Real& a_time, 00101 /// time step 00102 const Real& a_dt); 00103 00104 /// Convert velocity from face-centered to cell-centered 00105 /** 00106 In each direction, take average of normal component of velocity 00107 on the neighboring faces in that direction. 00108 */ 00109 void averageVelToCC(/// cell-centered velocity 00110 FArrayBox& a_normalVel, 00111 /// face-centered velocity 00112 const FluxBox & a_advectionVel, 00113 /// Box on which to return a_normalVel 00114 const Box& a_box) const; 00115 00116 /// Fill in ghost cells by exchange at this level and then by interpolation from coarser level (if any). 00117 void fillGhost(/// conserved variables at this level, with ghosts cells to be filled in 00118 LevelData<FArrayBox>& a_U, 00119 /// conserved variables at coarser level at time of last coarser-level update, or empty if no coarser level; may be empty if interpolation not required 00120 const LevelData<FArrayBox>& a_UCoarseOld, 00121 /// time of last update at coarser level 00122 const Real& a_TCoarseOld, 00123 /// conserved variables at coarser level at time of next coarser-level update, or empty if no coarser level; may be empty if interpolation not required 00124 const LevelData<FArrayBox>& a_UCoarseNew, 00125 /// time of next update at coarser level 00126 const Real& a_TCoarseNew, 00127 /// time step 00128 const Real& a_dt, 00129 /// current time 00130 const Real& a_time); 00131 00132 /// Get maximum wave speed 00133 /** 00134 */ 00135 Real getMaxWaveSpeed(/// conserved variables at this level 00136 const LevelData<FArrayBox>& a_U, 00137 /// face-centered velocities 00138 LevelData<FluxBox>& a_advectionVelocity); 00139 00140 protected: 00141 00142 /// layout for this level 00143 DisjointBoxLayout m_grids; 00144 00145 /// patch integrator 00146 PatchGodunov m_patchGodunov; 00147 00148 /// physics class 00149 AdvectPhysics* m_advectPhysics; 00150 00151 /// number of ghost cells need locally for this level 00152 int m_numGhost; 00153 00154 /// exchange copier 00155 Copier m_exchangeCopier; 00156 00157 /// interpolator for filling in ghost cells from the next coarser level 00158 PiecewiseLinearFillPatch m_patcher; 00159 00160 /// grid spacing 00161 Real m_dx; 00162 00163 /// problem domain - index space for this level 00164 ProblemDomain m_domain; 00165 00166 /// refinement ratio between this level and the next coarser 00167 int m_refineCoarse; 00168 00169 /// whether a coarser level exists 00170 bool m_hasCoarser; 00171 00172 /// whether a finer level exists 00173 bool m_hasFiner; 00174 00175 /// number of conserved variables (= 1) 00176 int m_numCons;//=1 00177 00178 /// order of normal predictor 00179 int m_normalPredOrder; 00180 00181 /// whether to use 4th-order slope computations (otherwise, use 2nd order) 00182 bool m_useFourthOrderSlopes; 00183 00184 /// whether to do slope limiting in the primitive variables 00185 bool m_usePrimLimiting; 00186 00187 /// whether to do slope limiting in the characteristic variables 00188 bool m_useCharLimiting; 00189 00190 /// whether to do slope flattening - MUST BE USING 4th-order slopes 00191 bool m_useFlattening; 00192 00193 /// whether to apply artificial viscosity of a set value 00194 bool m_useArtificialViscosity; 00195 00196 /// artificial viscosity coefficient 00197 Real m_artificialViscosity; 00198 00199 /// whether this object has been defined 00200 bool m_isDefined; 00201 00202 private: 00203 00204 // Disallowed for all the usual reasons 00205 void operator=(const LevelAdvect&); 00206 LevelAdvect(const LevelAdvect&); 00207 }; 00208 00209 #include "NamespaceFooter.H" 00210 00211 #endif