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
00058 class AMRNodeSolver
00059 {
00060 public:
00061
00062 friend class AMRNodeLevelMG;
00063
00065
00067
00071 AMRNodeSolver();
00072
00074
00077 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00078 const Vector<ProblemDomain>& a_domainLevel,
00079 const Vector<Real>& a_dxLevel,
00080 const Vector<int>& a_refRatio,
00081 int a_numLevels,
00082 int a_lBase,
00083 const NodeLevelOp* const a_opin,
00084 int a_minLength = 1);
00085
00086 AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00087 const Vector<Box>& a_domainLevel,
00088 const Vector<Real>& a_dxLevel,
00089 const Vector<int>& a_refRatio,
00090 int a_numLevels,
00091 int a_lBase,
00092 const NodeLevelOp* const a_opin,
00093 int a_minLength = 1);
00094
00096
00098 ~AMRNodeSolver();
00099
00101
00122 void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00123 const Vector<ProblemDomain>& a_domainLevel,
00124 const Vector<Real>& a_dxLevel,
00125 const Vector<int>& a_refRatio,
00126 int a_numLevels,
00127 int a_lBase,
00128 const NodeLevelOp* const a_opin,
00129 int a_minLength = 1);
00130
00131 void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00132 const Vector<Box>& a_domainLevel,
00133 const Vector<Real>& a_dxLevel,
00134 const Vector<int>& a_refRatio,
00135 int a_numLevels,
00136 int a_lBase,
00137 const NodeLevelOp* const a_opin,
00138 int a_minLength = 1);
00139
00141
00143
00145 bool isDefined() const;
00146
00148
00150
00153 void setNumSmoothUp(int a_numSmoothUp);
00154
00156
00159 void setNumSmoothDown(int a_numSmoothDown);
00160
00162
00165 void setNumBottomGSRB(int a_numBottomGSRB);
00166
00168
00170 void setTolerance(Real a_tolerance);
00171
00173
00176 void setBottomSmoothing(bool a_doBottomSmooth);
00177
00179
00181 void setBottomTolerance(Real a_tolerance);
00182
00184
00189 void setOperatorTolerance(Real a_operatorTolerance);
00190
00192
00194 void setMaxIter(int a_maxIter);
00195
00197
00201
00202 void setMinIter(int a_minIter);
00203
00205
00208 void setBottomMaxIter(int a_maxIter);
00209
00211
00213 void setVerbose(bool a_verbose);
00214
00215
00217
00219
00234 void solveAMR(Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00235 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00236
00238
00248 void AMRVCycleMG(Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00249 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00250
00252
00258 Real computeResidualNorm(int a_normType);
00259
00260
00262
00280 void computeAMRResidual(LevelData<NodeFArrayBox>& a_res,
00281 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00282 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel,
00283 int a_ilev);
00284
00286
00300 void applyAMROperator(LevelData<NodeFArrayBox>& a_lofPhi,
00301 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00302 int a_ilev);
00303
00304 protected:
00305
00306
00307 void setDefaultValues();
00308
00309 void clear();
00310
00311
00312 Real m_tolerance;
00313
00314
00315 Real m_operatorTolerance;
00316
00317
00318 int m_lBase;
00319
00320
00321 int m_numLevels;
00322
00323
00324 int m_finestLevel;
00325
00326
00327 Vector<int> m_refRatio;
00328
00329
00330 Vector<Real> m_dxLevel;
00331
00332
00333 Vector<DisjointBoxLayout> m_gridsLevel;
00334
00335
00336 Vector<ProblemDomain> m_domainLevel;
00337
00338
00339 int m_maxIter;
00340
00341
00342
00343 int m_minIter;
00344
00345
00346 int m_numSmoothUp;
00347
00348
00349 int m_numSmoothDown;
00350
00351
00352 int m_numBottomGSRB;
00353
00354
00355 Vector<AMRNodeLevelMG*> m_amrmgLevel;
00356
00357 bool m_isDefined;
00358
00359
00360 LevelNodeSolver m_levelSolver;
00361
00362
00363 bool m_verbose;
00364
00365 private:
00366 AMRNodeSolver(const AMRNodeSolver&);
00367 AMRNodeSolver& operator=(const AMRNodeSolver&);
00368
00369
00370 };
00371 #endif