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,
227 int a_numLevels = -1,
228 int a_verbosity = 0);
245 void resetAlphaAndBeta(
const Real& a_alpha,
264 bool a_homogeneousBC);
310 for (
int iop = 0; iop < ops.
size(); iop++)
324 for (
int iop = 0; iop < ops.
size(); iop++)
343 m_verbosity = a_verbosity;
344 m_level0Domain = a_level0Domain;
347 m_numLevels = a_numLevels;
350 m_numLevels = a_refRat.
size();
353 m_ops.resize(m_numLevels);
355 for (
int ilev = 0; ilev < m_numLevels; ilev++)
357 m_ops[ilev] =
dynamic_cast<TGAHelmOp<T>*
>(amrops[ilev]);
358 if (m_ops[ilev]==NULL)
360 MayDay::Error(
"dynamic cast failed---is that operator really a TGAHelmOp?");
365 m_dataCreated =
false;
371 Real tgaEpsilon = 1.e-12;
373 tgaEpsilon = sqrt(tgaEpsilon);
375 Real a = 2.0 - sqrt(2.0) - tgaEpsilon;
376 m_mu1 = (a - sqrt( a*a - 4.0*a + 2.0))/2.0 ;
377 m_mu2 = (a + sqrt( a*a - 4.0*a + 2.0))/2.0 ;
382 pout() <<
" AMRTGA:: epsilon = " << tgaEpsilon << std::endl;
392 m_dataCreated =
true;
393 m_rhst.resize(a_source.
size(), NULL);
394 m_srct.resize(a_source.
size(), NULL);
395 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
397 m_rhst[ilev] =
new T();
398 m_srct[ilev] =
new T();
399 m_ops[ilev]->create(*m_rhst[ilev], *a_source[ilev]);
400 m_ops[ilev]->create(*m_srct[ilev], *a_source[ilev]);
407 for (
int ilev = 0; ilev < m_rhst.size(); ilev++)
409 if (m_rhst[ilev] != NULL)
435 pout() <<
" AMRTGA:: starting mu4 operation" << std::endl;
438 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
440 m_ops[ilev]->setToZero(*m_srct[ilev]);
441 m_ops[ilev]->incr(*m_srct[ilev], *a_source[ilev], 1.0);
444 m_ops[ilev]->divideByIdentityCoef(*m_srct[ilev]);
449 applyHelm(m_rhst, m_srct, a_lbase, a_lmax, m_mu4, a_dt,
true);
451 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
454 m_ops[ilev]->scale( *m_rhst[ilev], a_dt);
459 pout() <<
" AMRTGA:: starting mu3 operation" << std::endl;
466 applyHelm(a_phiNew, a_phiOld, a_lbase, a_lmax, m_mu3, a_dt,
false);
468 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
471 m_ops[ilev]->incr(*m_rhst[ilev], *a_phiNew[ilev], 1.0);
476 pout() <<
" AMRTGA:: starting mu2 operation" << std::endl;
479 setTime(a_told + a_dt*(m_mu2 + m_mu3));
481 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
483 m_ops[ilev]->assignLocal(*a_phiNew[ilev], *a_phiOld[ilev]);
485 solveHelm(a_phiNew, m_rhst, a_lbase, a_lmax, m_mu2, a_dt);
486 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
489 m_ops[ilev]->assignLocal(*m_rhst[ilev], *a_phiNew[ilev]);
493 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
495 m_ops[ilev]->diagonalScale(*m_rhst[ilev]);
500 pout() <<
" AMRTGA:: starting mu1 operation" << std::endl;
505 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
507 m_ops[ilev]->assignLocal(*a_phiNew[ilev], *a_phiOld[ilev]);
509 solveHelm(a_phiNew, m_rhst, a_lbase, a_lmax, m_mu1, a_dt);
520 bool a_homogeneousBC)
522 Real factor = a_mu*a_dt;
524 resetAlphaAndBeta(1.0, factor);
526 m_solver->computeAMROperator(a_ans,
547 Real factor = -a_mu*a_dt;
549 resetAlphaAndBeta(1.0, factor);
551 m_solver->solveNoInit(a_ans,
556 if (m_solver->m_exitStatus==1 && m_verbosity>3)
558 pout() <<
"AMRTGA:: WARNING: solver exitStatus == 1" << std::endl;
562 #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:173
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:141
Vector< T * > m_srct
Definition: AMRTGA.H:283
virtual void diagonalScale(T &a_rhs, bool a_kappaWeighted)
Definition: AMRTGA.H:71
int m_verbosity
Definition: AMRTGA.H:280
Real m_mu4
Definition: AMRTGA.H:279
Vector< TGAHelmOp< T > *> m_ops
Definition: AMRTGA.H:275
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:297
void resetAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: AMRTGA.H:306
Definition: AMRMultiGrid.H:308
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:39
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:420
RefCountedPtr< AMRMultiGrid< T > > m_solver
Definition: AMRTGA.H:278
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:388
bool m_isTimeDependent
Definition: AMRTGA.H:146
void setTime(Real time)
Definition: AMRTGA.H:321
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:209
Vector< T * > m_rhst
Definition: AMRTGA.H:282
LevelTGAHelmOp()
Definition: AMRTGA.H:165
AMRTGA(const AMRTGA< T > &a_opin)
Definition: AMRTGA.H:286
void operator=(const AMRTGA< T > &a_opin)
Definition: AMRTGA.H:291
size_t size() const
Definition: Vector.H:192
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:369
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:277
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
Definition: DataIndex.H:114
ProblemDomain m_level0Domain
Definition: AMRTGA.H:276
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:514
bool m_dataCreated
Definition: AMRTGA.H:281
~AMRTGA()
Definition: AMRTGA.H:405
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:233
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:540
T * m_phonyIdentityCoef
Definition: AMRTGA.H:150