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

AMRNodeSolver.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 
00028 // AMRNodeSolver.H
00029 // adapted from AMRSolver by DTGraves, Tues, July 6, 1999
00030 // petermc, Wed, Nov 28, 2000
00031 
00032 #ifndef AMRNODESOLVER_H
00033 #define AMRNODESOLVER_H
00034 
00035 #include <cstdlib>
00036 #include <cmath>
00037 #include <iostream>
00038 #include <assert.h>
00039 #include "REAL.H"
00040 #include "IntVect.H"
00041 #include "ProblemDomain.H"
00042 #include "NodeFArrayBox.H"
00043 #include "Vector.H"
00044 #include "IntVectSet.H"
00045 #include "DisjointBoxLayout.H"
00046 #include "LevelData.H"
00047 #include "AMRNodeLevelMG.H"
00048 #include "LevelNodeSolver.H"
00049 
00051 
00058 class AMRNodeSolver
00059 {
00060 public:
00061 
00062   friend class AMRNodeLevelMG;
00063 
00065 
00067 
00071   AMRNodeSolver();
00072 
00074 
00077   AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00078                 const Vector<ProblemDomain>&     a_domainLevel,
00079                 const Vector<Real>&              a_dxLevel,
00080                 const Vector<int>&               a_refRatio,
00081                 int                              a_numLevels,
00082                 int                              a_lBase,
00083                 const NodeMaskLevelOp* const     a_opin,
00084                 int                              a_minLength = 1);
00085 
00086   AMRNodeSolver(const Vector<DisjointBoxLayout>& a_gridsLevel,
00087                 const Vector<Box>&               a_domainLevel,
00088                 const Vector<Real>&              a_dxLevel,
00089                 const Vector<int>&               a_refRatio,
00090                 int                              a_numLevels,
00091                 int                              a_lBase,
00092                 const NodeMaskLevelOp* const     a_opin,
00093                 int                              a_minLength = 1);
00094 
00096 
00098   ~AMRNodeSolver();
00099   
00101 
00122   void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00123               const Vector<ProblemDomain>&     a_domainLevel,
00124               const Vector<Real>&              a_dxLevel,
00125               const Vector<int>&               a_refRatio,
00126               int                              a_numLevels,
00127               int                              a_lBase,
00128               const NodeMaskLevelOp* const     a_opin,
00129               int                              a_minLength = 1);
00130 
00131   void define(const Vector<DisjointBoxLayout>& a_gridsLevel,
00132               const Vector<Box>&               a_domainLevel,
00133               const Vector<Real>&              a_dxLevel,
00134               const Vector<int>&               a_refRatio,
00135               int                              a_numLevels,
00136               int                              a_lBase,
00137               const NodeMaskLevelOp* const     a_opin,
00138               int                              a_minLength = 1);
00139 
00141 
00143 
00145   bool isDefined() const;
00146 
00148 
00150 
00153   void setNumSmoothUp(int a_numSmoothUp);
00154     
00156 
00159   void setNumSmoothDown(int a_numSmoothDown);
00160 
00162 
00165   void setNumBottomGSRB(int a_numBottomGSRB);
00166 
00168 
00170   void setTolerance(Real a_tolerance);
00171 
00173 
00176   void setBottomSmoothing(bool a_doBottomSmooth);
00177 
00179 
00181   void setBottomTolerance(Real a_tolerance);
00182 
00184 
00189   void setOperatorTolerance(Real a_operatorTolerance);
00190 
00192 
00194   void setMaxIter(int a_maxIter);
00195 
00197 
00201   // added by Dan M, 3/24/2000
00202   void setMinIter(int a_minIter);
00203      
00205 
00208   void setBottomMaxIter(int a_maxIter);
00209 
00211 
00213   void setVerbose(bool a_verbose);
00214 
00215 
00217 
00219 
00234   void solveAMR(Vector<LevelData<NodeFArrayBox> *>&       a_phiLevel, 
00235                 const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00236 
00238 
00248   void AMRVCycleMG(Vector<LevelData<NodeFArrayBox> *>&       a_phiLevel, 
00249                    const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel);
00250 
00252 
00258   Real computeResidualNorm(int a_normType);
00259 
00260 
00262 
00280   void computeAMRResidual(LevelData<NodeFArrayBox>&                 a_res,
00281                           Vector<LevelData<NodeFArrayBox> *>&       a_phiLevel,
00282                           const Vector<LevelData<NodeFArrayBox> *>& a_rhsLevel,
00283                           int                                       a_ilev);
00284 
00286 
00300   void applyAMROperator(LevelData<NodeFArrayBox>&           a_lofPhi,
00301                         Vector<LevelData<NodeFArrayBox> *>& a_phiLevel,
00302                         int                                 a_ilev);
00303 
00304 protected:
00305 
00306   //set data to default values.  not for external use
00307   void setDefaultValues();
00308   
00309   void clear();
00310 
00311   // solver tolerance
00312   Real m_tolerance;
00313 
00314   // tolerance on maxOperator
00315   Real m_operatorTolerance;
00316 
00317   // index of coarsest level on which solution is to be computed.
00318   int m_lBase;
00319 
00320   // number of levels allowed.
00321   int m_numLevels; 
00322 
00323   // index of finest level used.  equal to m_numLevels-1.
00324   int m_finestLevel;
00325 
00326   // refinement ratio between levels.
00327   Vector<int> m_refRatio;
00328 
00329   // grid spacing at each level.
00330   Vector<Real> m_dxLevel;
00331 
00332   // grids, cell-centered (disjoint) at each level.
00333   Vector<DisjointBoxLayout> m_gridsLevel;
00334 
00335   // cell-centered domain at each level.
00336   Vector<ProblemDomain> m_domainLevel;
00337 
00338   // maximum number of solver iterations
00339   int m_maxIter;
00340 
00341   // minimum number of solver iterations before "hung converence" criteria
00342   // is valid
00343   int m_minIter;
00344 
00345   // number of smoother iterations on up cycle
00346   int m_numSmoothUp;
00347 
00348   // number of smoother iterations on down cycle
00349   int m_numSmoothDown;
00350 
00351   // number of smoother iterations at bottom
00352   int m_numBottomGSRB;
00353 
00354   // data at each refinement level.
00355   Vector<AMRNodeLevelMG*> m_amrmgLevel;   
00356   
00357   bool m_isDefined;
00358 
00359   // multigrid solver for coarsest level.
00360   LevelNodeSolver m_levelSolver;
00361 
00362   // default is true:  messages are written.
00363   bool m_verbose;
00364   
00365 private:
00366   AMRNodeSolver(const AMRNodeSolver&);
00367   AMRNodeSolver& operator=(const AMRNodeSolver&);
00368 
00369 
00370 };
00371 #endif

Generated on Tue Apr 15 18:31:55 2003 for AMRNodeElliptic by doxygen1.2.16