22 #include "NamespaceHeader.H" 62 const Real& a_beta) = 0;
73 MayDay::Error(
"Two argument version of diagonalScale called but not implemented!");
120 setTime(a_oldTime + a_mu * a_dt);
132 MayDay::Error(
"Access to identity coefficient not allowed for this operator");
158 template <
class T,
class TFlux>
187 virtual void fillGrad(
const T& a_phi) = 0;
190 virtual void getFlux(TFlux& a_flux,
229 int a_numLevels = -1,
230 int a_verbosity = 0);
248 void resetAlphaAndBeta(
const Real& a_alpha,
267 bool a_homogeneousBC);
317 for (
int iop = 0; iop < ops.
size(); iop++)
331 for (
int iop = 0; iop < ops.
size(); iop++)
350 m_verbosity = a_verbosity;
351 m_level0Domain = a_level0Domain;
354 m_numLevels = a_numLevels;
357 m_numLevels = a_refRat.
size();
360 m_ops.resize(m_numLevels);
362 for (
int ilev = 0; ilev < m_numLevels; ilev++)
364 m_ops[ilev] =
dynamic_cast<TGAHelmOp<T>*
>(amrops[ilev]);
365 if (m_ops[ilev]==NULL)
367 MayDay::Error(
"dynamic cast failed---is that operator really a TGAHelmOp?");
372 m_dataCreated =
false;
378 Real tgaEpsilon = 1.e-12;
380 tgaEpsilon = sqrt(tgaEpsilon);
382 Real a = 2.0 - sqrt(2.0) - tgaEpsilon;
383 m_mu1 = (a - sqrt( a*a - 4.0*a + 2.0))/2.0 ;
384 m_mu2 = (a + sqrt( a*a - 4.0*a + 2.0))/2.0 ;
389 pout() <<
" AMRTGA:: epsilon = " << tgaEpsilon << std::endl;
399 m_dataCreated =
true;
400 m_rhst.resize(a_source.
size(), NULL);
401 m_srct.resize(a_source.
size(), NULL);
402 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
404 m_rhst[ilev] =
new T();
405 m_srct[ilev] =
new T();
406 m_ops[ilev]->create(*m_rhst[ilev], *a_source[ilev]);
407 m_ops[ilev]->create(*m_srct[ilev], *a_source[ilev]);
414 for (
int ilev = 0; ilev < m_rhst.size(); ilev++)
416 if (m_rhst[ilev] != NULL)
442 pout() <<
" AMRTGA:: starting mu4 operation" << std::endl;
445 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
447 m_ops[ilev]->setToZero(*m_srct[ilev]);
448 m_ops[ilev]->incr(*m_srct[ilev], *a_source[ilev], 1.0);
451 m_ops[ilev]->divideByIdentityCoef(*m_srct[ilev]);
456 applyHelm(m_rhst, m_srct, a_lbase, a_lmax, m_mu4, a_dt,
true);
458 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
461 m_ops[ilev]->scale( *m_rhst[ilev], a_dt);
466 pout() <<
" AMRTGA:: starting mu3 operation" << std::endl;
471 applyHelm(a_phiNew, a_phiOld, a_lbase, a_lmax, m_mu3, a_dt,
false);
475 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
478 m_ops[ilev]->incr(*m_rhst[ilev], *a_phiNew[ilev], 1.0);
483 pout() <<
" AMRTGA:: starting mu2 operation" << std::endl;
486 setTime(a_told + a_dt*(m_mu2 + m_mu3));
488 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
490 m_ops[ilev]->assign(*a_phiNew[ilev], *a_phiOld[ilev]);
492 solveHelm(a_phiNew, m_rhst, a_lbase, a_lmax, m_mu2, a_dt);
493 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
496 m_ops[ilev]->assign(*m_rhst[ilev], *a_phiNew[ilev]);
500 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
502 m_ops[ilev]->diagonalScale(*m_rhst[ilev]);
507 pout() <<
" AMRTGA:: starting mu1 operation" << std::endl;
512 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
514 m_ops[ilev]->assign(*a_phiNew[ilev], *a_phiOld[ilev]);
516 solveHelm(a_phiNew, m_rhst, a_lbase, a_lmax, m_mu1, a_dt);
527 bool a_homogeneousBC)
529 Real factor = a_mu*a_dt;
531 resetAlphaAndBeta(1.0, factor);
533 m_solver->computeAMROperator(a_ans,
554 Real factor = -a_mu*a_dt;
556 resetAlphaAndBeta(1.0, factor);
558 m_solver->solveNoInit(a_ans,
563 if (m_solver->m_exitStatus==1 && m_verbosity>3)
565 pout() <<
"AMRTGA:: WARNING: solver exitStatus == 1" << std::endl;
569 #include "NamespaceFooter.H" LevelTGAHelmOp(bool a_isTimeIndependent)
Definition: AMRTGA.H:174
std::ostream & pout()
Use this in place of std::cout for program output.
virtual AMRLevelOp< T > * AMRnewOp(const ProblemDomain &a_indexSpace)=0
A reference-counting handle class.
Definition: RefCountedPtr.H:66
TGAHelmOp & operator=(const TGAHelmOp &)
virtual void kappaScale(T &a_rhs)
for eb only. kappa weight the rhs but do not multiply by the identity coefficient ...
Definition: AMRTGA.H:77
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Vector< T * > m_srct
Definition: AMRTGA.H:288
virtual void diagonalScale(T &a_rhs, bool a_kappaWeighted)
Definition: AMRTGA.H:71
int m_verbosity
Definition: AMRTGA.H:285
Real m_mu4
Definition: AMRTGA.H:284
Vector< TGAHelmOp< T > *> m_ops
Definition: AMRTGA.H:280
TGAHelmOp()
Definition: AMRTGA.H:37
virtual void setTime(Real a_time)
Definition: AMRTGA.H:105
AMRTGA()
weak construction is bad. Ref Counted pointers are your friends.
Definition: AMRTGA.H:302
void resetAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: AMRTGA.H:313
Definition: AMRMultiGrid.H:306
virtual void diagonalScale(T &a_rhs)
Definition: AMRTGA.H:86
virtual void divideByIdentityCoef(T &a_rhs)=0
virtual void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta)=0
Definition: AMRMultiGrid.H:35
void oneStep(Vector< T *> &a_phiNew, Vector< T *> &a_phiOld, Vector< T *> &a_source, const Real &a_dt, int a_lbase, int a_lmax, Real a_timeOld=0)
Definition: AMRTGA.H:427
RefCountedPtr< AMRMultiGrid< T > > m_solver
Definition: AMRTGA.H:283
bool isTimeDependent() const
Returns true if the operator is time-dependent, false otherwise.
Definition: AMRTGA.H:124
virtual ~LevelTGAHelmOp()
Destructor.
Definition: AMRTGA.H:180
void createData(Vector< T * > &a_source, int a_lbase, int a_lmax)
Definition: AMRTGA.H:395
bool m_isTimeDependent
Definition: AMRTGA.H:146
void setTime(Real time)
Definition: AMRTGA.H:328
virtual void applyOpNoBoundary(T &a_ans, const T &a_phi)=0
double Real
Definition: REAL.H:33
TGAHelmOp< T > * newOp(const ProblemDomain &a_indexSpace, const AMRLevelOpFactory< T > &a_opFact)
Definition: AMRTGA.H:211
Vector< T * > m_rhst
Definition: AMRTGA.H:287
LevelTGAHelmOp()
Definition: AMRTGA.H:165
AMRTGA(const AMRTGA< T > &a_opin)
Definition: AMRTGA.H:291
void operator=(const AMRTGA< T > &a_opin)
Definition: AMRTGA.H:296
size_t size() const
Definition: Vector.H:177
TGAHelmOp(bool a_isTimeDependent)
Definition: AMRTGA.H:47
void createData(hid_t &a_dataset, hid_t &a_dataspace, HDF5Handle &handle, const std::string &name, hid_t type, hsize_t size)
void setMu()
Definition: AMRTGA.H:376
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.
Vector< int > m_refRat
Definition: AMRTGA.H:282
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Definition: DataIndex.H:112
ProblemDomain m_level0Domain
Definition: AMRTGA.H:281
void applyHelm(Vector< T *> &a_ans, Vector< T *> &a_source, int a_lbase, int a_lmax, Real a_mu, Real a_dt, bool a_homogeneousBC)
Definition: AMRTGA.H:521
bool m_dataCreated
Definition: AMRTGA.H:286
~AMRTGA()
Definition: AMRTGA.H:412
virtual T & identityCoef()
Allows access to the identity coefficient data for the operator.
Definition: AMRTGA.H:130
virtual void setTime(Real a_oldTime, Real a_mu, Real a_dt)
Definition: AMRTGA.H:118
Definition: AMRMultiGrid.H:231
virtual ~TGAHelmOp()
Destructor.
Definition: AMRTGA.H:54
void solveHelm(Vector< T *> &a_ans, Vector< T *> &a_rhs, int a_lbase, int a_lmax, Real a_mu, Real a_dt)
Definition: AMRTGA.H:547
T * m_phonyIdentityCoef
Definition: AMRTGA.H:150