Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AMRNodeLevelMG.H

Go to the documentation of this file.
00001 /*  _______              __
00002    / ___/ /  ___  __ _  / /  ___
00003   / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004   \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 // AMRNodeLevelMG.H
00029 // adapted from AMRLevelMG by DTGraves, Tues, July 6, 1999
00030 // petermc, Tues, Nov 28, 2000
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 // forward declaration of AMRNodeSolver
00050 // C++ism:  don't need to #include AMRNodeSolver.H unless you have
00051 // a data field that's an AMRNodeSolver
00052 class AMRNodeSolver;
00053 
00055 class AMRNodeLevelMG
00061 {
00062 public:    
00063   friend class AMRNodeSolver;
00064 
00066 
00068 
00070   AMRNodeLevelMG();
00071 
00073 
00076   AMRNodeLevelMG(const AMRNodeSolver* const a_parent, 
00077                  int a_level, 
00078                  const NodeLevelOp* const a_opin);
00079 
00081 
00083   ~AMRNodeLevelMG();
00084 
00086 
00095   void define(const AMRNodeSolver* const a_parent, 
00096               int a_level, 
00097               const NodeLevelOp* const a_opin);
00098 
00100               
00102 
00105   bool isDefined() const;
00106 
00108 
00113   Real computeResidualNorm(int a_normType) const;
00114   
00116 
00118 
00121   void setnumSmoothUp(int a_numSmoothUp);
00122 
00124 
00127   void setnumSmoothDown(int a_numSmoothDown);
00128 
00130 
00133   void setnumBottomGSRB(int a_numBottomGSRB);
00134 
00136 
00138   void setVerbose(bool a_verbose);
00139 
00141 
00143 
00160   void applyAMROperator(LevelData<NodeFArrayBox>& a_Lofphi,
00161                         Vector<LevelData<NodeFArrayBox> *>& a_phiLevel);
00162   
00164 
00182   void computeAMRResidual(Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00183                           const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00184 
00186 
00203   void upSweep(Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00204                const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00205 
00207 
00229   void downSweep(Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00230                  const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00231 
00232 protected:
00233 
00234   // returns normType norm of mfab 
00235   Real computeNorm(const LevelData<NodeFArrayBox>& a_mfinput, 
00236                    int a_normType) const;
00237 
00238   //use short V-cycle or NodeLevelMG's smoother to reduce
00239   //high wave numbers of residual
00240   void smooth(LevelData<NodeFArrayBox>& a_phi,
00241               const LevelData<NodeFArrayBox>& a_rhs);
00242 
00243   // project phiFine at coarse interior nodes to phi.
00244   void projectFineInterior(LevelData<NodeFArrayBox>& a_phi,
00245                            const LevelData<NodeFArrayBox>& a_phiFine);
00246 
00247   //delete internal memory and set pointers to null
00248   void clearMemory();
00249 
00250   //set default values.  does not deal with memory
00251   void setDefaultValues();
00252 
00253   // da boss
00254   const AMRNodeSolver* m_parent;
00255 
00256   // NodeLevelMG level solver object to relax on this level
00257   NodeLevelMG m_levelMG;
00258 
00259   // for interpolation
00260   NodeMGInterp m_mginterp;
00261 
00262   // has this AMRNodeLevelMG been defined yet?
00263   bool m_isDefined;
00264 
00265   bool m_verbose;
00266 
00267   // the grids at this level, coarsened
00268   DisjointBoxLayout m_coarsenedGrids;
00269 
00270   // residual
00271   LevelData<NodeFArrayBox> m_resid;
00272 
00273   // residual
00274   LevelData<NodeFArrayBox> m_residInterior;
00275 
00276   // correction
00277   LevelData<NodeFArrayBox> m_corr;
00278 
00279   // the infamous correction to the correction
00280   LevelData<NodeFArrayBox> m_dcorr;
00281 
00282   // L(phi)
00283   LevelData<NodeFArrayBox> m_LofPhi;
00284 
00285   // extra copy of solution
00286   LevelData<NodeFArrayBox> m_phiSave;
00287 
00288   // coarsened residual, on m_coarsenedGrids
00289   LevelData<NodeFArrayBox> m_residCoarsened;
00290 
00291   //
00292   int m_level;
00293 
00294   // mesh spacing
00295   Real m_dx;
00296 
00297   //
00298   NodeLevelOp* m_levelOpPtr;
00299 
00300   //
00301   NodeCoarseAverage m_averageOp;
00302 
00303   // physical domain at this level
00304   ProblemDomain m_domain;
00305 
00306   // the grids at the next finer level
00307   DisjointBoxLayout m_finerGrids;
00308 
00309   // the grids at the next finer level, coarsened
00310   DisjointBoxLayout m_coarsenedFineGrids;
00311 
00312   // interior boundary nodes of grids at this level
00313   LayoutData< Vector<IntVectSet> > m_IVSV;
00314 
00315   LayoutData< Vector<IntVectSet> > m_IVSVext;
00316 
00317   // interior boundary nodes of the coarsened grids at this level
00318   LayoutData< Vector<IntVectSet> > m_IVSVcoarsened;
00319 
00320   // interior boundary nodes of the coarsened grids at next finer level
00321   LayoutData< Vector<IntVectSet> > m_IVSVcoarsenedFine;
00322 
00323 private:
00324 
00325   AMRNodeLevelMG& operator = (const AMRNodeLevelMG&);
00326   AMRNodeLevelMG(const AMRNodeLevelMG&);
00327 
00328 };
00329 
00330 #endif

Generated on Tue Apr 15 18:34:51 2003 for AMRNodeElliptic by doxygen1.2.16