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

GenAMRLevelMG.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 _GENAMRLEVELMG_H_
00030 #define _GENAMRLEVELMG_H_
00031 
00032 #include <stdlib.h>
00033 #include <iostream>
00034 #include <assert.h>
00035 #include <math.h>
00036 
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "DisjointBoxLayout.H"
00041 #include "LevelFluxRegister.H"
00042 #include "BaseFab.H"
00043 #include "Copier.H"
00044 #include "CoarseAverage.H"
00045 
00046 #include "GenMGInterp.H"
00047 #include "GenAMRLevelMGOp.H"
00048 #include "GenLevelMG.H"
00049 
00050 template <class T> class GenAMRSolver;
00051 
00053 
00059 template <class T> class GenAMRLevelMG
00060 {
00061 public:
00062   friend class GenAMRSolver<T>;
00063 
00065   GenAMRLevelMG();
00066 
00068 
00071   GenAMRLevelMG(const GenAMRSolver<T>* const    a_parent,
00072                 int                             a_level,
00073                 const GenAMRLevelMGOp<T>* const a_opin,
00074                 int                             a_ncomp = 1);
00075 
00077   ~GenAMRLevelMG();
00078 
00080   bool isDefined() const;
00081 
00083 
00088   void define(const GenAMRSolver<T>* const    a_parent,
00089               int                             a_level,
00090               const GenAMRLevelMGOp<T>* const a_opin,
00091               int                             a_ncomp = 1);
00092 
00094 
00097   void setnumSmoothUp(int a_numSmoothUp);
00098 
00100 
00103   void setnumSmoothDown(int a_numSmoothDown);
00104 
00106 
00112   void applyAMROperator(Vector<T *>& a_phiLevel,
00113                         T&           a_LOfPhi);
00114 
00116 
00121   void applyAMROperatorHphys(Vector<T *>& a_phiLevel,
00122                              T&           a_LOfPhi);
00123 
00125 
00129   void computeAMRResidual(Vector<T *>&       a_phiLevel,
00130                           const Vector<T *>& a_rhsLevel);
00131 
00133 
00137   void computeAMRResidual(T&                 a_resid,
00138                           Vector<T* >&       a_phiLevel,
00139                           const Vector<T* >& a_rhsLevel);
00140 
00142 
00146   void computeAMRResidualHphys(Vector<T *>&       a_phiLevel,
00147                                const Vector<T *>& a_rhsLevel);
00148 
00150 
00153   void upSweep(Vector<T *>&       a_phiLevel,
00154                const Vector<T *>& a_rhsLevel);
00155 
00157 
00160   void downSweep(Vector<T *>&       a_phiLevel,
00161                  const Vector<T *>& a_rhsLevel);
00162 
00164 
00167   Vector<Real> computeResidualNorm(int a_normType) const;
00168 
00169   //
00170   GenAMRLevelMGOp<T>* levelOpPtr() const;
00171 
00172   // returns normType norm of mfab
00173   Vector<Real> computeNorm(const T & a_mfinput,
00174                            int       a_normType) const;
00175 
00176 protected:
00177   // use short v-cycle or levelmg's smoother to reduce
00178   // high wave numbers of residual
00179   void smooth(T&       a_soln,
00180               const T& a_rhs);
00181 
00182   // delete internal memory and set pointers to null
00183   void clearMemory();
00184 
00185   // set default values.  does not deal with memory
00186   void setDefaultValues();
00187 
00188   /*
00189     reflux enforces flux-matching from finer levels.
00190     Steps involved:
00191     a)initialize flux register with coarse flux
00192     b)increment flux register with sum of fine fluxes
00193     b)modify solution with flux diffrence
00194   */
00195   void reflux(Vector<T *>& a_phiLevel,
00196               T&           a_LOfPhi);
00197 
00198   /*
00199     Fill fluxregisters with coarse flux
00200   */
00201   void initFRCoarse(Vector<T *>& a_phiLevel);
00202 
00203   /*
00204     increment fluxregisters with fine flux
00205   */
00206   void incrementFRFine(Vector<T *>& a_phiLevel);
00207 
00208   // da boss
00209   const GenAMRSolver<T>* m_parent;
00210 
00211   // LevelMG level solver object to relax on this level
00212   GenLevelMG<T> m_levelMG;
00213 
00214   // for interpolation
00215   GenMGInterp<T> m_mginterp;
00216 
00217   // flux register with next coarser level
00218   LevelFluxRegister m_levfluxreg;
00219 
00220   // has this GenAMRLevelMG been defined yet?
00221   bool m_isDefined;
00222 
00223   DisjointBoxLayout m_coarsenedGrids;
00224   // residual
00225   T m_resid;
00226 
00227   // correction
00228   T m_corr;
00229 
00230   // the infamous correction to the correction
00231   T m_dcorr;
00232 
00233   // L(phi)
00234   T m_lofPhi;
00235 
00236   // extra copy of solution
00237   T m_phiSave;
00238 
00239   T m_resC;
00240 
00241   // Copier that operates for moving  coarsened residual to
00242   // coarse level grid space.
00243   Copier m_residualCopier;
00244 
00245   // Copier that's used for exchange on the fine grid data
00246   // before fine flux register data is incremented.
00247   Copier m_fineExchangeCopier;
00248 
00249   //
00250   int m_level;
00251 
00252   //
00253   GenAMRLevelMGOp<T>* m_levelopPtr;
00254 
00255   //
00256   CoarseAverage m_averageOp;
00257 
00258   bool m_arrayViewVerbose;
00259 
00260 private:
00261   void setArrayViewVerbose(bool a_verbosity);
00262 
00263   GenAMRLevelMG<T>(const GenAMRLevelMG<T>&) {};
00264   void operator= (const GenAMRLevelMG<T>&) {};
00265 };
00266 
00267 #include "GenAMRLevelMGImplem.H"
00268 
00269 #endif

Generated on Wed Apr 16 14:31:04 2003 for EBChombo by doxygen1.2.16