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   dtToleranceFactor(Real a_dt_tolerance_factor);
00258 
00260 
00264   void
00265   fillRatio(Real a_fillRat);
00266 
00268 
00272   void 
00273   blockFactor(int a_blockFactor);
00274 
00276 
00280   void 
00281   gridBufferSize(int a_grid_buffer_size);
00282 
00283   int
00284   maxGridSize() const;
00285 
00287 
00299   void
00300   verbosity (int a_verbosity);
00301 
00303 
00307   void 
00308   regridIntervals(const Vector<int>& a_regridIntervals);
00309 
00311 
00320   int
00321   verbosity () const;
00322 
00324 
00325   void
00326   maxDtGrow(Real a_dtGrowFactor);
00327 
00329 
00330   Real
00331   maxDtGrow() const;
00332 
00334 
00335   void
00336   fixedDt(Real a_dt);
00337 
00339 
00340   Real
00341   fixedDt() const;
00342 
00343 protected:
00344   // advance by dt on this level and all finer levels and return the
00345   // number of steps left - given the number of steps left on entry.
00346   int
00347   timeStep(int a_level, int a_stepsLeft, bool timeBoundary);
00348 
00349   //intenal use only 
00350   void
00351   clearMemory();
00352   // make new grids.
00353   void
00354   regrid(int a_base_level);
00355 
00356   // make initial grids.
00357   // not an accurate name, since there are no grids to re.
00358   void
00359   initialGrid();
00360 
00361   void
00362   writePlotFile() const;
00363 
00364   void
00365   writeCheckpointFile() const;
00366 
00367   // computes maximum stable time step given the maximum stable time
00368   // step on the individual levels.
00369   void
00370   assignDt();
00371 
00372   // whether regridding should be done now.
00373   bool
00374   needToRegrid(int a_level, int a_numStepsLeft) const;
00375 
00376   void
00377   makeBaseLevelMesh (Vector<Box>& a_grids) const;
00378 
00379   void setDefaultValues();
00380 
00381 protected:
00382   int m_blockFactor;
00383   Real m_fillRatio;
00384   int m_max_level;
00385   int m_finest_level_old;
00386   int m_finest_level;
00387   int m_checkpoint_interval;
00388   int m_plot_interval;
00389   int m_max_grid_size;
00390   Real m_dt_tolerance_factor;
00391   Real m_fixedDt;
00392 
00393   bool m_isDefined;
00394   bool m_isSetUp;
00395   Vector<AMRLevel*> m_amrlevels;
00396   Vector<int> m_ref_ratios;
00397   Vector<int> m_reduction_factor;
00398   Vector<int> m_regrid_intervals;
00399   Real m_dt_base;
00400   // New (maximum) dt
00401   Vector<Real> m_dt_new;
00402   // Current dt
00403   Vector<Real> m_dt_cur;
00404   Real m_maxDtGrow;
00405 
00406   BRMeshRefine m_mesh_refine;
00407   bool m_use_meshrefine;
00408 
00409   Vector<Vector<Box> > m_amr_grids;
00410 
00411   int m_cur_step;
00412   int m_restart_step;
00413   int m_lastcheck_step;
00414 
00415   Real m_cur_time;
00416   Vector<int> m_steps_since_regrid;
00417   Vector<long> m_cell_updates;
00418 
00419   std::string m_plotfile_prefix;
00420   std::string m_checkpointfile_prefix;
00421 
00422   int m_verbosity;
00423 };
00424 #endif

Generated on Tue Jul 2 10:42:18 2002 for Chombo by doxygen1.2.16