11 #ifndef _BASELEVELBACKWARDEULER_H_ 12 #define _BASELEVELBACKWARDEULER_H_ 25 #include "NamespaceHeader.H" 42 template <
class LevelDataType,
44 class FluxRegisterType>
65 :
BaseLevelHeatSolver<LevelDataType,FluxDataType,FluxRegisterType>(a_grids, a_refRat, a_level0Domain, a_opFact, a_solver)
107 LevelDataType& a_phiOld,
108 LevelDataType& a_src,
110 FluxRegisterType* a_fineFluxRegPtr,
111 FluxRegisterType* a_crseFluxRegPtr,
112 const LevelDataType* a_crsePhiOldPtr,
113 const LevelDataType* a_crsePhiNewPtr,
119 bool a_zeroPhi =
true,
120 bool a_rhsAlreadyKappaWeighted =
false,
121 int a_fluxStartComponent = 0)
124 int ncomp = a_phiNew.nComp();
126 Interval intervFlux(a_fluxStartComponent, a_fluxStartComponent + ncomp-1);
130 CH_assert((a_level == 0) || (a_crsePhiOldPtr != NULL));
131 CH_assert((a_level == 0) || (a_crsePhiNewPtr != NULL));
132 CH_assert(a_crseNewTime >= a_crseOldTime);
135 LevelDataType rhst, phit;
136 this->
m_ops[a_level]->create(rhst, a_src);
137 this->
m_ops[a_level]->create(phit, a_phiNew);
139 this->
m_ops[a_level]->setToZero(phit);
140 this->
m_ops[a_level]->setToZero(rhst);
143 this->
m_ops[a_level]->setToZero(a_phiNew);
147 this->
m_ops[a_level]->incr(phit, a_phiOld, 1.0);
148 this->
m_ops[a_level]->incr(rhst, a_src , a_dt);
151 this->
m_ops[a_level]->diagonalScale(phit,
true);
154 if (!a_rhsAlreadyKappaWeighted)
155 this->
m_ops[a_level]->kappaScale(rhst);
158 this->
m_ops[a_level]->incr(rhst, phit, 1.0);
162 LevelDataType coarseData;
163 if ((a_crsePhiOldPtr != NULL) && (a_level > 0))
165 this->
m_ops[a_level-1]->create(coarseData, *a_crsePhiOldPtr);
166 this->
m_ops[a_level-1]->setToZero(coarseData);
168 this->
timeInterp(coarseData, *a_crsePhiOldPtr, *a_crsePhiNewPtr,
169 a_oldTime, a_crseOldTime, a_crseNewTime, a_level-1);
173 this->
solveHelm(a_phiNew, coarseData, rhst, a_level, 1.0, a_dt, a_zeroPhi);
174 this->
incrementFlux(a_flux, a_phiNew, a_level, 1.0, a_dt, -1.0,
true);
179 if ((a_fineFluxRegPtr != NULL) && (a_level < this->
m_grids.
size()-1))
184 FluxDataType& thisFlux = a_flux[dit];
185 for (
int dir=0; dir<
SpaceDim; ++dir)
187 a_fineFluxRegPtr->incrementCoarse(thisFlux[dir],
196 if ((a_crseFluxRegPtr != NULL) && (a_level > 0))
202 FluxDataType& thisFlux = a_flux[dit];
203 for (
int dir=0; dir<
SpaceDim; ++dir)
205 a_crseFluxRegPtr->incrementFine(thisFlux[dir], fluxMult, dit(),
226 #include "NamespaceFooter.H" BaseLevelBackwardEuler(const Vector< DisjointBoxLayout > &a_grids, const Vector< int > &a_refRat, const ProblemDomain &a_level0Domain, RefCountedPtr< AMRLevelOpFactory< LevelDataType > > &a_opFact, const RefCountedPtr< AMRMultiGrid< LevelDataType > > &a_solver)
Definition: BaseLevelBackwardEuler.H:60
A reference-counting handle class.
Definition: RefCountedPtr.H:66
BaseLevelBackwardEuler & operator=(const BaseLevelBackwardEuler &)
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
void updateSoln(LevelDataType &a_phiNew, LevelDataType &a_phiOld, LevelDataType &a_src, LevelData< FluxDataType > &a_flux, FluxRegisterType *a_fineFluxRegPtr, FluxRegisterType *a_crseFluxRegPtr, const LevelDataType *a_crsePhiOldPtr, const LevelDataType *a_crsePhiNewPtr, Real a_oldTime, Real a_crseOldTime, Real a_crseNewTime, Real a_dt, int a_level, bool a_zeroPhi=true, bool a_rhsAlreadyKappaWeighted=false, int a_fluxStartComponent=0)
Definition: BaseLevelBackwardEuler.H:106
Definition: BaseLevelHeatSolver.H:44
Definition: BaseLevelBackwardEuler.H:45
Definition: DataIterator.H:140
const int SpaceDim
Definition: SPACE.H:39
Structure for passing component ranges in code.
Definition: Interval.H:23
Vector< DisjointBoxLayout > m_grids
The disjoint box layouts at every AMR grid level.
Definition: BaseLevelHeatSolver.H:511
Definition: BoxLayoutData.H:136
virtual ~BaseLevelBackwardEuler()
Destructor, called after destructors of BaseLevelBackwardEuler subclasses.
Definition: BaseLevelBackwardEuler.H:70
double Real
Definition: REAL.H:33
size_t size() const
Definition: Vector.H:177
void timeInterp(LevelDataType &a_data, const LevelDataType &a_oldData, const LevelDataType &a_newData, Real a_time, Real a_oldTime, Real a_newTime, int a_level)
Definition: BaseLevelHeatSolver.H:484
void solveHelm(LevelDataType &a_phi, LevelDataType &a_phiC, LevelDataType &a_rhs, int a_level, Real a_mu, Real a_dt, bool a_zeroPhi=true)
Definition: BaseLevelHeatSolver.H:387
Definition: AMRMultiGrid.H:231
void incrementFlux(LevelData< FluxDataType > &a_diffusiveFlux, LevelDataType &a_phi, int a_level, Real a_mu, Real a_dt, Real a_sign, bool a_setToZero)
Definition: BaseLevelHeatSolver.H:339
Vector< LevelTGAHelmOp< LevelDataType, FluxDataType > *> m_ops
Definition: BaseLevelHeatSolver.H:522