SAMRAI::algs::TimeRefinementIntegrator< DIM > Class Template Reference

#include <source/algorithm/time_refinement/TimeRefinementIntegrator.h>

Inheritance diagram for SAMRAI::algs::TimeRefinementIntegrator< DIM >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TimeRefinementIntegrator (const std::string &object_name, tbox::Pointer< tbox::Database > input_db, tbox::Pointer< hier::BasePatchHierarchy< DIM > > hierarchy, TimeRefinementLevelStrategy< DIM > *level_integrator, tbox::Pointer< mesh::BaseGriddingAlgorithm< DIM > > gridding_algorithm, bool register_for_restart=true)
 ~TimeRefinementIntegrator ()
double initializeHierarchy (const hier::BoxArray< DIM > &override_boxes=0, const hier::ProcessorMapping &override_mapping=0)
double advanceHierarchy (const double dt, const bool rebalance_coarsest=false)
bool atRegridPoint (const int level_number) const
double getIntegratorTime () const
double getStartTime () const
double getEndTime () const
int getIntegratorStep () const
int getMaxIntegratorSteps () const
bool stepsRemaining (const int level_number) const
bool stepsRemaining () const
double getLevelDtActual (const int level_number) const
double getLevelDtMax (const int level_number) const
double getLevelSimTime (const int level_number) const
int getLevelStep (const int level_number) const
int getLevelMaxSteps (const int level_number) const
const tbox::Pointer< hier::BasePatchHierarchy<
DIM > > 
getPatchHierarchy () const
tbox::Pointer< TimeRefinementLevelStrategy<
DIM > > 
getLevelIntegrator () const
tbox::Pointer< mesh::BaseGriddingAlgorithm<
DIM > > 
getGriddingAlgorithm () const
bool firstLevelStep (const int level_number) const
bool lastLevelStep (const int level_number) const
void setRegridInterval (const int regrid_interval)
virtual void printClassData (std::ostream &os) const
void printDataForLevel (std::ostream &os, const int level_number) const
void putToDatabase (tbox::Pointer< tbox::Database > db)

Detailed Description

template<int DIM>
class SAMRAI::algs::TimeRefinementIntegrator< DIM >

Class TimeRefinementIntegrator<DIM> manages time integration over an AMR patch hierarchy using local time refinement for finer hierarchy levels. This class orchestrates hierarchy construction, data advancement and synchronization, and the dynamic grid refinement processes. The basic ideas behind these algorithms are described in several sources on structured adaptive mesh refinement. See Berger and Colella, J. Comp. Phys. (82)1:64-84, 1989 for an introduction to algorithm. See Trangenstein, SIAM J. Sci. Comput. 16(4):819-839, 1995, or Hornung, PhD thesis, Dept. of Mathematics, Duke University, 1994 for further discussion.

This class can be used in two different modes: refined timestepping, which divides they hierarchy's timestep into smaller timesteps on finer levels, or synchronized timestepping, which advances all levels in a hierarchy by the same timestep. The mode that is used is determined by querying the level integrator that is passed into the constructor. One and only one mode can be used for each instantiation of this class.

The algorithm requires that integration steps on different levels are interleaved since the time increment used on each level is determined by the spatial resolution of the mesh on that level (e.g., CFL condition). Generally, when using refined timestepping, coarser levels use larger time increments than finer levels. Thus, data must be synchronized between levels and the dynamic regridding process must be coordinated with the time stepping sequence.

The routines in this class are implemented in a manner that is generic with respect to the details of the level integration and regridding methods, and the discrete equations being solved. Thus, the class may be employed for a variety of applications. Upon construction, an object of this class is configured with routines suitable for a given problem. The TimeRefinementLevelStrategy<DIM> data member supplies routines for advancing levels and synchronizing data on different levels during time integration. The mesh::BaseGriddingAlgorithm<DIM> data member provides operations that construct and dynamically reconfigure the patch hierarchy. The collaboration between this class and each of those objects follows the Strategy design pattern.

Initialization begins by setting data on the coarsest AMR hierarchy level. Then, each successively finer level is created and initialized after invoking the regridding procedures on the most recently initialized level. This process is performed until either a maximum number of levels is reached or no further refinement is needed.

Time integration is performed by invoking a recursive advance procedure on the coarsest AMR hierarchy level. On a level, data is integrated to a given point using a sequence of integration steps, where the size of each time increment depends on the problem being solved. After each step on a level, the next finer level (if it exists) is integrated to the same time using a sequence of time steps appropriate for the level. This class may dynamically adjust the time step sequence used on each level during the data advance process depending on requirements of the integrator and information about stable time step size. Dynamic mesh regridding is invoked during the integration process so that time integration, data synchronization, and mesh movement are coordinated properly.

An object of this class requires numerous parameters to be read from input. Also, data must be written to and read from files for restart. The input data are summarized as follows.

Required input keys and data types:

Optional input keys, data types, and defaults:

Note that the input values for end_time, grow_dt, max_integrator_step, and tag_buffer override values read in from restart.

A sample input file entry might look like:

 *
 *    start_time            = 0.e0      // initial simulation time
 *    end_time              = 10.e0     // final simulation time
 *    grow_dt               = 1.1e0     // growth factor for timesteps
 *    max_integrator_steps  = 50        // max number of simulation timesteps
 *    tag_buffer            = 1,1,1,1   // a max of 4 finer levels in hierarchy
 *
 * 

When running in synchronized timestepping mode, an additional input key 'regrid_interval' can be added to specify the number of timesteps between each regrid of the hierarchy.

See also:
algs::TimeRefinementLevelStrategy

mesh::BaseGriddingAlgorithm


Constructor & Destructor Documentation

template<int DIM>
SAMRAI::algs::TimeRefinementIntegrator< DIM >::TimeRefinementIntegrator ( const std::string &  object_name,
tbox::Pointer< tbox::Database input_db,
tbox::Pointer< hier::BasePatchHierarchy< DIM > >  hierarchy,
TimeRefinementLevelStrategy< DIM > *  level_integrator,
tbox::Pointer< mesh::BaseGriddingAlgorithm< DIM > >  gridding_algorithm,
bool  register_for_restart = true 
)

The constructor for TimeRefinementIntegrator<DIM> initializes the time stepping parameters needed to integrate the levels in the AMR hierarchy. Some data is set to default values; others are read from the specified input database and the restart database corresponding to the specified object_name. Consult top of this header file for further details. The constructor also registers this object for restart using the specified object name when the boolean argument is true. Whether object will write its state to restart files during program execution is determined by this argument. Note that it has a default state of true.

Note that this object also invokes the variable creation and registration process in the level strategy.

If assertion checking is turned on, an unrecoverable assertion will result if any of the input database, patch hierarchy, level strategy, or regridding algorithm pointers is null. Exceptions may also be thrown if any checks for consistency between parameters in the gridding algorithm, level strategy, and this object fail.

template<int DIM>
SAMRAI::algs::TimeRefinementIntegrator< DIM >::~TimeRefinementIntegrator (  ) 

The destructor for TimeRefinementIntegrator<DIM> unregisters the integrator object with the restart manager when so registered.


Member Function Documentation

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::initializeHierarchy ( const hier::BoxArray< DIM > &  override_boxes = 0,
const hier::ProcessorMapping override_mapping = 0 
)

Set AMR patch hierarchy configuration and data at start of simulation. If the run is begun from a restart file, the hierarchy and data are read from the hierarchy database. Otherwise, the hierarchy and data are initialized by the gridding algorithm data member. In this case, the coarsest level is constructed and initialized. Then, error estimation is performed to determine if and where it should be refined. Successively finer levels are created and initialized until the maximum allowable number of levels is achieved or no further refinement is needed. The double return value is the time increment for the first data advance step on the coarsest hierarchy level (i.e., level 0).

This function assumes that the hierarchy exists, but that it contains no patch levels, when it is called. On return from this function, the initial hierarchy configuration and simulation data is set properly for the advanceHierarchy() function to be called. In particular, on each level constructed only the data needed for initialization exists.

When assertion checking is active, the hierachy database pointer must be non-null.

The two optional arguments are only to be used for a special case where the user wishes to manually specify a box decomposition and load balance for the coarsest level of the hierarchy. The BoxArray argument must be a decomposition of the the coarsest level, and must exactly fill the index space of the physical domain of the hierarchy. The ProcessorMapping must be constructed to map each box in the BoxArray to a processor. The size of the mapping must be equal to the length of the box array, or an assertion failure will result.

Parameters:
override_boxes box array representing a decomposition of level zero of the hierarchy
override_mapping processor mapping that maps each box in the above array to a processor.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::advanceHierarchy ( const double  dt,
const bool  rebalance_coarsest = false 
)

Advance each level in the hierarchy through the given time increment and return an appropriate time increment for subsequent advances of the coarsest hierarchy level (level 0). The boolean argument indicates whether the coarsest hierarchy level (i.e., level 0) should be load balanced before the levels are advanced. In general, the problem domain (determined by the union of patches on level 0) does not change once set. However, the boolean flag here allows one to reconfigure the patches on the coarsest level which constitute this union. This may be required depending on a dynamic change of the work load. By default, the level will not be subject to load balancing.

This function assumes that all data on each level in the hierarchy has been set and that only the data need for initialization exists on each level (as opposed to both current and new data, for example). Upon return from this function, the simulation data on each hierarchy levels is advanced through the time increment dt. In addition, data on all hierarchy levels has been synchronized so that it is consistent at the new simulation time (where this synchronization process is defined by the level strategy). Thus, the data is set properly for any subsequent calls to this function.

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::atRegridPoint ( const int  level_number  )  const

Return true if the current step count for the level indicates that regridding should occur. In particular, true is returned if both the level allows refinement and the step count is an integer multiple of the regrid step interval. Otherwise, false is returned.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getIntegratorTime (  )  const [inline]

Return current integration time for coarsest hierarchy level.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getStartTime (  )  const [inline]

Return initial integration time.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getEndTime (  )  const [inline]

Return final integration time.

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::getIntegratorStep (  )  const [inline]

Return integration step count for entire hierarchy (i.e., number of steps taken by the coarsest level).

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::getMaxIntegratorSteps (  )  const [inline]

Return maximum number of integration steps allowed for entire hierarchy (i.e., steps allowed on coarsest level).

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::stepsRemaining ( const int  level_number  )  const [inline]

Return true if any steps remain in current step sequence on level (i.e., before it will synchronize with some coarser level). Return false otherwise.

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::stepsRemaining (  )  const [inline]

Return true if any integration steps remain, false otherwise.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelDtActual ( const int  level_number  )  const [inline]

Return current time increment used to advance level.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelDtMax ( const int  level_number  )  const [inline]

Return maximum time increment currently allowed on level.

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelSimTime ( const int  level_number  )  const [inline]

Return current simulation time for level.

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelStep ( const int  level_number  )  const [inline]

Return step count for current integration sequence on level.

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelMaxSteps ( const int  level_number  )  const [inline]

Return maximum number of time steps allowed on level in current integration step sequence.

template<int DIM>
const tbox::Pointer< hier::BasePatchHierarchy< DIM > > SAMRAI::algs::TimeRefinementIntegrator< DIM >::getPatchHierarchy (  )  const [inline]

Return const pointer to patch hierarchy managed by integrator.

template<int DIM>
tbox::Pointer< TimeRefinementLevelStrategy< DIM > > SAMRAI::algs::TimeRefinementIntegrator< DIM >::getLevelIntegrator (  )  const [inline]

Return pointer to level integrator.

template<int DIM>
tbox::Pointer< mesh::BaseGriddingAlgorithm< DIM > > SAMRAI::algs::TimeRefinementIntegrator< DIM >::getGriddingAlgorithm (  )  const [inline]

Return pointer to gridding algorithm object.

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::firstLevelStep ( const int  level_number  )  const [inline]

Return true if current step on level is first in current step sequence; otherwise return false.

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::lastLevelStep ( const int  level_number  )  const [inline]

Return true if current step on level is last in current step sequence; otherwise return false.

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::setRegridInterval ( const int  regrid_interval  )  [inline]

set the regrid interval to a new value. This may only be used when using synchronized timestepping.

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::printClassData ( std::ostream &  os  )  const [virtual]

Print data representation of this object to given output stream.

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::printDataForLevel ( std::ostream &  os,
const int  level_number 
) const

Print time stepping data for a single level to given output stream.

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::putToDatabase ( tbox::Pointer< tbox::Database db  )  [virtual]

Write object state out to the given database.

When assertion checking is active, the database pointer must be non-null.

Implements SAMRAI::tbox::Serializable.


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:21 2009 for SAMRAI by  doxygen 1.5.1