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

AMRSolver.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 _AMRSolver_H_
00030 #define _AMRSolver_H_
00031 
00032 #include <cstdlib>
00033 #include <cmath>
00034 #include <iostream>
00035 #include <assert.h>
00036 
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "FArrayBox.H"
00041 #include "Vector.H"
00042 #include "IntVectSet.H"
00043 #include "DisjointBoxLayout.H"
00044 #include "LevelData.H"
00045 #include "AMRLevelMG.H"
00046 #include "LevelSolver.H"
00047 #include "ProblemDomain.H"
00048 
00050 
00057 class AMRSolver
00058 {
00059 public:
00060   friend class AMRLevelMG;
00062 
00067   AMRSolver();
00068 
00070 
00074   AMRSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00075             const Vector<Box>& a_domainLevel,
00076             const Vector<Real>& a_dxLevel,
00077             const Vector<int>& a_refRatio,
00078             int a_numLevels,
00079             int a_lBase,
00080             const LevelOp* const a_opin,
00081             int ncomp = 1);
00082 
00083 
00085 
00089   AMRSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00090             const Vector<ProblemDomain>& a_domainLevel,
00091             const Vector<Real>& a_dxLevel,
00092             const Vector<int>& a_refRatio,
00093             int a_numLevels,
00094             int a_lBase,
00095             const LevelOp* const a_opin,
00096             int ncomp = 1);
00097 
00099 
00133   void
00134   define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00135          const Vector<Box>& a_domainLevel,
00136          const Vector<Real>& a_dxLevel,
00137          const Vector<int>& a_refRatio,
00138          int a_numLevels,
00139          int a_lBase,
00140          const LevelOp* const  a_opin,
00141          int ncomp=1);
00142 
00143 
00145 
00179   void
00180   define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00181          const Vector<ProblemDomain>& a_domainLevel,
00182          const Vector<Real>& a_dxLevel,
00183          const Vector<int>& a_refRatio,
00184          int a_numLevels,
00185          int a_lBase,
00186          const LevelOp* const  a_opin,
00187          int ncomp=1);
00188 
00190   ~AMRSolver();
00191 
00193 
00196   bool isDefined() const;
00197 
00199 
00203   void setNumSmoothUp(int a_numSmoothUp);
00204 
00206 
00210   void setNumSmoothDown(int a_numSmoothDown);
00211 
00213 
00216   void setTolerance(Real a_tolerance);
00217 
00218 
00220 
00226   void setOperatorTolerance(Real a_operatorTolerance);
00227 
00229 
00232   void setMaxIter(int a_maxIter);
00233 
00235 
00240   // added by Dan M, 3/24/2000
00241   void setMinIter(int a_minIter);
00242 
00243   void setNumVCyclesBottom(int a_numVCycleBottom);
00244 
00246 
00265   void solveAMR(Vector<LevelData<FArrayBox> *>& a_phiLevel, 
00266                 const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00267 
00269 
00286   void AMRVCycleMG(Vector<LevelData<FArrayBox> *>& a_corrLevel, 
00287                    const Vector<LevelData<FArrayBox> *>& a_residLevel);
00288 
00290 
00294   Vector<Real> computeResidualNorm(
00295                                    Vector<LevelData<FArrayBox> *>& a_phiLevel,
00296                                    const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00297                                    int normNtype);
00298   
00299 
00301 
00306   Vector<Real> computeResidualNorm(Vector<LevelData<FArrayBox> *>& a_residLevel,
00307                                    Vector<LevelData<FArrayBox> *>& a_phiLevel,
00308                                    const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00309                                    int normNtype);
00310 
00312 
00315   void computeAMRResidual(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00316                           const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00317                           LevelData<FArrayBox> & res,
00318                           int ilev);
00319 
00321 
00325   void applyAMROperator(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00326                         LevelData<FArrayBox>& a_LofPhi,
00327                         int a_ilev);
00328 
00329 
00331 
00336   void applyAMROperatorHphys(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00337                              LevelData<FArrayBox>& a_LofPhi,
00338                              int a_ilev);
00339 
00341 
00344   void setVerbose(bool a_verbose);
00345 protected:
00346   //set data to default values.  not for external use
00347   void setDefaultValues();
00348 
00349   void clear();
00350 
00351   // error tolerance for error estimation
00352   Real m_errorTolerance;
00353 
00354   // solver tolerance
00355   Real m_tolerance;
00356 
00357   // tolerance on maxOperator
00358   Real m_operatorTolerance;
00359 
00360 
00361   // number of levels allowed
00362   int m_numLevels; 
00363 
00364   // Maximum number of working level == m_numLevels - 1
00365   int m_finestLevel; 
00366 
00367   // refinement ratio.  
00368   Vector<int> m_refRatio;
00369 
00370   // grid spacing.  
00371   Vector<Real> m_dxLevel;
00372 
00373   // grids.  
00374   Vector<DisjointBoxLayout> m_gridsLevel;
00375 
00376   // domains.  
00377   Vector<ProblemDomain> m_domainLevel;
00378 
00379   // maximum number of solver iterations
00380   int m_maxIter;
00381 
00382   // minimum number of solver iterations before "hung converence" criteria
00383   // is valid
00384   int m_minIter;
00385 
00386   // number of smoother iterations on up cycle
00387   int m_numSmoothUp;
00388 
00389   // number of VCycles for max iter of levelsolver
00390   int m_numVCyclesBottom;
00391 
00392   // number of smoother iterations on down cycle
00393   int m_numSmoothDown;
00394 
00395   // array of AMRLevelMGs containing data at each refinement level
00396   Vector<AMRLevelMG*> m_amrmgLevel;   
00397 
00398   bool m_isDefined;
00399 
00400   LevelSolver m_levelSolver;
00401 
00402   int m_lBase;
00403 
00404   int m_ncomp;
00405 
00406   //default is true
00407   bool m_verbose;
00408 
00409 private:
00410   AMRSolver(const AMRSolver&);
00411   AMRSolver& operator=(const AMRSolver&);
00412 
00413 
00414 };
00415 #endif
00416 
00417 

Generated on Tue Jul 2 10:42:19 2002 for Chombo by doxygen1.2.16