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

GenAMRSolver.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 _GENAMRSOLVER_H_
00030 #define _GENAMRSOLVER_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 "Vector.H"
00041 #include "IntVectSet.H"
00042 #include "DisjointBoxLayout.H"
00043 #include "ProblemDomain.H"
00044 
00045 #include "GenAMRLevelMGOp.H"
00046 
00047 template <class T> class GenAMRLevelMG;
00048 
00050 
00057 template <class T> class GenAMRSolver
00058 {
00059 public:
00060   friend class GenAMRLevelMG<T>;
00062 
00067   GenAMRSolver();
00068 
00070 
00074   GenAMRSolver(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 GenAMRLevelMGOp<T>* const  a_opin,
00081                int                              a_ncomp = 1);
00082 
00084 
00088   GenAMRSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00089                const Vector<ProblemDomain>&     a_domainLevel,
00090                const Vector<Real>&              a_dxLevel,
00091                const Vector<int>&               a_refRatio,
00092                int                              a_numLevels,
00093                int                              a_lBase,
00094                const GenAMRLevelMGOp<T>* const  a_opin,
00095                int                              a_ncomp = 1);
00096 
00098   ~GenAMRSolver();
00099 
00101 
00104   bool isDefined() const;
00105 
00107 
00139   void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00140               const Vector<Box>&               a_domainLevel,
00141               const Vector<Real>&              a_dxLevel,
00142               const Vector<int>&               a_refRatio,
00143               int                              a_numLevels,
00144               int                              a_lBase,
00145               const GenAMRLevelMGOp<T>* const  a_opin,
00146               int                              a_ncomp = 1);
00147 
00149 
00181   void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00182               const Vector<ProblemDomain>&     a_domainLevel,
00183               const Vector<Real>&              a_dxLevel,
00184               const Vector<int>&               a_refRatio,
00185               int                              a_numLevels,
00186               int                              a_lBase,
00187               const GenAMRLevelMGOp<T>* const  a_opin,
00188               int                              a_ncomp = 1);
00189 
00191 
00195   void setNumSmoothUp(int a_numSmoothUp);
00196 
00198 
00202   void setNumSmoothDown(int a_numSmoothDown);
00203 
00205 
00208   void setTolerance(Real a_tolerance);
00209 
00211 
00217   void setOperatorTolerance(Real a_operatorTolerance);
00218 
00220 
00223   void setMaxIter(int a_maxIter);
00224 
00226 
00231   // added by Dan M, 3/24/2000
00232   void setMinIter(int a_minIter);
00233 
00235 
00240   void setNumVCyclesBottom(int a_numVCycleBottom);
00241 
00243 
00262   void solveAMR(Vector<T *>&       a_phiLevel,
00263                 const Vector<T *>& a_rhsLevel);
00264 
00266 
00283   void AMRVCycleMG(Vector<T *>&       a_corrLevel,
00284                    const Vector<T *>& a_residLevel);
00285 
00287 
00291   Vector<Real> computeResidualNorm(Vector<T *>&       a_phiLevel,
00292                                    const Vector<T *>& a_rhsLevel,
00293                                    int                a_normType);
00294 
00296 
00301   Vector<Real> computeResidualNorm(Vector<T *>&       a_residLevel,
00302                                    Vector<T *>&       a_phiLevel,
00303                                    const Vector<T *>& a_rhsLevel,
00304                                    int                a_normType);
00305 
00307 
00310   void computeAMRResidual(Vector<T *>&       a_phiLevel,
00311                           const Vector<T *>& a_rhsLevel,
00312                           T&                 a_res,
00313                           int                a_ilev);
00314 
00316 
00320   void applyAMROperator(Vector<T *>& a_phiLevel,
00321                         T&           a_LOfPhi,
00322                         int          a_ilev);
00323 
00325 
00330   void applyAMROperatorHphys(Vector<T *>& a_phiLevel,
00331                              T&           a_LOfPhi,
00332                              int          a_ilev);
00333 
00335 
00338   void setVerbose(bool a_verbose);
00339 
00340 protected:
00341   // set data to default values.  not for external use
00342   void setDefaultValues();
00343 
00344   void clear();
00345 
00346   // error tolerance for error estimation
00347   Real m_errorTolerance;
00348 
00349   // solver tolerance
00350   Real m_tolerance;
00351 
00352   // tolerance on maxOperator
00353   Real m_operatorTolerance;
00354 
00355   // number of levels allowed
00356   int m_numLevels;
00357 
00358   // Maximum number of working level is m_numLevels - 1
00359   int m_finestLevel;
00360 
00361   // refinement ratio.
00362   Vector<int> m_refRatio;
00363 
00364   // grid spacing.
00365   Vector<Real> m_dxLevel;
00366 
00367   // grids.
00368   Vector<DisjointBoxLayout> m_gridsLevel;
00369 
00370   // domains.
00371   Vector<ProblemDomain> m_domainLevel;
00372 
00373   // maximum number of solver iterations
00374   int m_maxIter;
00375 
00376   // minimum number of solver iterations before "hung converence" criteria
00377   // is valid
00378   int m_minIter;
00379 
00380   // number of smoother iterations on up cycle
00381   int m_numSmoothUp;
00382 
00383   // number of VCycles for max iter of levelsolver
00384   int m_numVCyclesBottom;
00385 
00386   // number of smoother iterations on down cycle
00387   int m_numSmoothDown;
00388 
00389   // array of GenAMRLevelMGs containing data at each refinement level
00390   Vector<GenAMRLevelMG<T> *> m_amrmgLevel;
00391 
00392   bool m_isDefined;
00393 
00394   GenLevelSolver<T> m_levelSolver;
00395 
00396   int m_lBase;
00397 
00398   int m_ncomp;
00399 
00400   // default is true
00401   bool m_verbose;
00402 
00403 private:
00404   GenAMRSolver<T>(const GenAMRSolver<T>&) {};
00405   void operator= (const GenAMRSolver<T>&) {};
00406 };
00407 
00408 #include "GenAMRSolverImplem.H"
00409 
00410 #endif

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