00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef AMRNODESOLVER_H
00033 #define AMRNODESOLVER_H
00034
00035 #include <cstdlib>
00036 #include <cmath>
00037 #include <iostream>
00038 #include <assert.h>
00039 #include "REAL.H"
00040 #include "IntVect.H"
00041 #include "ProblemDomain.H"
00042 #include "NodeFArrayBox.H"
00043 #include "Vector.H"
00044 #include "IntVectSet.H"
00045 #include "DisjointBoxLayout.H"
00046 #include "LevelData.H"
00047 #include "AMRNodeLevelMG.H"
00048 #include "LevelNodeSolver.H"
00049
00051
00059 class AMRNodeSolver
00060 {
00061 public:
00062
00063 friend class AMRNodeLevelMG;
00064
00069
00071
00075 AMRNodeSolver();
00076
00078
00081 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00082 const Vector<ProblemDomain>& a_domainLevel,
00083 const Vector<Real>& a_dxLevel,
00084 const Vector<int>& a_refRatio,
00085 int a_numLevels,
00086 int a_lBase,
00087 const NodeLevelOp* const a_opin,
00088 int a_minLength = 1);
00089
00091
00094 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00095 const Vector<Box>& a_domainLevel,
00096 const Vector<Real>& a_dxLevel,
00097 const Vector<int>& a_refRatio,
00098 int a_numLevels,
00099 int a_lBase,
00100 const NodeLevelOp* const a_opin,
00101 int a_minLength = 1);
00102
00104
00106 ~AMRNodeSolver();
00107
00109
00115 void define(
00116 const Vector<DisjointBoxLayout>& a_gridsLevel,
00118 const Vector<ProblemDomain>& a_domainLevel,
00120 const Vector<Real>& a_dxLevel,
00122 const Vector<int>& a_refRatio,
00124 int a_numLevels,
00126 int a_lBase,
00128 const NodeLevelOp* const a_opin,
00130 int a_minLength = 1);
00131
00132
00134
00140 void define(
00141 const Vector<DisjointBoxLayout>& a_gridsLevel,
00143 const Vector<Box>& a_domainLevel,
00145 const Vector<Real>& a_dxLevel,
00147 const Vector<int>& a_refRatio,
00149 int a_numLevels,
00151 int a_lBase,
00153 const NodeLevelOp* const a_opin,
00155 int a_minLength = 1);
00156
00163
00165
00167 bool isDefined() const;
00168
00175
00177
00180 void setNumSmoothUp(int a_numSmoothUp);
00181
00183
00186 void setNumSmoothDown(int a_numSmoothDown);
00187
00189
00191 void setTolerance(Real a_tolerance);
00192
00194
00197 void setBottomSmoothing(bool a_doBottomSmooth);
00198
00200
00202 void setBottomTolerance(Real a_tolerance);
00203
00205
00210 void setOperatorTolerance(Real a_operatorTolerance);
00211
00213
00215 void setMaxIter(int a_maxIter);
00216
00218
00222 void setMinIter(int a_minIter);
00223
00225
00228 void setBottomMaxIter(int a_maxIter);
00229
00231
00234 void setVerbose(bool a_verbose);
00235
00236
00243
00245
00255 void solveAMR(
00256 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00258 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00259
00261
00263 void AMRVCycleMG(
00264 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00266 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00267
00269
00276 Real computeResidualNorm(
00277 int a_normType);
00278
00279
00281
00294 void computeAMRResidual(
00295 LevelData<NodeFArrayBox>& a_res,
00297 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00299 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel,
00301 int a_ilev);
00302
00304
00315 void applyAMROperator(
00316 LevelData<NodeFArrayBox>& a_lofPhi,
00318 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00320 int a_ilev);
00321
00323
00334 void applyAMRGradient(
00335 LevelData<NodeFArrayBox>& a_gradPhi,
00337 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00339 int a_ilev);
00340
00343 protected:
00344
00347 void setDefaultValues();
00348
00351 void clear();
00352
00355 Real m_tolerance;
00356
00360 Real m_operatorTolerance;
00361
00364 int m_lBase;
00365
00368 int m_numLevels;
00369
00372 int m_finestLevel;
00373
00376 Vector<int> m_refRatio;
00377
00380 Vector<Real> m_dxLevel;
00381
00384 Vector<DisjointBoxLayout> m_gridsLevel;
00385
00388 Vector<ProblemDomain> m_domainLevel;
00389
00392 int m_maxIter;
00393
00396 int m_minIter;
00397
00400 int m_numSmoothUp;
00401
00404 int m_numSmoothDown;
00405
00408 Vector<AMRNodeLevelMG*> m_amrmgLevel;
00409
00412 bool m_isDefined;
00413
00416 LevelNodeSolver m_levelSolver;
00417
00420 bool m_verbose;
00421
00422 private:
00423 AMRNodeSolver(const AMRNodeSolver&);
00424 AMRNodeSolver& operator=(const AMRNodeSolver&);
00425
00426
00427 };
00428 #endif