15 #ifndef _AMRMULTIGRID_H_ 16 #define _AMRMULTIGRID_H_ 28 #include "NamespaceHeader.H" 68 return this->
norm(a_coarResid, 0);
91 virtual void AMRResidual(T& a_residual,
const T& a_phiFine,
const T& a_phi,
92 const T& a_phiCoarse,
const T& a_rhs,
93 bool a_homogeneousDomBC,
101 virtual void AMRResidualNF(T& a_residual,
const T& a_phi,
const T& a_phiCoarse,
102 const T& a_rhs,
bool a_homogeneousBC) = 0;
109 virtual void AMRResidualNC(T& a_residual,
const T& a_phiFine,
const T& a_phi,
110 const T& a_rhs,
bool a_homogeneousBC,
120 const T& a_phiFine,
const T& a_phi,
121 const T& a_phiCoarse,
122 bool a_homogeneousDomBC,
132 const T& a_phiCoarse,
133 bool a_homogeneousBC) = 0;
143 bool a_homogeneousBC,
149 virtual void AMRRestrict(T& a_resCoarse,
const T& a_residual,
const T& a_correction,
150 const T& a_coarseCorrection) = 0;
156 virtual void AMRProlong(T& a_correction,
const T& a_coarseCorrection) = 0;
163 const T& a_coarseCorrection) = 0;
171 const int& a_refRat) = 0;
190 this->
assign(a_lhs, a_rhs);
200 return this->
norm(a_phi, 0);
204 virtual void AMRProlongS(T& a_correction,
const T& a_coarseCorrection,
205 T& a_temp,
const Copier& a_copier)
209 virtual void AMRRestrictS(T& a_resCoarse,
const T& a_residual,
const T& a_correction,
210 const T& a_coarseCorrection, T& scratch)
212 AMRRestrict(a_resCoarse, a_residual, a_correction, a_coarseCorrection);
249 virtual int refToFiner(
const ProblemDomain& a_indexSpace)
const =0;
278 virtual void recordResiduals(
const Vector<T*>& a_residuals,
290 virtual void recordCorrections(
const Vector<T*>& a_corrections,
335 m_inspectors.push_back(a_inspector);
344 int l_max,
int l_base,
bool a_zeroPhi=
true,
345 bool forceHomogeneous =
false);
352 int l_max,
int l_base,
bool a_zeroPhi=
true,
353 bool forceHomogeneous =
false);
358 int l_max,
int l_base,
bool a_zeroPhi=
true,
359 bool forceHomogeneous =
false);
362 int l_max,
int l_base);
364 virtual void AMRVCycle(
Vector<T*>& a_correction,
366 int l,
int l_max,
int l_base);
368 void setMGCycle(
int a_numMG);
371 int l_max,
int l_base);
374 int l_max,
int l_base);
380 int m_pre, m_post, m_bottom, m_numMG;
404 bool a_homogeneousBC=
false,
405 bool a_computeNorm=
true);
422 bool a_homogeneousBC=
false);
448 void setSolverParameters(
const int& a_pre,
452 const int& a_iterMax,
455 const Real& a_normThresh);
464 void setBottomSolver(
int l_max,
int l_base);
466 void setBottomSolverEpsCushion(
Real a_bottomSolverEpsCushion);
470 void relax(T& phi, T& R,
int depth,
int nRelax = 2);
472 void computeAMRResidualLevel(
Vector<T*>& a_resid,
475 int l_max,
int l_base,
int ilev,
476 bool a_homogeneousBC);
515 for (
int ilev = a_lbase; ilev <= a_lmax; ilev++)
519 m_op[a_lbase]->outputAMR(outputData, a_name);
528 const int& a_iterMax,
531 const Real& a_normThresh)
533 m_solverParamsSet =
true;
539 m_normThresh = a_normThresh;
540 m_iterMax = a_iterMax;
541 for (
int img = 0; img < m_mg.size(); img++)
543 m_mg[img]->m_pre = a_pre;
544 m_mg[img]->m_post = a_post;
545 m_mg[img]->m_bottom = a_bottom;
548 m_bottomSolverEpsCushion = 1.0;
555 for (
int iop = 0; iop <
m_op.size(); iop++)
561 for (
int img = 0; img < m_mg.size(); img++)
574 for (
int iop = 0; iop <
m_op.size(); iop++)
588 for (
int img = 0; img < m_mg.size(); img++)
590 retval[img] = m_mg[img]->getAllOperators();
608 m_convergenceMetric(0.),
609 m_bottomSolverEpsCushion(1.0),
610 m_bottomSolver(NULL),
621 for (
int ilev = 0; ilev <
m_op.
size(); ilev++)
623 m_mg[ilev]->m_numMG = a_numMG;
624 m_mg[ilev]->m_cycle = a_numMG;
631 CH_TIME(
"AMRMultiGrid::relax");
634 if (
m_op[depth]->refToCoarser() > 2)
639 int intermediateDepth = 0;
640 int r =
m_op[depth]->refToCoarser();
646 int tmp =
m_mg[depth]->m_depth;
647 m_mg[depth]->m_depth = intermediateDepth;
652 m_mg[depth]->cycle(0, a_correction, a_residual);
653 m_mg[depth]->m_depth = tmp;
659 m_op[depth]->relax(a_correction, a_residual, a_numSmooth);
674 return *(
m_op[level]);
684 bool a_homogeneousBC,
687 CH_TIME(
"AMRMultiGrid::computeAMRResidual");
691 for (
int ilev = l_base; ilev <= l_max; ilev++)
697 l_max, l_base, ilev, a_homogeneousBC);
702 localNorm =
m_op[ilev]->localMaxNorm(*a_resid[ilev]);
707 localNorm =
m_op[ilev]->localMaxNorm(*a_resid[ilev]);
709 const int normType = 0;
711 localNorm =
m_op[ilev]->norm(*a_resid[ilev],normType);
712 rnorm =
Max(localNorm, rnorm);
720 int result = MPI_Allreduce(&rnorm, &recv, 1,
MPI_CH_REAL,
721 MPI_MAX, Chombo_MPI::comm);
722 if (result != MPI_SUCCESS)
725 MayDay::Error(
"sorry, but I had a communcation error on norm");
756 bool a_homogeneousBC)
758 for (
int ilev = l_base; ilev <= l_max; ilev++)
766 for (
int ilev = l_base; ilev <= l_max; ilev++)
768 m_op[ilev]->scale(*a_lph[ilev], -1.);
778 int l_max,
int l_base,
int ilev,
779 bool a_homogeneousBC)
781 CH_TIME(
"AMRMultiGrid<T>::computeAMRResidualLevel");
789 m_op[l_max]->AMRResidualNF(*(a_resid[l_max]), *(a_phi[l_max]),
790 *(a_phi[l_max-1]), *(a_rhs[l_max]),
793 else if (ilev == l_base)
797 m_op[l_base]->AMRResidualNC(*(a_resid[l_base]), *(a_phi[l_base+1]),
798 *(a_phi[l_base]), *(a_rhs[l_base]),
799 a_homogeneousBC,
m_op[l_base+1]);
803 m_op[l_base]->AMRResidual(*a_resid[l_base], *a_phi[l_base+1], *a_phi[l_base],
804 *a_phi[l_base-1], *a_rhs[l_base],
805 a_homogeneousBC,
m_op[l_base+1]);
810 m_op[ilev]->AMRResidual(*a_resid[ilev], *a_phi[ilev+1], *a_phi[ilev],
811 *a_phi[ilev-1], *a_rhs[ilev],
812 a_homogeneousBC,
m_op[ilev+1]);
820 m_op[l_max]->residual(*a_resid[l_max], *a_phi[l_max], *a_rhs[l_max],a_homogeneousBC);
824 m_op[l_max]->AMRResidualNF(*(a_resid[l_max]), *(a_phi[l_max]),
825 *(a_phi[l_max-1]), *(a_rhs[l_max]),
834 int l_max,
int l_base,
bool a_zeroPhi,
835 bool a_forceHomogeneous)
837 CH_TIME(
"AMRMultiGrid::solve");
838 init(a_phi, a_rhs, l_max, l_base);
839 solveNoInit(a_phi, a_rhs, l_max, l_base, a_zeroPhi, a_forceHomogeneous);
841 revert(a_phi, a_rhs, l_max, l_base);
847 int l_max,
int l_base,
bool a_zeroPhi,
848 bool a_forceHomogeneous)
855 for (
int ilev = lowlim; ilev <= l_max; ilev++)
857 uberResidual[ilev] =
new T();
860 m_op[ilev]->create(*uberResidual[ilev], *a_rhs[ilev]);
863 solveNoInitResid(a_phi, uberResidual, a_rhs, l_max, l_base, a_zeroPhi, a_forceHomogeneous);
864 for (
int i = lowlim; i <= l_max; i++)
867 delete uberResidual[i];
874 int l_max,
int l_base,
bool a_zeroPhi,
875 bool a_forceHomogeneous)
878 CH_TIMER(
"AMRMultiGrid::AMRVcycle", vtimer);
892 bool outputIntermediates =
false;
894 for (
int ilev = lowlim; ilev <= l_max; ilev++)
896 uberCorrection[ilev] =
new T();
897 m_op[ilev]->create(*uberCorrection[ilev], *a_phi[ilev]);
900 m_op[ilev]->create(*uberResidual[ilev], *a_rhs[ilev]);
901 m_op[ilev]->setToZero(*(uberResidual[ilev]));
903 m_op[ilev]->setToZero(*(uberCorrection[ilev]));
907 for (
int ilev = l_base; ilev <=l_max; ++ilev)
909 m_op[ilev]->setToZero(*(a_phi[ilev]));
913 Real initial_rnorm = 0;
915 CH_TIME(
"Initial AMR Residual");
916 initial_rnorm=
computeAMRResidual(uberResidual, a_phi, a_rhs, l_max, l_base, a_forceHomogeneous,
true);
924 Real rnorm = initial_rnorm;
925 Real norm_last = 2*initial_rnorm;
933 pout() <<
" AMRMultiGrid:: iteration = " << iter <<
", residual norm = " << rnorm << std::endl;
937 bool goRedu = rnorm > m_eps*initial_rnorm;
939 bool goHang = iter <
m_imin || rnorm <(1-
m_hang)*norm_last;
940 while (goIter && goRedu && goHang && goNorm)
945 m_inspectors[i]->recordResiduals(uberResidual, l_base, l_max, iter);
947 if (outputIntermediates)
949 char strresname[100];
950 sprintf(strresname,
"amrmg.res.iter.%03d", iter);
951 string nameres(strresname);
952 outputAMR(uberResidual, nameres, l_max, l_base);
959 AMRVCycle(uberCorrection, uberResidual, l_max, l_max, l_base);
964 sprintf(charname,
"resid_iter%03d.%dd.hdf5", iter,
SpaceDim);
965 string sname(charname);
969 m_inspectors[i]->recordCorrections(uberCorrection, l_base, l_max, iter);
972 for (
int ilev = l_base; ilev <= l_max; ilev++)
974 if (outputIntermediates)
976 char strcorname[100];
977 sprintf(strcorname,
"amrmg.phi.iter.%03d", iter);
978 string namecor(strcorname);
979 outputAMR(a_phi, namecor, l_max, l_base);
982 m_op[ilev]->incr(*(a_phi[ilev]), *(uberCorrection[ilev]), 1.0);
984 if (outputIntermediates)
986 char strcorname[100];
987 sprintf(strcorname,
"amrmg.cor.iter.%03d", iter);
988 string namecor(strcorname);
989 outputAMR(uberCorrection, namecor, l_max, l_base);
992 m_op[ilev]->setToZero(*(uberCorrection[ilev]));
1000 if (
m_op[0]->orderOfAccuracy()>2)
1002 for (
int ilev=l_max; ilev>l_base; ilev--)
1004 m_op[ilev]->enforceCFConsistency(*a_phi[ilev-1], *a_phi[ilev]);
1010 rnorm =
computeAMRResidual(uberResidual, a_phi, a_rhs, l_max, l_base, a_forceHomogeneous,
true);
1014 pout() <<
" AMRMultiGrid:: iteration = " << iter <<
", residual norm = " << rnorm;
1017 pout() <<
", rate = " << norm_last/rnorm;
1019 pout() << std::endl;
1023 goRedu = rnorm > m_eps*initial_rnorm;
1027 if ((rnorm > 10.*initial_rnorm) && (rnorm > 10.*
m_eps))
1029 pout() <<
"solver seems to have blown up" << endl;
1032 m_exitStatus = int(!goRedu) + int(!goIter)*2 + int(!goHang)*4 + int(!goNorm)*8;
1035 pout() <<
" AMRMultiGrid:: iteration = " << iter <<
", residual norm = " << rnorm << std::endl;
1039 if (!goIter && goRedu && goNorm)
1041 pout() <<
" AMRMultiGrid:: WARNING: Exit because max iteration count exceeded" << std::endl;
1043 if (!goHang && goRedu && goNorm)
1045 pout() <<
" AMRMultiGrid:: WARNING: Exit because of solver hang" << std::endl;
1052 for (
int i = lowlim; i <= l_max; i++)
1055 delete uberCorrection[i];
1062 int l_max,
int l_base)
1064 CH_TIME(
"AMRMultiGrid::relaxOnly");
1067 init(a_phi, a_rhs, l_max, l_base);
1073 for (
int ilev = 0; ilev <
m_op.
size(); ilev++)
1075 uberResidual[ilev] =
new T();
1076 m_op[ilev]->create(*uberResidual[ilev], *a_rhs[ilev]);
1080 m_op[0]->residual(*uberResidual[0], *a_phi[0], *a_rhs[0],
true);
1081 Real initial_rnorm =
m_op[0]->norm(*uberResidual[0], 0);
1082 Real rnorm = initial_rnorm;
1083 Real norm_last = 2*initial_rnorm;
1089 pout() <<
" AMRMultiGrid::relaxOnly iteration = " << iter <<
", residual norm = " << rnorm << std::endl;
1092 bool goRedu = rnorm >
m_eps*initial_rnorm;
1094 bool goHang = iter <
m_imin || rnorm <(1-
m_hang)*norm_last;
1095 while (goIter && goRedu && goHang && goNorm)
1098 m_op[0]->relax(*a_phi[0], *a_rhs[0], 1);
1102 m_op[0]->residual(*uberResidual[0], *a_phi[0], *a_rhs[0],
true);
1103 rnorm =
m_op[0]->norm(*uberResidual[0], 2);
1106 pout() <<
" AMRMultiGrid::relaxOnly iteration = " << iter <<
", residual norm = " << rnorm
1107 <<
", rate = " << norm_last/rnorm << std::endl;
1110 goRedu = rnorm >
m_eps*initial_rnorm;
1115 for (
int i = 0; i <
m_op.
size(); i++)
1118 delete uberResidual[i];
1125 for (
int i = 0; i <
m_op.
size(); i++)
1148 int l_max,
int l_base)
1151 CH_TIME(
"AMRMultiGrid::init");
1154 for (
int i = l_base; i <= l_max; i++)
1164 int intermediateDepth = 0;
1169 intermediateDepth++;
1171 m_mg[i]->m_depth = intermediateDepth;
1173 m_mg[i]->init(*a_phi[i], *a_rhs[i]);
1187 int l_max,
int l_base)
1189 CH_TIME(
"AMRMultiGrid::revert");
1190 for (
int i = l_base; i <= l_max; i++)
1194 m_mg[i]->m_depth =
m_mg[i]->m_defaultDepth;
1203 for (
int ilev = l_base; ilev <= l_max; ilev++)
1221 CH_assert((a_bottomSolverEpsCushion > 0.) &&
1222 (a_bottomSolverEpsCushion <= 1.));
1232 CH_TIME(
"AMRMultiGrid::define");
1240 m_resC. resize( a_maxAMRLevels, NULL);
1246 for (
int i = 0; i < a_maxAMRLevels; i++)
1258 if (i < a_maxAMRLevels-1)
1268 int ilev,
int l_max,
int l_base)
1272 for (
int level = l_base; level <= l_max; level++)
1274 m_op[level]->assignLocal(*
m_residual[level], *a_uberResidual[level]);
1279 if (l_max == l_base)
1282 m_mg[l_base]->oneCycle(*(a_uberCorrection[ilev]), *(a_uberResidual[ilev]));
1284 else if (ilev == l_base)
1305 l_max, l_base, ilev-1,
1313 *(a_uberCorrection[ilev]));
1321 for (
int img = 0; img <
m_numMG; img++)
1323 AMRVCycle(a_uberCorrection, a_uberResidual, ilev-1, l_max, l_base);
1336 T& dCorr = *(a_uberCorrection[ilev]);
1337 m_op[ilev]->setToZero(dCorr);
1349 #include "NamespaceFooter.H" std::ostream & pout()
Use this in place of std::cout for program output.
int m_bottom
Definition: AMRMultiGrid.H:380
virtual AMRLevelOp< T > * AMRnewOp(const ProblemDomain &a_indexSpace)=0
virtual int refToFiner(const ProblemDomain &a_indexSpace) const =0
#define CH_TIMERS(name)
Definition: CH_Timer.H:70
virtual Real AMRNorm(const T &a_coarResid, const T &a_fineResid, const int &a_refRat, const int &a_ord)
Definition: AMRMultiGrid.H:63
bool m_solverParamsSet
Definition: AMRMultiGrid.H:378
A reference-counting handle class.
Definition: RefCountedPtr.H:66
virtual void AMRUpdateResidual(T &a_residual, const T &a_correction, const T &a_coarseCorrection)=0
virtual void AMROperator(T &a_LofPhi, const T &a_phiFine, const T &a_phi, const T &a_phiCoarse, bool a_homogeneousDomBC, AMRLevelOp< T > *a_finerOp)=0
virtual void AMRResidualNC(T &a_residual, const T &a_phiFine, const T &a_phi, const T &a_rhs, bool a_homogeneousBC, AMRLevelOp< T > *a_finerOp)=0
#define CH_assert(cond)
Definition: CHArray.H:37
virtual void buildCopier(Copier &a_copier, const T &a_lhs, const T &a_rhs)
Definition: AMRMultiGrid.H:184
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
void revert(const Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base)
Definition: AMRMultiGrid.H:1186
virtual void define(const ProblemDomain &a_coarseDomain, AMRLevelOpFactory< T > &a_factory, LinearSolver< T > *a_bottomSolver, int a_numLevels)
Definition: AMRMultiGrid.H:1227
virtual ~AMRMultiGridInspector()
Destructor.
Definition: AMRMultiGrid.H:267
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
int m_iterMax
Definition: AMRMultiGrid.H:379
virtual void AMROperatorNF(T &a_LofPhi, const T &a_phi, const T &a_phiCoarse, bool a_homogeneousBC)=0
LinearSolver< T > * m_bottomSolver
Definition: AMRMultiGrid.H:488
AMRLevelOp< T > & levelOp(int level)
Definition: AMRMultiGrid.H:672
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:137
int m_verbosity
Definition: AMRMultiGrid.H:379
virtual void AMRRestrictS(T &a_resCoarse, const T &a_residual, const T &a_correction, const T &a_coarseCorrection, T &scratch)
Definition: AMRMultiGrid.H:209
#define CH_START(tpointer)
Definition: CH_Timer.H:78
Vector< T * > m_residual
Definition: AMRMultiGrid.H:481
AMRMultiGridInspector()
Base class constructor. This must be called by all subclasses.
Definition: AMRMultiGrid.H:262
virtual Real norm(const T &a_rhs, int a_ord)=0
int m_pre
Definition: AMRMultiGrid.H:380
void addInspector(RefCountedPtr< AMRMultiGridInspector< T > > &a_inspector)
Definition: AMRMultiGrid.H:332
Definition: NoOpSolver.H:20
Vector< Copier > m_reverseCopier
Definition: AMRMultiGrid.H:484
virtual void AMRProlongS(T &a_correction, const T &a_coarseCorrection, T &a_temp, const Copier &a_copier)
Definition: AMRMultiGrid.H:204
virtual void createCoarsened(T &a_lhs, const T &a_rhs, const int &a_refRat)=0
Real m_eps
Definition: AMRMultiGrid.H:377
Definition: AMRMultiGrid.H:306
void clear()
Definition: AMRMultiGrid.H:1123
Vector< MultiGrid< T > * > m_mg
Definition: AMRMultiGrid.H:479
void computeAMRResidualLevel(Vector< T *> &a_resid, Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base, int ilev, bool a_homogeneousBC)
Definition: AMRMultiGrid.H:775
Real m_convergenceMetric
Definition: AMRMultiGrid.H:390
virtual void AMRResidualNF(T &a_residual, const T &a_phi, const T &a_phiCoarse, const T &a_rhs, bool a_homogeneousBC)=0
const int SpaceDim
Definition: SPACE.H:39
void append(const Vector< T > &invec)
Definition: Vector.H:307
Definition: AMRMultiGrid.H:35
#define MPI_CH_REAL
Definition: REAL.H:34
virtual void assignCopier(T &a_lhs, const T &a_rhs, const Copier &a_copier)
Definition: AMRMultiGrid.H:188
virtual void setToZero(T &a_lhs)=0
#define CH_TIMER(name, tpointer)
Definition: CH_Timer.H:55
void resize(unsigned int isize)
Definition: Vector.H:323
virtual void dumpStuff(Vector< T *> data, string filename)
Definition: AMRMultiGrid.H:54
Vector< MGLevelOp< T > *> getOperatorsOp()
Definition: AMRMultiGrid.H:571
MGLevelOp & operator=(const MGLevelOp &)
virtual void AMRVCycle(Vector< T *> &a_correction, Vector< T *> &a_residual, int l, int l_max, int l_base)
Definition: AMRMultiGrid.H:1266
virtual void AMRResidual(T &a_residual, const T &a_phiFine, const T &a_phi, const T &a_phiCoarse, const T &a_rhs, bool a_homogeneousDomBC, AMRLevelOp< T > *a_finerOp)=0
int m_numMG
Definition: AMRMultiGrid.H:380
void push_back(const T &in)
Definition: Vector.H:283
void clear()
Definition: Vector.H:165
Vector< MGLevelOp< T > *> getAllOperators()
Definition: AMRMultiGrid.H:552
virtual int refToCoarser()=0
#define CH_TIME(name)
Definition: CH_Timer.H:59
Definition: MultiGrid.H:259
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:741
Real m_bottomSolverEpsCushion
Definition: AMRMultiGrid.H:393
int m_maxDepth
max no. of coarsenings – -1 (default) means coarsen as far as possible
Definition: AMRMultiGrid.H:384
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
virtual void outputAMR(Vector< T *> &a_rhs, string &a_name)
Definition: AMRMultiGrid.H:77
AMRMultiGrid()
Definition: AMRMultiGrid.H:596
Real m_hang
Definition: AMRMultiGrid.H:377
Vector< RefCountedPtr< AMRMultiGridInspector< T > > > m_inspectors
Definition: AMRMultiGrid.H:497
size_t size() const
Definition: Vector.H:177
virtual void AMRRestrict(T &a_resCoarse, const T &a_residual, const T &a_correction, const T &a_coarseCorrection)=0
Vector< T * > m_correction
Definition: AMRMultiGrid.H:480
Vector< T * > m_resC
Definition: AMRMultiGrid.H:482
AMRLevelOp()
Constructor.
Definition: AMRMultiGrid.H:49
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.
virtual void enforceCFConsistency(T &a_coarseCorrection, const T &a_correction)
This routine is for operators with orderOfAccuracy()>2.
Definition: AMRMultiGrid.H:221
Definition: MultiGrid.H:296
virtual void clear(T &a_lhs)
Definition: LinearSolver.H:71
Definition: AMRMultiGrid.H:257
virtual void outputLevel(T &a_rhs, string &a_name)
Definition: AMRMultiGrid.H:72
void outputAMR(Vector< T *> &a_data, string &a_name, int a_lmax, int a_lbase)
Definition: AMRMultiGrid.H:512
int m_exitStatus
Definition: AMRMultiGrid.H:379
ProblemDomain & refine(int a_refinement_ratio)
Refine this problem domain.
virtual void AMROperatorNC(T &a_LofPhi, const T &a_phiFine, const T &a_phi, bool a_homogeneousBC, AMRLevelOp< T > *a_finerOp)=0
virtual void solveNoInitResid(Vector< T *> &a_phi, Vector< T *> &a_finalResid, const Vector< T *> &a_rhs, int l_max, int l_base, bool a_zeroPhi=true, bool forceHomogeneous=false)
use if you want final residual
Definition: AMRMultiGrid.H:872
virtual void create(T &a_lhs, const T &a_rhs)=0
virtual void AMRProlong(T &a_correction, const T &a_coarseCorrection)=0
Definition: LinearSolver.H:158
virtual void relax(T &a_correction, const T &a_residual, int a_iterations)=0
void relax(T &phi, T &R, int depth, int nRelax=2)
Definition: AMRMultiGrid.H:629
int m_post
Definition: AMRMultiGrid.H:380
int m_imin
Definition: AMRMultiGrid.H:379
virtual void solveNoInit(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:845
Real computeAMRResidual(Vector< T *> &a_resid, Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base, bool a_homogeneousBC=false, bool a_computeNorm=true)
Definition: AMRMultiGrid.H:679
void computeAMROperator(Vector< T *> &a_lph, Vector< T *> &a_phi, int l_max, int l_base, bool a_homogeneousBC=false)
Definition: AMRMultiGrid.H:752
#define CH_STOP(tpointer)
Definition: CH_Timer.H:80
Vector< char > m_hasInitBeenCalled
Definition: AMRMultiGrid.H:490
void setSolverParameters(const int &a_pre, const int &a_post, const int &a_bottom, const int &a_numMG, const int &a_iterMax, const Real &a_eps, const Real &a_hang, const Real &a_normThresh)
Definition: AMRMultiGrid.H:524
Vector< Vector< MGLevelOp< T > *> > getOperatorsMG()
Definition: AMRMultiGrid.H:584
T Max(const T &a_a, const T &a_b)
Definition: Misc.H:39
void init(const Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base)
Definition: AMRMultiGrid.H:1147
virtual void assign(T &a_lhs, const T &a_rhs)=0
Vector< Copier > m_resCopier
Definition: AMRMultiGrid.H:483
virtual Real localMaxNorm(const T &a_phi)
Definition: AMRMultiGrid.H:198
MGLevelOp< T > * m_op
Definition: MultiGrid.H:76
virtual void dumpLevel(T &a_data, string name)
Definition: AMRMultiGrid.H:44
Definition: AMRMultiGrid.H:231
NoOpSolver< T > m_nosolve
Definition: AMRMultiGrid.H:486
virtual void dumpAMR(Vector< T *> &a_data, string name)
Definition: AMRMultiGrid.H:40
Real m_normThresh
Definition: AMRMultiGrid.H:377
virtual ~AMRLevelOpFactory()
Definition: AMRMultiGrid.H:234
Vector< AMRLevelOp< T > *> & getAMROperators()
Definition: AMRMultiGrid.H:431
virtual ~AMRLevelOp()
Destructor.
Definition: AMRMultiGrid.H:59
virtual void zeroCovered(T &a_lhs, T &a_rhs, const Copier &a_copier)
Definition: AMRMultiGrid.H:193
void setMGCycle(int a_numMG)
Definition: AMRMultiGrid.H:619
void relaxOnlyHomogeneous(Vector< T *> &a_phi, const Vector< T *> &a_rhs, int l_max, int l_base)
Definition: AMRMultiGrid.H:1061
void setBottomSolverEpsCushion(Real a_bottomSolverEpsCushion)
Definition: AMRMultiGrid.H:1219
virtual unsigned int orderOfAccuracy(void) const
Definition: AMRMultiGrid.H:215
Vector< AMRLevelOp< T > * > m_op
Definition: AMRMultiGrid.H:478
virtual ~AMRMultiGrid()
Definition: AMRMultiGrid.H:665
void setBottomSolver(int l_max, int l_base)
set up bottom solver for internal MG solver
Definition: AMRMultiGrid.H:1200