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