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 protected:
00178 
00179   // returns normType norm of mfab 
00180   Vector<Real>
00181   computeNorm(const LevelData<FArrayBox> & a_mfinput, 
00182               int a_normType) const;
00183 
00184   /*  correct the input a_soln with a_crseCorr */
00185   void 
00186   crseCorrect(
00187               LevelData<FArrayBox> & a_soln,
00188               const LevelData<FArrayBox> & a_crseCorr,
00189               int a_nref) ;
00190 
00191   //use short v-cycle or levelmg's smoother to reduce
00192   //high wave numbers of residual
00193   void smooth(LevelData<FArrayBox> & a_soln, 
00194               const LevelData<FArrayBox> & rhs);
00195 
00196   //delete internal memory and set pointers to null
00197   void clearMemory();
00198 
00199   //set default values.  does not deal with memory
00200   void setDefaultValues();
00201 
00202   /*
00203     reflux enforces flux-matching from finer levels.
00204     Steps involved:
00205     a)initialize flux register with coarse flux
00206     b)increment flux register with sum of fine fluxes
00207     b)modify solution with flux diffrence
00208   */
00209   void
00210   reflux(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00211          LevelData<FArrayBox> & a_Lofphi);
00212 
00213   /*
00214     Fill fluxregisters with coarse flux
00215   */
00216   void
00217   initFRCoarse(Vector<LevelData<FArrayBox> *>& a_phiLevel);
00218 
00219   /*
00220     increment fluxregisters with fine flux
00221   */
00222   void
00223   incrementFRFine(Vector<LevelData<FArrayBox> *>& a_phiLevel);
00224 
00225   // da boss
00226   const AMRSolver* m_parent;
00227 
00228   // LevelMG level solver object to relax on this level
00229   LevelMG m_levelMG;
00230 
00231   // for interpolation
00232   MGInterp m_mginterp;
00233 
00234   //flux register with next coarser level
00235   LevelFluxRegister m_levfluxreg;
00236 
00237   // has this AMRLevelMG been defined yet?
00238   bool m_isDefined;
00239 
00240   DisjointBoxLayout m_coarsenedGrids;
00241   // residual
00242   LevelData<FArrayBox> m_resid;
00243 
00244   // correction
00245   LevelData<FArrayBox> m_corr;
00246 
00247   // the infamous correction to the correction
00248   LevelData<FArrayBox> m_dcorr;
00249 
00250   // L(phi)
00251   LevelData<FArrayBox> m_lofPhi;
00252 
00253   // extra copy of solution
00254   LevelData<FArrayBox> m_phiSave;
00255 
00256   LevelData<FArrayBox> m_resC;
00257 
00258   // Copier that operates for moving  coarsened residual to 
00259   // coarse level grid space.
00260   Copier m_residualCopier;
00261 
00262   // Copier that's used for exchange on the fine grid data
00263   // before fine flux register data is incremented.
00264   Copier m_fineExchangeCopier;
00265 
00266   //
00267   int m_level;
00268 
00269   //
00270   LevelOp* m_levelopPtr;
00271 
00272   //
00273   CoarseAverage m_averageOp;
00274 
00275   bool m_arrayViewVerbose;
00276 private:
00277   void  setArrayViewVerbose(bool a_verbosity);
00278   AMRLevelMG& operator = (const AMRLevelMG&);
00279   AMRLevelMG(const AMRLevelMG&);
00280 
00281 };
00282 
00283 #endif

Generated on Thu Aug 29 11:05:43 2002 for Chombo&INS by doxygen1.2.16