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 AMRNODELEVELMG_H
00033 #define AMRNODELEVELMG_H
00034
00035 #include <stdlib.h>
00036 #include <iostream>
00037 #include <assert.h>
00038 #include <math.h>
00039 #include "REAL.H"
00040 #include "IntVect.H"
00041 #include "ProblemDomain.H"
00042 #include "NodeFArrayBox.H"
00043 #include "DisjointBoxLayout.H"
00044 #include "LevelData.H"
00045 #include "BaseFab.H"
00046 #include "NodeLevelMG.H"
00047 #include "NodeMGInterp.H"
00048
00049
00050
00051
00052 class AMRNodeSolver;
00053
00055 class AMRNodeLevelMG
00061 {
00062 public:
00063 friend class AMRNodeSolver;
00064
00069
00071
00073 AMRNodeLevelMG();
00074
00076
00079 AMRNodeLevelMG(const AMRNodeSolver* const a_parent,
00080 int a_level,
00081 const NodeLevelOp* const a_opin);
00082
00084
00086 ~AMRNodeLevelMG();
00087
00089
00094 void define(
00095 const AMRNodeSolver* const a_parent,
00097 int a_level,
00099 const NodeLevelOp* const a_opin);
00100
00107
00109
00112 bool isDefined() const;
00113
00115
00117 Real computeResidualNorm(
00118 int a_normType) const;
00119
00126
00128
00131 void setnumSmoothUp(int a_numSmoothUp);
00132
00134
00137 void setnumSmoothDown(int a_numSmoothDown);
00138
00140
00143 void setVerbose(bool a_verbose);
00144
00151
00153
00165 void applyAMROperator(
00166 LevelData<NodeFArrayBox>& a_Lofphi,
00168 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel);
00169
00171
00183 void applyAMRGradient(
00184 LevelData<NodeFArrayBox>& a_gradPhi,
00186 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel);
00187
00189
00195 void computeAMRResidual(
00196 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00198 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00199
00201
00213 void upSweep(
00214 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00216 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00217
00219
00243 void downSweep(
00244 Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00246 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00247
00250 protected:
00251
00254 Real computeNorm(
00255 const LevelData<NodeFArrayBox>& a_mfinput,
00257 int a_normType) const;
00258
00261 void smooth(
00262 LevelData<NodeFArrayBox>& a_phi,
00264 const LevelData<NodeFArrayBox>& a_rhs);
00265
00268 void projectFineInterior(LevelData<NodeFArrayBox>& a_phi,
00269 const LevelData<NodeFArrayBox>& a_phiFine);
00270
00273 void clearMemory();
00274
00277 void setDefaultValues();
00278
00281 const AMRNodeSolver* m_parent;
00282
00285 NodeLevelMG m_levelMG;
00286
00289 NodeMGInterp m_mginterp;
00290
00293 bool m_isDefined;
00294
00297 bool m_verbose;
00298
00301 DisjointBoxLayout m_coarsenedGrids;
00302
00305 LevelData<NodeFArrayBox> m_resid;
00306
00307
00308
00311 LevelData<NodeFArrayBox> m_corr;
00312
00315 LevelData<NodeFArrayBox> m_dcorr;
00316
00319 LevelData<NodeFArrayBox> m_LofPhi;
00320
00323 LevelData<NodeFArrayBox> m_phiSave;
00324
00327 LevelData<NodeFArrayBox> m_residCoarsened;
00328
00331 int m_level;
00332
00335 Real m_dx;
00336
00339 NodeLevelOp* m_levelOpPtr;
00340
00343 NodeCoarseAverage m_averageOp;
00344
00347 ProblemDomain m_domain;
00348
00351 DisjointBoxLayout m_finerGrids;
00352
00355 DisjointBoxLayout m_coarsenedFineGrids;
00356
00359 LayoutData< Vector<IntVectSet> > m_IVSV;
00360
00363 LayoutData< Vector<IntVectSet> > m_IVSVext;
00364
00367 LayoutData< Vector<IntVectSet> > m_IVSVcoarsened;
00368
00371 LayoutData< Vector<IntVectSet> > m_IVSVcoarsenedFine;
00372
00373 private:
00374
00375 AMRNodeLevelMG& operator = (const AMRNodeLevelMG&);
00376 AMRNodeLevelMG(const AMRNodeLevelMG&);
00377
00378 };
00379
00380 #endif