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

AMRLevelMG.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 // DTGraves, Tues, July 6, 1999
00028 
00029 #ifndef _AMRLevelMG_H_
00030 #define _AMRLevelMG_H_
00031 
00032 #include <stdlib.h>
00033 #include <iostream>
00034 #include <assert.h>
00035 #include <math.h>
00036 #include "REAL.H"
00037 #include "IntVect.H"
00038 #include "Box.H"
00039 #include "FArrayBox.H"
00040 #include "DisjointBoxLayout.H"
00041 #include "LevelData.H"
00042 #include "LevelFluxRegister.H"
00043 #include "BaseFab.H"
00044 #include "LevelMG.H"
00045 #include "MGInterp.H"
00046 #include "Copier.H"
00047 
00048 //forward declaration of AMRSolver
00049 class AMRSolver;
00050 
00052 
00058 class AMRLevelMG
00059 {
00060 public:    
00061   friend class AMRSolver;
00062 
00064   AMRLevelMG();
00065 
00067   ~AMRLevelMG();
00068 
00070 
00073   AMRLevelMG(const AMRSolver* const a_parent, 
00074              int a_level, 
00075              const LevelOp* const a_opin,
00076              int ncomp=1);
00077 
00079 
00084   void define(const AMRSolver* const a_parent, 
00085               int a_level, 
00086               const LevelOp* const a_opin,
00087               int ncomp=1);
00088 
00090 
00093   void setnumSmoothUp(int a_numSmoothUp);
00094 
00096 
00099   void setnumSmoothDown(int a_numSmoothDown);
00100 
00102 
00108   void applyAMROperator(Vector<LevelData<FArrayBox> *>& a_phiLevel, 
00109                         LevelData<FArrayBox> & Lofphi);
00110 
00111 
00113 
00118   void applyAMROperatorHphys(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00119                              LevelData<FArrayBox>& LofPhi);
00120 
00122 
00126   void computeAMRResidual(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00127                           const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00128 
00129 
00131 
00135   void computeAMRResidualHphys(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00136                                const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00137 
00138 
00140 
00144   void computeAMRResidual(LevelData<FArrayBox>& a_resid,
00145                           Vector<LevelData<FArrayBox>* >& a_phiLevel,
00146                           const Vector<LevelData<FArrayBox>* >& a_rhsLevel);
00147   
00148 
00150 
00154   void upSweep(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00155                const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00156 
00158 
00161   void downSweep(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00162                  const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00163 
00165 
00168   Vector<Real> computeResidualNorm(int normType) const;
00169 
00170   // 
00171   LevelOp* levelOpPtr() const;
00172 
00173 
00175   bool isDefined() const;
00176 
00177 
00178   // returns normType norm of mfab 
00179   Vector<Real>
00180   computeNorm(const LevelData<FArrayBox> & a_mfinput, 
00181               int a_normType) const;
00182 
00183 protected:
00184   //use short v-cycle or levelmg's smoother to reduce
00185   //high wave numbers of residual
00186   void smooth(LevelData<FArrayBox> & a_soln, 
00187               const LevelData<FArrayBox> & rhs);
00188 
00189   //delete internal memory and set pointers to null
00190   void clearMemory();
00191 
00192   //set default values.  does not deal with memory
00193   void setDefaultValues();
00194 
00195   /*
00196     reflux enforces flux-matching from finer levels.
00197     Steps involved:
00198     a)initialize flux register with coarse flux
00199     b)increment flux register with sum of fine fluxes
00200     b)modify solution with flux diffrence
00201   */
00202   void
00203   reflux(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00204          LevelData<FArrayBox> & a_Lofphi);
00205 
00206   /*
00207     Fill fluxregisters with coarse flux
00208   */
00209   void
00210   initFRCoarse(Vector<LevelData<FArrayBox> *>& a_phiLevel);
00211 
00212   /*
00213     increment fluxregisters with fine flux
00214   */
00215   void
00216   incrementFRFine(Vector<LevelData<FArrayBox> *>& a_phiLevel);
00217 
00218   // da boss
00219   const AMRSolver* m_parent;
00220 
00221   // LevelMG level solver object to relax on this level
00222   LevelMG m_levelMG;
00223 
00224   // for interpolation
00225   MGInterp m_mginterp;
00226 
00227   //flux register with next coarser level
00228   LevelFluxRegister m_levfluxreg;
00229 
00230   // has this AMRLevelMG been defined yet?
00231   bool m_isDefined;
00232 
00233   DisjointBoxLayout m_coarsenedGrids;
00234   // residual
00235   LevelData<FArrayBox> m_resid;
00236 
00237   // correction
00238   LevelData<FArrayBox> m_corr;
00239 
00240   // the infamous correction to the correction
00241   LevelData<FArrayBox> m_dcorr;
00242 
00243   // L(phi)
00244   LevelData<FArrayBox> m_lofPhi;
00245 
00246   // extra copy of solution
00247   LevelData<FArrayBox> m_phiSave;
00248 
00249   LevelData<FArrayBox> m_resC;
00250 
00251   // Copier that operates for moving  coarsened residual to 
00252   // coarse level grid space.
00253   Copier m_residualCopier;
00254 
00255   // Copier that's used for exchange on the fine grid data
00256   // before fine flux register data is incremented.
00257   Copier m_fineExchangeCopier;
00258 
00259   //
00260   int m_level;
00261 
00262   //
00263   LevelOp* m_levelopPtr;
00264 
00265   //
00266   CoarseAverage m_averageOp;
00267 
00268   bool m_arrayViewVerbose;
00269 private:
00270   void  setArrayViewVerbose(bool a_verbosity);
00271   AMRLevelMG& operator = (const AMRLevelMG&);
00272   AMRLevelMG(const AMRLevelMG&);
00273 
00274 };
00275 
00276 #endif

Generated on Wed Apr 16 14:26:48 2003 for Chombo by doxygen1.2.16