00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBCOMPOSITEMACPROJECTOR_H_
00012 #define _EBCOMPOSITEMACPROJECTOR_H_
00013
00014 #include "EBLevelMACProjector.H"
00015 #include "DisjointBoxLayout.H"
00016 #include "EBISLayout.H"
00017 #include "Box.H"
00018 #include "REAL.H"
00019 #include "LevelData.H"
00020 #include "EBFluxFAB.H"
00021 #include "EBCellFAB.H"
00022 #include "EBSimpleSolver.H"
00023 #include "EBAMRPoissonOp.H"
00024 #include "MultiGrid.H"
00025 #include "EBPWLFillPatch.H"
00026 #include "BiCGStabSolver.H"
00027 #include "EBLevelGrid.H"
00028 #include "NamespaceHeader.H"
00029
00031
00036 class EBCompositeMACProjector
00037 {
00038 public:
00039
00041 ~EBCompositeMACProjector();
00042
00044
00062 EBCompositeMACProjector(const Vector<EBLevelGrid>& a_eblg,
00063 const Vector<int>& a_refRat,
00064 const Vector<RefCountedPtr<EBQuadCFInterp> >& a_quadCFI,
00065 const RealVect& a_coarsestDx,
00066 const RealVect& a_origin,
00067 const RefCountedPtr<BaseDomainBCFactory>& a_baseDomainBCVel,
00068 const RefCountedPtr<BaseDomainBCFactory>& a_baseDomainBCPhi,
00069 const RefCountedPtr<BaseEBBCFactory>& a_ebbcPhi,
00070 const bool& a_subtractOffMean,
00071 const int& a_numLevels,
00072 const int& a_verbosity,
00073 const int& a_numPreCondIters,
00074 const Real& a_time,
00075 const int& a_relaxType,
00076 const int& a_bottomSolverType);
00077
00079
00088 int
00089 project(Vector<LevelData<EBFluxFAB>* >& a_velocity,
00090 Vector<LevelData<EBFluxFAB>* >& a_gradient,
00091 const Real& a_gradCoef=1.0,
00092 const Real& a_divuCoef=1.0,
00093 const Vector<LevelData<BaseIVFAB<Real> >* >* a_boundaryVelo=NULL);
00094
00096 void
00097 setSolverParams(int a_numSmooth,
00098 int a_itermax,
00099 int a_mgcycle,
00100 Real a_hang,
00101 Real a_tolerance,
00102 int a_verbosity=3,
00103 Real a_normThresh=1.e-12);
00104
00106 void enforceVelocityBC(Vector<LevelData<EBFluxFAB>* >& a_velo,
00107 const bool& a_doDivFreeOutflow=true);
00108
00110 void enforceGradientBC(Vector<LevelData<EBFluxFAB>* >& a_grad,
00111 const Vector<LevelData<EBCellFAB>* >& a_phi);
00112
00114
00119 void kappaDivergence(Vector<LevelData<EBCellFAB>* >& a_divu,
00120 Vector<LevelData<EBFluxFAB>* >& a_velo,
00121 const Vector<LevelData<BaseIVFAB<Real> >* >* a_boundaryVelo=NULL,
00122 const bool& a_doDivFreeOutFlow=true);
00123
00125 void gradient(Vector<LevelData<EBFluxFAB>* >& a_grad,
00126 const Vector<LevelData<EBCellFAB>* >& a_phi);
00127
00129
00136 void correctVelocityComponent(Vector<LevelData<EBFluxFAB>* >& a_velocity,
00137 Vector<LevelData<EBFluxFAB>* >& a_gradient,
00138 int a_icomp);
00139
00140
00141 void correctTangentialVelocity(EBFaceFAB& a_velocity,
00142 const EBFaceFAB& a_gradient,
00143 const Box& a_grid,
00144 const EBISBox& a_ebisBox,
00145 const IntVectSet& a_cfivs);
00146 void
00147 correctVelocityComponent(BaseIVFAB<Real> & a_coveredVel,
00148 const Vector<VolIndex>& a_coveredFace,
00149 const IntVectSet & a_coveredSets,
00150 const EBFluxFAB & a_macGradient,
00151 const EBISBox & a_ebisBox,
00152 int a_idir, Side::LoHiSide a_sd, int a_icomp);
00153
00154 void
00155 correctVelocityComponent(Vector<LayoutData< Vector< BaseIVFAB<Real> * > >* > & a_coveredVelLo,
00156 Vector<LayoutData< Vector< BaseIVFAB<Real> * > >* > & a_coveredVelHi,
00157 const Vector< LayoutData< Vector< Vector<VolIndex> > >* >& a_coveredFaceLo,
00158 const Vector< LayoutData< Vector< Vector<VolIndex> > >* >& a_coveredFaceHi,
00159 const Vector< LayoutData< Vector< IntVectSet > >* > & a_coveredSetsLo,
00160 const Vector< LayoutData< Vector< IntVectSet > >* > & a_coveredSetsHi,
00161 const Vector<LevelData<EBFluxFAB>* > & a_macGradient,
00162 int a_faceDir,
00163 int a_velComp);
00164
00166
00169 void
00170 setInitialPhi(Vector<LevelData<EBCellFAB>* >& a_phi);
00171
00172 AMRMultiGrid<LevelData<EBCellFAB> >& getSolver()
00173 {return m_solver;}
00174 Vector<LevelData<EBCellFAB>* >& getPhi()
00175 {return m_phi;}
00176 protected:
00177
00178
00179 void
00180 initialize(Vector<LevelData<EBCellFAB>* >& a_phi);
00181
00182
00183
00184 Vector<LevelData<EBCellFAB>* > m_divu;
00185 Vector<LevelData<EBCellFAB>* > m_phi;
00186 Vector<EBFluxRegister*> m_fluxReg;
00187 AMRMultiGrid<LevelData<EBCellFAB> > m_solver;
00188 BiCGStabSolver<LevelData<EBCellFAB> > m_bottomSolverBiCG;
00189 EBSimpleSolver m_bottomSolverSimp;
00190 EBAMRPoissonOpFactory* m_opFactory;
00191 RefCountedPtr<BaseDomainBCFactory> m_baseDomainBCFactVel;
00192 RefCountedPtr<BaseDomainBCFactory> m_baseDomainBCFactPhi;
00193 RefCountedPtr<BaseEBBCFactory> m_baseEBBCVel;
00194
00195 Vector<EBLevelGrid> m_eblg;
00196 Vector<RefCountedPtr<EBQuadCFInterp> > m_quadCFI;
00197 Vector<RealVect> m_dx;
00198 RealVect m_origin;
00199 Vector<int> m_refRat;
00200 int m_numLevels;
00201 int m_bottomSolverType;
00202 bool m_subtractOffMean;
00203 bool m_useInitialGuess;
00204 Real m_time;
00205 private:
00206
00207 EBCompositeMACProjector()
00208 {
00209 MayDay::Error("Weak construction is bad where there is this much memory management");
00210 }
00211
00212 EBCompositeMACProjector(const EBCompositeMACProjector& a_input)
00213 {
00214 MayDay::Error("We disallow copy construction for objects with pointered data");
00215 }
00216
00217 void operator=(const EBCompositeMACProjector& a_input)
00218 {
00219 MayDay::Error("We disallow assignment for objects with pointered data");
00220 }
00221
00222 };
00223
00226
00227 Real
00228 getAverageFaceGrad(const VolIndex& a_vof,
00229 const EBFaceFAB& a_macGradient,
00230 const EBISBox& a_ebisBox,
00231 int a_faceDir);
00232
00233 #include "NamespaceFooter.H"
00234 #endif