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

LevelSolver.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, Fri, July 23, 1999
00028 
00029 #ifndef _LEVELSOLVER_H_
00030 #define _LEVELSOLVER_H_
00031 
00032 #include <cstdlib>
00033 #include <iostream>
00034 #include <cassert>
00035 #include <cmath>
00036 
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "FArrayBox.H"
00041 #include "DisjointBoxLayout.H"
00042 #include "LevelData.H"
00043 #include "LevelMG.H"
00044 #include "ProblemDomain.H"
00045 
00047 
00051 class LevelSolver
00052 {
00053 public:
00055 
00057   LevelSolver();
00058 
00060   virtual ~LevelSolver();
00061 
00063 
00079   LevelSolver(const DisjointBoxLayout& a_grids,
00080               const DisjointBoxLayout* a_baseGrids,
00081               const ProblemDomain&     a_domain,
00082               Real                     a_dxLevel,
00083               int                      a_nRefCrse,
00084               const LevelOp* const     a_opin,
00085               int                      a_ncomp,
00086               bool                     a_limitCoarsening = false);
00087 
00089 
00105   LevelSolver(const DisjointBoxLayout& a_grids,
00106               const DisjointBoxLayout* a_baseGrids,
00107               const Box&               a_domain,
00108               Real                     a_dxLevel,
00109               int                      a_nRefCrse,
00110               const LevelOp* const     a_opin,
00111               int                      a_ncomp = 1,
00112               bool                     a_limitCoarsening = false);
00113 
00115 
00129   virtual void define(const DisjointBoxLayout& a_grids,
00130                       const DisjointBoxLayout* a_baseGrids,
00131                       const ProblemDomain&     a_domain,
00132                       Real                     a_dxLevel,
00133                       int                      a_nRefCrse,
00134                       const LevelOp* const     a_opin,
00135                       int                      a_ncomp = 1,
00136                       bool                     a_limitCoarsening = false);
00137 
00139 
00153   virtual void define(const DisjointBoxLayout& a_grids,
00154                       const DisjointBoxLayout* a_baseGrids,
00155                       const Box&               a_domain,
00156                       Real                     a_dxLevel,
00157                       int                      a_nRefCrse,
00158                       const LevelOp* const     a_opin,
00159                       int                      a_ncomp=1,
00160                       bool                     a_limitCoarsening = false);
00161 
00163   bool isDefined() const;
00164 
00166   void clearMemory();
00167 
00169   void setDefaultValues();
00170 
00172 
00175   void levelSolveH(
00176                    LevelData<FArrayBox>&       a_phi,
00178                    const LevelData<FArrayBox>& a_rhs,
00180                    bool                        a_initializePhiToZero=true);
00181 
00183 
00187   void levelSolve(
00188                   LevelData<FArrayBox>&       a_phi,
00190                   const LevelData<FArrayBox>* a_phic,
00192                   const LevelData<FArrayBox>& a_rhs,
00194                   bool                        a_initializePhiToZero=true);
00195 
00197   void setNumSmoothUp(int a_numSmoothUp);
00198   
00200   void setNumSmoothDown(int a_numSmoothDown);
00201 
00203   void setTolerance(Real a_tolerance);
00204 
00206 
00212   void setOperatorTolerance(Real a_operatorTolerance);
00213 
00215   void setVerbose(bool a_verbose);
00216 
00218   void setMaxIter(int a_maxIter);
00219 
00221 
00226   // added by Dan M, (9/20/02)
00227   void setMinIter(int a_minIter);
00228   
00230 
00235   virtual void setConvergenceMetric(Real a_metric, int a_comp);
00236 
00237 
00239   virtual void resetConvergenceMetrics();
00240 
00241 protected:
00245   LevelMG m_levelMG;
00246 
00250   LevelOp* m_levelOpPtr;
00251 
00255   bool m_isDefined;
00256 
00260   DisjointBoxLayout  m_grids;
00261 
00265   ProblemDomain m_domain;
00266 
00270   LevelData<FArrayBox> m_resid;
00271 
00275   LevelData<FArrayBox> m_scratch;
00276 
00280   LevelData<FArrayBox> m_corr;
00281 
00285   int m_nRefCrse;
00286 
00290   Real m_dxLevel;
00291 
00295   int m_maxIter;
00296 
00300   int m_minIter;
00301 
00305   int m_numSmoothUp;
00306 
00310   int m_numSmoothDown;
00311 
00315   Real m_tolerance;
00316 
00320   Vector<Real> m_convergenceMetrics;
00321 
00325   Real m_operatorTolerance;
00326 
00330   bool m_verbose;
00331 
00332 private:
00333   void operator = (const LevelSolver&){;}
00334   LevelSolver(const LevelSolver&){;}
00335 };
00336 
00337 #endif

Generated on Wed Jun 2 13:53:34 2004 for Chombo&INSwithParticles by doxygen 1.3.2