Chombo + EB  3.0
BaseLevelHeatSolver.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _BASELEVELHEATSOLVER_H__
12 #define _BASELEVELHEATSOLVER_H__
13 
14 #include <iostream>
15 #include <math.h>
16 #include "SPACE.H"
17 #include <stdlib.h>
18 #include <REAL.H>
19 #include <Box.H>
20 #include <DisjointBoxLayout.H>
21 #include <LevelData.H>
22 #include <ProblemDomain.H>
23 #include "AMRTGA.H"
24 #include "NamespaceHeader.H"
25 
26 
27 //! \class BaseLevelHeatSolver
28 //! This base class implements the 2nd-order implicit L0-stable time
29 //! integration algorithm developed by Twizell, Gumel, and Arigu for
30 //! solving elliptic equations. It relies upon linear algebraic operations
31 //! defined in the underlying Helmholtz operators.
32 //! \tparam LevelDataType The type used to store data at a grid level.
33 //! This is usually LevelData<T>, where T is some
34 //! cell-centered FArrayBox type.
35 //! \tparam FluxDataType The type used to store flux data at a grid
36 //! level. This is usually an array box clas that stores
37 //! fluxes.
38 //! \tparam FluxRegisterType The type used to store flux register data for
39 //! interactions between different grid levels.
40 //! This is usually a flux register class.
41 template <class LevelDataType,
42  class FluxDataType,
43  class FluxRegisterType>
45 {
46 
47  public:
48 
49  ///
51  const Vector<int>& a_refRat,
52  const ProblemDomain& a_level0Domain,
54  const RefCountedPtr<AMRMultiGrid<LevelDataType> >& a_solver):
55  m_grids(a_grids),
56  m_refRat(a_refRat),
57  m_level0Domain(a_level0Domain),
58  m_ops(),
59  m_solver(a_solver)
60  {
61  m_ops.resize(a_grids.size());
63 
64  for (int ilev = 0; ilev < m_ops.size(); ilev++)
65  {
66  m_ops[ilev] = dynamic_cast<LevelTGAHelmOp<LevelDataType,FluxDataType>* >(amrops[ilev]);
67  if (m_ops[ilev]==NULL)
68  {
69  MayDay::Error("dynamic cast failed---is that operator really a TGAHelmOp?");
70  }
71  }
72  }
73 
74  //! Destructor, called after destructors of BaseLevelHeatSolver subclasses.
76  {
77  }
78 
79  //! Integrates the helmholtz equation represented by this object, placing
80  //! the new solution in \a a_phiNew.
81  //! \param a_phiNew The new solution (the value of phi at time n + 1) will
82  //! be stored here.
83  //! \param a_phiOld The old solution (the value of phi at time n).
84  //! \param a_src The source term on the right hand side of the Helmholtz
85  //! equation.
86  //! \param a_flux This will store the flux computed at the current grid
87  //! level during the solution of the Helmholtz equation.
88  //! \param a_fineFluxRegPtr A pointer to the flux register representing the
89  //! finer grid level adjacent to this one, or NULL
90  //! if there is no finer grid level.
91  //! \param a_crseFluxRegPtr A pointer to the flux register representing the
92  //! coarser grid level adjacent to this one, or NULL
93  //! if there is no coarser grid level.
94  //! \param a_oldTime The time at the beginning of the integration step at
95  //! the current grid level.
96  //! \param a_crseOldTime The time at the beginning of the integration step
97  //! at the coarser adjacent grid level. This parameter
98  //! is ignored if there is no coarser grid level.
99  //! \param a_crseNewTime The time at the end of the integration step
100  //! at the coarser adjacent grid level. This parameter
101  //! is ignored if there is no coarser grid level.
102  //! \param a_dt The size of the integration step at the current grid level.
103  //! \param a_level The current grid level.
104  //! \param a_zeroPhi If set to true, \a a_phiNew will be set to zero before
105  //! the integration takes place. Otherwise, a_phiNew is
106  //! assumed to be an initial estimate for the solution in
107  //! the iterative linear solve.
108  //! \param a_fluxStartComponent An index identifying the component at which
109  //! flux data begins within \a a_fineFluxRegPtr
110  //! and \a a_crseFluxRegPtr.
111  virtual void updateSoln(LevelDataType& a_phiNew,
112  LevelDataType& a_phiOld,
113  LevelDataType& a_src,
114  LevelData<FluxDataType>& a_flux,
115  FluxRegisterType* a_fineFluxRegPtr,
116  FluxRegisterType* a_crseFluxRegPtr,
117  const LevelDataType* a_crsePhiOldPtr,
118  const LevelDataType* a_crsePhiNewPtr,
119  Real a_oldTime,
120  Real a_crseOldTime,
121  Real a_crseNewTime,
122  Real a_dt,
123  int a_level,
124  bool a_zeroPhi = true,
125  bool a_rhsAlreadyKappaWeighted= false,
126  int a_fluxStartComponent = 0) = 0;
127 
128  ///
129  virtual
130  void updateSoln(LevelDataType& a_phiNew,
131  LevelDataType& a_phiOld,
132  LevelDataType& a_src,
133  FluxRegisterType* a_fineFluxRegPtr,
134  FluxRegisterType* a_crseFluxRegPtr,
135  const LevelDataType* a_crsePhiOldPtr,
136  const LevelDataType* a_crsePhiNewPtr,
137  Real a_oldTime,
138  Real a_crseOldTime,
139  Real a_crseNewTime,
140  Real a_dt,
141  int a_level,
142  bool a_zeroPhi = true,
143  bool a_rhsAlreadyKappaWeighted = false,
144  int a_fluxStartComponent = 0)
145  {
146  MayDay::Error("need to overwrite this function with one that calls with your flux or call more general one");
147  }
148 
149  //! Computes the time-centered diffusion term L(phi). This can be used to
150  //! find contributions to the solution from diffusion. The diffusion term
151  //! is computed by computing a finite difference approximation for d phi/dt
152  //! using the updated and original values of phi and the time step. Most of
153  //! the arguments given here are passed along to updateSoln and retain their
154  //! significance therein.
155  //! \param a_diffusiveTerm The diffusion term L(phi) will be stored here.
156  //! \param a_phiOld The old solution (the value of phi at time n).
157  //! \param a_src The source term on the right hand side of the Helmholtz
158  //! equation (used to fine the new value of phi).
159  //! \param a_fineFluxRegPtr A pointer to the flux register representing the
160  //! finer grid level adjacent to this one, or NULL
161  //! if there is no finer grid level.
162  //! \param a_crseFluxRegPtr A pointer to the flux register representing the
163  //! coarser grid level adjacent to this one, or NULL
164  //! if there is no coarser grid level.
165  //! \param a_crsePhiOldTime A pointer to the value of phi at the beginning
166  //! of the integration step at the coarser grid
167  //! level adjacent to this one, or NULL if there
168  //! is no coarser grid level.
169  //! \param a_crsePhiNewTime A pointer to the value of phi at the end
170  //! of the integration step at the coarser grid
171  //! level adjacent to this one, or NULL if there
172  //! is no coarser grid level.
173  //! \param a_oldTime The time at the beginning of the integration step at
174  //! the current grid level.
175  //! \param a_crseOldTime The time at the beginning of the integration step
176  //! at the coarser adjacent grid level. This parameter
177  //! is ignored if there is no coarser grid level.
178  //! \param a_crseNewTime The time at the end of the integration step
179  //! at the coarser adjacent grid level. This parameter
180  //! is ignored if there is no coarser grid level.
181  //! \param a_dt The size of the integration step at the current grid level.
182  //! \param a_level The current grid level.
183  //! \param a_zeroPhi If set to true, the new value of phi will be set to
184  //! zero before the integration takes place. Otherwise, it
185  //! will be set to the value in \a a_diffusiveTerm.
186  virtual void computeDiffusion(LevelDataType& a_diffusiveTerm,
187  LevelDataType& a_phiOld,
188  LevelDataType& a_src,
189  LevelData<FluxDataType>& a_flux,
190  FluxRegisterType* a_fineFluxRegPtr,
191  FluxRegisterType* a_crseFluxRegPtr,
192  const LevelDataType* a_crsePhiOldPtr,
193  const LevelDataType* a_crsePhiNewPtr,
194  Real a_oldTime,
195  Real a_crseOldTime,
196  Real a_crseNewTime,
197  Real a_dt,
198  int a_level,
199  bool a_zeroPhi = true,
200  bool a_rhsAlreadyKappaWeighted = false
201  )
202  {
203  // The operator has no time-dependent parameters. Life is easier.
204 
205  // first compute updated solution
206  LevelDataType phiNew;
207 
208  m_ops[a_level]->create(phiNew, a_phiOld);
209  m_ops[a_level]->setToZero(phiNew);
210  if (!a_zeroPhi)
211  {
212  m_ops[a_level]->assign(phiNew, a_phiOld);
213  }
214 
215  updateSoln(phiNew, a_phiOld, a_src, a_flux,
216  a_fineFluxRegPtr, a_crseFluxRegPtr,
217  a_crsePhiOldPtr, a_crsePhiNewPtr,
218  a_oldTime, a_crseOldTime,
219  a_crseNewTime, a_dt, a_level, a_zeroPhi, a_rhsAlreadyKappaWeighted);
220 
221  // now subtract everything off to leave us with diffusive term
222  m_ops[a_level]->incr(phiNew, a_phiOld, -1.0);
223  m_ops[a_level]->scale(phiNew, 1.0/a_dt);
224 
225  //now multiply by a if there is an a
226  m_ops[a_level]->diagonalScale(phiNew, false);
227 
228  // and finally, subtract off a_src
229  m_ops[a_level]->incr(phiNew, a_src, -1.0);
230 
231  // what's left should be the time-centered diffusive part of the update
232  m_ops[a_level]->assign(a_diffusiveTerm, phiNew);
233  }
234 
235 
236  ///
237  /**
238  calls set time and calls operator with given alpha and beta
239  */
240  virtual void applyOperator(LevelDataType& a_ans,
241  const LevelDataType& a_phi,
242  const LevelDataType* a_phiC,
243  int a_level,
244  Real a_alpha,
245  Real a_beta,
246  bool a_applyBC)
247  {
248  m_ops[a_level]->setAlphaAndBeta(a_alpha, a_beta);
249 
250  LevelDataType zero;
251  m_ops[a_level]->create(zero, a_ans);
252  m_ops[a_level]->setToZero(zero);
253 
254  // set a_ans = helm(a_phi)
255  // = (I + factor*laplacian)(a_phi)
256  if (a_applyBC)
257  {
258  if ( (a_phiC == NULL) || (a_level==0))
259  {
260  m_ops[a_level]->applyOp(a_ans, a_phi, false);
261  }
262  else
263  {
264  m_ops[a_level]->AMROperatorNF(a_ans, a_phi, *a_phiC, false);
265  }
266  }
267  else
268  {
269  m_ops[a_level]->applyOpNoBoundary(a_ans, a_phi);
270  }
271  }
272 
273 
274  //! Applies the Helmholtz operator to the solution \a a_phi at the given
275  //! grid level. This will set \a a_ans to
276  //! (I + \a a_mu * \a a_dt * L(\a a_phi).
277  //! \param a_ans This will store the value of the Helmholtz operator applied
278  //! to \a a_phi.
279  //! \param a_phi The value of the solution to which the Helmholtz operator
280  //! is applied.
281  //! \param a_phiC A pointer to the value of the solution at the coarser
282  //! adjacent grid level, or NULL if there is no coarser grid
283  //! level.
284  //! \param a_level The grid level at which the Helmholtz operator is applied.
285  //! \param a_mu A number between 0 and 1 that defines the time within the
286  //! integration step at which the Helmholtz operator is evaluated.
287  //! \param a_dt The size of the integration step at the current grid level.
288  //! \param a_applyBC If set to true, inhomogeneous boundary conditions will
289  //! be applied to the Helmholtz operator (both at the domain
290  //! boundary and at the coarse-fine grid interfaces). If
291  //! set to false, homogeneous boundary conditions will
292  //! applied to the Helmholtz operator at these locations.
293  //! protected because not flexible (alpha == 1)
294  void applyHelm(LevelDataType& a_ans,
295  const LevelDataType& a_phi,
296  const LevelDataType* a_phiC,
297  int a_level,
298  Real a_mu,
299  Real a_dt,
300  bool a_homogeneousBC)
301  {
302  // Set the operator's alpha and beta coefficients.
303  Real factor = a_mu*a_dt;
304  m_ops[a_level]->setAlphaAndBeta(1.0, factor);
305 
306  LevelDataType zero;
307  m_ops[a_level]->create(zero, a_ans);
308  m_ops[a_level]->setToZero(zero);
309 
310  // set a_ans = helm(a_phi)
311  // = (I + factor*laplacian)(a_phi)
312  if ( (a_phiC == NULL) || (a_level==0))
313  {
314  m_ops[a_level]->applyOp(a_ans, a_phi, a_homogeneousBC);
315  }
316  else
317  {
318  m_ops[a_level]->AMROperatorNF(a_ans, a_phi, *a_phiC, a_homogeneousBC);
319  }
320  }
321 
322 
323  //! Adds flux contributions from the Helmholtz operator at the current
324  //! grid level.
325  //! \param a_diffusiveFlux The flux to which Helmholtz operator flux
326  //! contributions will be accumulated.
327  //! \param a_phi The solution at the current grid level to which the
328  //! Helmholtz operator is applied in order to evaluate the flux.
329  //! \param a_level The grid level at which the flux is computed.
330  //! \param a_mu A number between 0 and 1 that defines the time within the
331  //! integration step at which the Helmholtz operator is evaluated.
332  //! \param a_dt The size of the integration step at the current grid level.
333  //! \param a_sign A factor applied to the derivative term in the Helmholtz
334  //! equation. This allows the sign to be made positive or
335  //! negative as is necessary for the flux calculation.
336  //! \param a_setToZero If true, \a a_diffusiveFlux will be set to zero before
337  //! the fluxes are accumulated to it. Otherwise, fluxes
338  //! will be added to the existing value.
339  void incrementFlux(LevelData<FluxDataType>& a_diffusiveFlux,
340  LevelDataType& a_phi,
341  int a_level,
342  Real a_mu,
343  Real a_dt,
344  Real a_sign,
345  bool a_setToZero)
346  {
347  Real factor = a_sign*a_dt*a_mu;
348  m_ops[a_level]->setAlphaAndBeta(1.0, factor);
349 
350  // increment flux
351  m_ops[a_level]->fillGrad(a_phi);
352  for (DataIterator dit = a_phi.dataIterator(); dit.ok(); ++dit)
353  {
354  FluxDataType& thisFlux = a_diffusiveFlux[dit];
355  FluxDataType tempFlux;
356  tempFlux.define(thisFlux);
357 
358  tempFlux.setVal(0.0);
359  if (a_setToZero)
360  {
361  thisFlux.setVal(0.0);
362  }
363 
364  m_ops[a_level]->getFlux(tempFlux, a_phi, m_grids[a_level][dit], dit(), 1.0);
365  thisFlux += tempFlux;
366  }
367  }
368 
369  //! Solves the Helmholtz equation
370  //! (I - \a a_mu * \a a_dt * L(\a a_phi) = \a a_rhs
371  //! for \a a_phi. Here it is assumed that a solution \a a_phiC exists
372  //! on a coarser grid level.
373  //! \param a_phi This will store the solution to the Helmholtz equation on
374  //! the given grid level.
375  //! \param a_phiC The value of the solution given at the coarser adjacent
376  //! grid level. If there is no coarser grid level, this
377  //! parameter is ignored.
378  //! \param a_rhs The right hand side of the Helmholtz equation at the given
379  //! grid level.
380  //! \param a_level The grid level at which the Helmholtz equation is solved.
381  //! \param a_mu A number between 0 and 1 that defines the time within the
382  //! integration step at which the Helmholtz operator is evaluated.
383  //! \param a_dt The size of the integration step at the current grid level.
384  //! \param a_zeroPhi If set to true, \a a_phi will be set to zero before
385  //! the (iterative) solve takes place. Otherwise, a_phi is
386  //! assumed to be an initial estimate for the solution.
387  void solveHelm(LevelDataType& a_phi,
388  LevelDataType& a_phiC,
389  LevelDataType& a_rhs,
390  int a_level,
391  Real a_mu,
392  Real a_dt,
393  bool a_zeroPhi = true)
394  {
395  if (a_zeroPhi)
396  {
397  m_ops[a_level]->setToZero(a_phi);
398  }
399  Vector<LevelDataType* > phi(m_grids.size(), NULL);
400  Vector<LevelDataType* > rhs(m_grids.size(), NULL);
401  phi[a_level] = &a_phi;
402  rhs[a_level] = &a_rhs;
403  if (a_level > 0)
404  {
405  phi[a_level-1] = &a_phiC;
406  }
407 
408  Real factor = -a_dt*a_mu;
409  resetSolverAlphaAndBeta(1.0, factor);
410 
411  m_solver->solve(phi, rhs, a_level, a_level, a_zeroPhi);
412  int solverExitStatus = m_solver->m_exitStatus;
413  if (solverExitStatus==2 || solverExitStatus==4 || solverExitStatus==6)
414  {
415  // These status codes correspond to the cases in which
416  // norm is neither small enough nor reduced enough.
417  // Either we've reached the maximum number of iterations,
418  // or we've hung.
419  pout() << "BaseLevelTGA:: WARNING: solver exitStatus == "
420  << solverExitStatus << std::endl;
421  }
422  }
423 
424 
425  //! Sets the alpha and beta parameters in each Helmholtz operator to the
426  //! given values.
427  //! \param a_alpha The identity term coefficient in the Helmholtz operator.
428  //! \param a_beta The coefficient in front of the discrete derivative term
429  //! in the Helmholtz operator.
430  void resetSolverAlphaAndBeta(const Real& a_alpha,
431  const Real& a_beta)
432  {
434  for (int iop = 0; iop < ops.size(); iop++)
435  {
437  dynamic_cast<LevelTGAHelmOp<LevelDataType, FluxDataType>*>(ops[iop]);
438  helmop->setAlphaAndBeta(a_alpha, a_beta);
439  }
440  for (int iop = 0; iop < m_ops.size(); iop++)
441  {
442  m_ops[iop]->setAlphaAndBeta(a_alpha, a_beta);
443  }
444  }
445 
446 
447  //! Creates a new Helmholtz operator for use by the TGA integrator.
448  //! \param a_indexSpace The ProblemDomain on which the new operator is
449  //! defined.
450  //! \param a_opFact A factory typename LevelDataTypehat generates new Helmholtz operators.
451  //! \returns A pointer to a newly-allocated LevelTGAHelmOp instance.
453  newOp(const ProblemDomain& a_indexSpace,
455  {
457  dynamic_cast<LevelTGAHelmOp<LevelDataType, FluxDataType>*>(a_opFact->AMRnewOp(a_indexSpace));
458 
459  return retval;
460  }
461 
462  //! Returns the number of grid levels on which this integrator operates.
463  int size() const
464  {
465  return m_grids.size();
466  }
467 
468 protected:
469 
470  //! Interpolates a given quantity linearly in time using its beginning- and
471  //! end-of-step values and placing the result in \a a_data.
472  //! \param a_oldData The value of the quantity at the beginning of the time
473  //! step at the grid level identified by \a a_level.
474  //! \param a_newData The value of the quantity at the end of the time
475  //! step at the grid level identified by \a a_level.
476  //! \param a_time The time at which the quantity is to be interpolated
477  //! within the integration step.
478  //! \param a_oldTime The beginning of the integration step at the grid level
479  //! identified by \a a_level.
480  //! \param a_newTime The end of the integration step at the grid level
481  //! identified by \a a_level.
482  //! \param a_level An index identifying the grid level at which the
483  //! interpolation takes place.
484  void timeInterp(LevelDataType& a_data,
485  const LevelDataType& a_oldData,
486  const LevelDataType& a_newData,
487  Real a_time,
488  Real a_oldTime,
489  Real a_newTime,
490  int a_level)
491  {
492  Real eps = 1.0e-10;
493  CH_assert(a_newTime >= a_oldTime);
494  Real diff = (a_newTime - a_oldTime);
495  this->m_ops[a_level]->setToZero(a_data);
496  if (diff < eps)
497  {
498  //no real time advance and don't want to divide by zero
499  this->m_ops[a_level]->incr(a_data, a_oldData, 1.0);
500  }
501  else
502  {
503  Real factor = (a_time-a_oldTime)/(a_newTime - a_oldTime);
504  this->m_ops[a_level]->incr(a_data, a_oldData, 1.0-factor);
505  this->m_ops[a_level]->incr(a_data, a_newData, factor);
506  }
507  }
508 
509 
510  //! The disjoint box layouts at every AMR grid level.
512 
513  //! The refinement ratios between AMR grid levels.
515 
516  //! The coarsest domain on which the Helmholtz equation is integrated.
518 
519  //! An array of the solver's Helmholtz operators at each grid level,
520  //! casted to LevelTGAHelmOp instances. These are owned by the solver,
521  //! so we shouldn't delete these.
523 
524  //! The multigrid solver used to solve the Helmholtz equation.
526 
527 
528 
529 };
530 
531 #include "NamespaceFooter.H"
532 #endif
std::ostream & pout()
Use this in place of std::cout for program output.
ProblemDomain m_level0Domain
The coarsest domain on which the Helmholtz equation is integrated.
Definition: BaseLevelHeatSolver.H:517
A reference-counting handle class.
Definition: RefCountedPtr.H:66
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
virtual ~BaseLevelHeatSolver()
Destructor, called after destructors of BaseLevelHeatSolver subclasses.
Definition: BaseLevelHeatSolver.H:75
Definition: BaseLevelHeatSolver.H:44
virtual void solve(Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base, bool a_zeroPhi=true, bool forceHomogeneous=false)
Definition: AMRMultiGrid.H:833
virtual void applyOperator(LevelDataType &a_ans, const LevelDataType &a_phi, const LevelDataType *a_phiC, int a_level, Real a_alpha, Real a_beta, bool a_applyBC)
Definition: BaseLevelHeatSolver.H:240
virtual LevelTGAHelmOp< LevelDataType, FluxDataType > * newOp(const ProblemDomain &a_indexSpace, RefCountedPtr< AMRLevelOpFactory< LevelDataType > > &a_opFact)
Definition: BaseLevelHeatSolver.H:453
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:110
Definition: DataIterator.H:140
RefCountedPtr< AMRMultiGrid< LevelDataType > > m_solver
The multigrid solver used to solve the Helmholtz equation.
Definition: BaseLevelHeatSolver.H:525
void applyHelm(LevelDataType &a_ans, const LevelDataType &a_phi, const LevelDataType *a_phiC, int a_level, Real a_mu, Real a_dt, bool a_homogeneousBC)
Definition: BaseLevelHeatSolver.H:294
virtual void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta)=0
int size() const
Returns the number of grid levels on which this integrator operates.
Definition: BaseLevelHeatSolver.H:463
void resize(unsigned int isize)
Definition: Vector.H:323
virtual void computeDiffusion(LevelDataType &a_diffusiveTerm, 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)
Definition: BaseLevelHeatSolver.H:186
virtual void updateSoln(LevelDataType &a_phiNew, LevelDataType &a_phiOld, LevelDataType &a_src, 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: BaseLevelHeatSolver.H:130
Vector< MGLevelOp< T > *> getAllOperators()
Definition: AMRMultiGrid.H:552
Vector< DisjointBoxLayout > m_grids
The disjoint box layouts at every AMR grid level.
Definition: BaseLevelHeatSolver.H:511
Definition: BoxLayoutData.H:136
Vector< T > & assign(const T &inval)
assign a scalar to every element of the vector
Definition: Vector.H:138
double Real
Definition: REAL.H:33
virtual void define(const DisjointBoxLayout &dp, int comps, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
Definition: LevelDataI.H:70
size_t size() const
Definition: Vector.H:177
BaseLevelHeatSolver(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: BaseLevelHeatSolver.H:50
virtual 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)=0
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
void resetSolverAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: BaseLevelHeatSolver.H:430
int m_exitStatus
Definition: AMRMultiGrid.H:379
Vector< int > m_refRat
The refinement ratios between AMR grid levels.
Definition: BaseLevelHeatSolver.H:514
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: AMRTGA.H:159
Definition: AMRMultiGrid.H:231
Vector< AMRLevelOp< T > *> & getAMROperators()
Definition: AMRMultiGrid.H:431
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