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 
00244 
00249   void setNumVCyclesBottom(int a_numVCycleBottom);
00250 
00252 
00271   void solveAMR(Vector<LevelData<FArrayBox> *>& a_phiLevel, 
00272                 const Vector<LevelData<FArrayBox> *>& a_rhsLevel);
00273 
00275 
00292   void AMRVCycleMG(Vector<LevelData<FArrayBox> *>& a_corrLevel, 
00293                    const Vector<LevelData<FArrayBox> *>& a_residLevel);
00294 
00296 
00300   Vector<Real> computeResidualNorm(
00301                                    Vector<LevelData<FArrayBox> *>& a_phiLevel,
00302                                    const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00303                                    int normNtype);
00304   
00305 
00307 
00312   Vector<Real> computeResidualNorm(Vector<LevelData<FArrayBox> *>& a_residLevel,
00313                                    Vector<LevelData<FArrayBox> *>& a_phiLevel,
00314                                    const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00315                                    int normNtype);
00316 
00318 
00321   void computeAMRResidual(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00322                           const Vector<LevelData<FArrayBox> *>& a_rhsLevel,
00323                           LevelData<FArrayBox> & res,
00324                           int ilev);
00325 
00327 
00331   void applyAMROperator(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00332                         LevelData<FArrayBox>& a_LofPhi,
00333                         int a_ilev);
00334 
00335 
00337 
00342   void applyAMROperatorHphys(Vector<LevelData<FArrayBox> *>& a_phiLevel,
00343                              LevelData<FArrayBox>& a_LofPhi,
00344                              int a_ilev);
00345 
00347 
00350   void setVerbose(bool a_verbose);
00351 protected:
00352   //set data to default values.  not for external use
00353   void setDefaultValues();
00354 
00355   void clear();
00356 
00357   // error tolerance for error estimation
00358   Real m_errorTolerance;
00359 
00360   // solver tolerance
00361   Real m_tolerance;
00362 
00363   // tolerance on maxOperator
00364   Real m_operatorTolerance;
00365 
00366 
00367   // number of levels allowed
00368   int m_numLevels; 
00369 
00370   // Maximum number of working level is m_numLevels - 1
00371   int m_finestLevel; 
00372 
00373   // refinement ratio.  
00374   Vector<int> m_refRatio;
00375 
00376   // grid spacing.  
00377   Vector<Real> m_dxLevel;
00378 
00379   // grids.  
00380   Vector<DisjointBoxLayout> m_gridsLevel;
00381 
00382   // domains.  
00383   Vector<ProblemDomain> m_domainLevel;
00384 
00385   // maximum number of solver iterations
00386   int m_maxIter;
00387 
00388   // minimum number of solver iterations before "hung converence" criteria
00389   // is valid
00390   int m_minIter;
00391 
00392   // number of smoother iterations on up cycle
00393   int m_numSmoothUp;
00394 
00395   // number of VCycles for max iter of levelsolver
00396   int m_numVCyclesBottom;
00397 
00398   // number of smoother iterations on down cycle
00399   int m_numSmoothDown;
00400 
00401   // array of AMRLevelMGs containing data at each refinement level
00402   Vector<AMRLevelMG*> m_amrmgLevel;   
00403 
00404   bool m_isDefined;
00405 
00406   LevelSolver m_levelSolver;
00407 
00408   int m_lBase;
00409 
00410   int m_ncomp;
00411 
00412   //default is true
00413   bool m_verbose;
00414 
00415 private:
00416   AMRSolver(const AMRSolver&);
00417   AMRSolver& operator=(const AMRSolver&);
00418 
00419 
00420 };
00421 #endif
00422 
00423 

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