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

AMR.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 #ifndef _AMR_H_
00029 #define _AMR_H_
00030 
00031 #include <iostream>
00032 #include <string>
00033 
00034 #include "REAL.H"
00035 #include "Vector.H"
00036 #include "AMRLevel.H"
00037 #include "AMRLevelFactory.H"
00038 #include "BRMeshRefine.H"
00039 #include "ProblemDomain.H"
00040 #include "Box.H"
00041 #include "HDF5.H"
00042 
00043 #include <time.h>
00044 
00046 
00063 class AMR
00064 {
00065 public:
00067 
00069 
00073   AMR();
00074 
00076 
00079   ~AMR();
00080 
00082 
00105   void define(int a_max_level, 
00106               const Vector<int>& a_ref_ratios,
00107               const Box& a_prob_domain,
00108               const AMRLevelFactory* const a_amrLevelFact);
00109 
00110 
00112 
00135   void define(int a_max_level, 
00136               const Vector<int>& a_ref_ratios,
00137               const ProblemDomain& a_prob_domain,
00138               const AMRLevelFactory* const a_amrLevelFact);
00139 
00140 
00142 
00143 
00145 
00149   bool isDefined() const;
00150 
00152 
00156   bool isSetUp() const;
00157 
00158 #ifdef HDF5
00159 
00160 
00166   void
00167   setupForRestart(HDF5Handle& a_handle);
00168 #endif
00169 
00171 
00177   void
00178   setupForNewAMRRun();
00179 
00185   void
00186   setupForFixedHierarchyRun(const Vector<Vector<Box> >& a_amr_grids,
00187                             int a_proper_nest = 1);
00188 
00190 
00195   void
00196   conclude() const;
00197 
00199 
00203   void
00204   run(Real a_max_time, int a_max_step);
00205 
00207 
00209 
00214   void
00215   plotPrefix(const std::string& a_plotfile_prefix);
00216 
00218 
00223   void
00224   checkpointPrefix(const std::string& a_checkpointfile_prefix);
00225 
00227 
00231   void
00232   plotInterval(int a_plot_interval);
00233 
00235 
00239   void
00240   checkpointInterval(int a_checkpoint_interval);
00241 
00243 
00247   void
00248   maxGridSize(int a_max_grid_size);
00249 
00251 
00256   void
00257   maxBaseGridSize(int a_max_base_grid_size);
00258 
00259 
00260 
00262 
00267   void
00268   dtToleranceFactor(Real a_dt_tolerance_factor);
00269 
00271 
00275   void
00276   fillRatio(Real a_fillRat);
00277 
00279 
00283   void 
00284   blockFactor(int a_blockFactor);
00285 
00287 
00291   void 
00292   gridBufferSize(int a_grid_buffer_size);
00293 
00294   int
00295   maxGridSize() const;
00296 
00297 
00298   int
00299   maxBaseGridSize() const;
00300 
00302 
00314   void
00315   verbosity (int a_verbosity);
00316 
00318 
00322   void 
00323   regridIntervals(const Vector<int>& a_regridIntervals);
00324 
00326 
00335   int
00336   verbosity () const;
00337 
00339 
00340   void
00341   maxDtGrow(Real a_dtGrowFactor);
00342 
00344 
00345   Real
00346   maxDtGrow() const;
00347 
00349 
00350   void
00351   fixedDt(Real a_dt);
00352 
00354 
00355   Real
00356   fixedDt() const;
00357  
00358   Vector<AMRLevel*> getAMRLevels();
00359 
00360   Real getCurrentTime() const;
00361 protected:
00362   // advance by dt on this level and all finer levels and return the
00363   // number of steps left - given the number of steps left on entry.
00364   int
00365   timeStep(int a_level, int a_stepsLeft, bool timeBoundary);
00366 
00367   //intenal use only 
00368   void
00369   clearMemory();
00370   // make new grids.
00371   void
00372   regrid(int a_base_level);
00373 
00374   // make initial grids.
00375   // not an accurate name, since there are no grids to re.
00376   void
00377   initialGrid();
00378 
00379   void
00380   writePlotFile() const;
00381 
00382   void
00383   writeCheckpointFile() const;
00384 
00385   // computes maximum stable time step given the maximum stable time
00386   // step on the individual levels.
00387   void
00388   assignDt();
00389 
00390   // whether regridding should be done now.
00391   bool
00392   needToRegrid(int a_level, int a_numStepsLeft) const;
00393 
00394   void
00395   makeBaseLevelMesh (Vector<Box>& a_grids) const;
00396 
00397   void setDefaultValues();
00398 
00399 protected:
00400   int m_blockFactor;
00401   Real m_fillRatio;
00402   int m_max_level;
00403   int m_finest_level_old;
00404   int m_finest_level;
00405   int m_checkpoint_interval;
00406   int m_plot_interval;
00407   int m_max_grid_size;
00408   int m_max_base_grid_size;
00409   Real m_dt_tolerance_factor;
00410   Real m_fixedDt;
00411 
00412   bool m_isDefined;
00413   bool m_isSetUp;
00414   Vector<AMRLevel*> m_amrlevels;
00415   Vector<int> m_ref_ratios;
00416   Vector<int> m_reduction_factor;
00417   Vector<int> m_regrid_intervals;
00418   Real m_dt_base;
00419   // New (maximum) dt
00420   Vector<Real> m_dt_new;
00421   // Current dt
00422   Vector<Real> m_dt_cur;
00423   Real m_maxDtGrow;
00424 
00425   BRMeshRefine m_mesh_refine;
00426   bool m_use_meshrefine;
00427 
00428   Vector<Vector<Box> > m_amr_grids;
00429 
00430   int m_cur_step;
00431   int m_restart_step;
00432   int m_lastcheck_step;
00433 
00434   Real m_cur_time;
00435   Vector<int> m_steps_since_regrid;
00436   Vector<long> m_cell_updates;
00437 
00438   std::string m_plotfile_prefix;
00439   std::string m_checkpointfile_prefix;
00440 
00441   int m_verbosity;
00442 };
00443 #endif

Generated on Wed Apr 16 14:26:48 2003 for Chombo by doxygen1.2.16