00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014
00015 #ifndef AMRNODESOLVER_H
00016 #define AMRNODESOLVER_H
00017
00018 #include <cstdlib>
00019 #include <cmath>
00020 #include <iostream>
00021 #include "SPACE.H"
00022 #include "REAL.H"
00023 #include "IntVect.H"
00024 #include "ProblemDomain.H"
00025 #include "NodeFArrayBox.H"
00026 #include "Vector.H"
00027 #include "IntVectSet.H"
00028 #include "DisjointBoxLayout.H"
00029 #include "LevelData.H"
00030 #include "AMRNodeLevelMG.H"
00031 #include "LevelNodeSolver.H"
00032
00033 #include "UsingNamespace.H"
00034
00036
00044 class AMRNodeSolver
00045 {
00046 public:
00047
00048 friend class AMRNodeLevelMG;
00049
00054
00056
00060 AMRNodeSolver();
00061
00063
00066 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00067 const Vector<ProblemDomain>& a_domainLevel,
00068 const Vector<Real>& a_dxLevel,
00069 const Vector<int>& a_refRatio,
00070 int a_numLevels,
00071 int a_lBase,
00072 const NodeLevelOp* const a_opin,
00073 int a_minLength = 1);
00074
00076
00079 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00080 const Vector<Box>& a_domainLevel,
00081 const Vector<Real>& a_dxLevel,
00082 const Vector<int>& a_refRatio,
00083 int a_numLevels,
00084 int a_lBase,
00085 const NodeLevelOp* const a_opin,
00086 int a_minLength = 1);
00087
00089
00091 ~AMRNodeSolver();
00092
00094
00100 void define(
00101 const Vector<DisjointBoxLayout>& a_gridsLevel,
00103 const Vector<ProblemDomain>& a_domainLevel,
00105 const Vector<Real>& a_dxLevel,
00107 const Vector<int>& a_refRatio,
00109 int a_numLevels,
00111 int a_lBase,
00113 const NodeLevelOp* const a_opin,
00115 int a_minLength = 1);
00116
00117
00119
00125 void define(
00126 const Vector<DisjointBoxLayout>& a_gridsLevel,
00128 const Vector<Box>& a_domainLevel,
00130 const Vector<Real>& a_dxLevel,
00132 const Vector<int>& a_refRatio,
00134 int a_numLevels,
00136 int a_lBase,
00138 const NodeLevelOp* const a_opin,
00140 int a_minLength = 1);
00141
00148
00150
00152 bool isDefined() const;
00153
00160
00162
00165 void setNumSmoothUp(int a_numSmoothUp);
00166
00168
00171 void setNumSmoothDown(int a_numSmoothDown);
00172
00174
00176 void setTolerance(Real a_tolerance);
00177
00179
00182 void setBottomSmoothing(bool a_doBottomSmooth);
00183
00185
00187 void setBottomTolerance(Real a_tolerance);
00188
00190
00195 void setOperatorTolerance(Real a_operatorTolerance);
00196
00198
00200 void setMaxIter(int a_maxIter);
00201
00203
00207 void setMinIter(int a_minIter);
00208
00210
00213 void setBottomMaxIter(int a_maxIter);
00214
00216
00219 void setVerbose(bool a_verbose);
00220
00221
00228
00230
00240 void solveAMR(
00241 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00243 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00244
00246
00248 void AMRVCycleMG(
00249 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00251 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00252
00254
00261 Real computeResidualNorm(
00262 int a_normType);
00263
00264
00266
00279 void computeAMRResidual(
00280 LevelData<NodeFArrayBox>& a_res,
00282 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00284 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel,
00286 int a_ilev);
00287
00289
00300 void applyAMROperator(
00301 LevelData<NodeFArrayBox>& a_lofPhi,
00303 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00305 int a_ilev);
00306
00308
00319 void applyAMRGradient(
00320 LevelData<NodeFArrayBox>& a_gradPhi,
00322 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00324 int a_ilev);
00325
00328 protected:
00329
00332 void setDefaultValues();
00333
00336 void clear();
00337
00340 Real m_tolerance;
00341
00345 Real m_operatorTolerance;
00346
00349 int m_lBase;
00350
00353 int m_numLevels;
00354
00357 int m_finestLevel;
00358
00361 Vector<int> m_refRatio;
00362
00365 Vector<Real> m_dxLevel;
00366
00369 Vector<DisjointBoxLayout> m_gridsLevel;
00370
00373 Vector<ProblemDomain> m_domainLevel;
00374
00377 int m_maxIter;
00378
00381 int m_minIter;
00382
00385 int m_numSmoothUp;
00386
00389 int m_numSmoothDown;
00390
00393 Vector<AMRNodeLevelMG*> m_amrmgLevel;
00394
00397 bool m_isDefined;
00398
00401 LevelNodeSolver m_levelSolver;
00402
00405 bool m_verbose;
00406
00407 private:
00408 AMRNodeSolver(const AMRNodeSolver&);
00409 AMRNodeSolver& operator=(const AMRNodeSolver&);
00410
00411
00412 };
00413 #endif