IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::algs::TimeRefinementIntegrator< DIM > Class Template Reference

#include <TimeRefinementIntegrator.h>

Inheritance diagram for SAMRAI::algs::TimeRefinementIntegrator< DIM >:
Inheritance graph
[legend]

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)
 

Private Member Functions

void initializeRefinedTimesteppingLevelData (const int level_number)
 
void initializeSynchronizedTimesteppingLevelData (const int level_number)
 
void advanceRecursivelyForRefinedTimestepping (const int level_number, const double end_time)
 
double advanceForSynchronizedTimestepping (const double dt)
 
bool findNextDtAndStepsRemaining (const int level_number, const double time_remaining, const double dt_bound)
 
bool coarserLevelRegridsToo (const int level_number) const
 
virtual void getFromInput (tbox::Pointer< tbox::Database > db, bool is_from_restart)
 
virtual void getFromRestart ()
 
 TimeRefinementIntegrator (const TimeRefinementIntegrator< DIM > &)
 
void operator= (const TimeRefinementIntegrator< DIM > &)
 

Private Attributes

std::string d_object_name
 
bool d_registered_for_restart
 
tbox::Pointer< hier::BasePatchHierarchy< DIM > > d_patch_hierarchy
 
TimeRefinementLevelStrategy< DIM > * d_refine_level_integrator
 
tbox::Pointer< mesh::BaseGriddingAlgorithm< DIM > > d_gridding_algorithm
 
bool d_use_refined_timestepping
 
double d_start_time
 
double d_end_time
 
double d_grow_dt
 
int d_max_integrator_steps
 
tbox::Array< intd_regrid_interval
 
tbox::Array< intd_tag_buffer
 
double d_integrator_time
 
int d_integrator_step
 
bool d_just_regridded
 
int d_last_finest_level
 
tbox::Array< doubled_level_old_old_time
 
tbox::Array< doubled_level_old_time
 
tbox::Array< doubled_level_sim_time
 
tbox::Array< doubled_dt_max_level
 
tbox::Array< doubled_dt_actual_level
 
tbox::Array< intd_step_level
 
tbox::Array< intd_max_steps_level
 
double d_dt
 
tbox::Pointer< tbox::Timert_initialize_hier
 
tbox::Pointer< tbox::Timert_advance_hier
 

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

◆ TimeRefinementIntegrator() [1/2]

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.

◆ ~TimeRefinementIntegrator()

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

◆ TimeRefinementIntegrator() [2/2]

template<int DIM>
SAMRAI::algs::TimeRefinementIntegrator< DIM >::TimeRefinementIntegrator ( const TimeRefinementIntegrator< DIM > &  )
private

Member Function Documentation

◆ initializeHierarchy()

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_boxesbox array representing a decomposition of level zero of the hierarchy
override_mappingprocessor mapping that maps each box in the above array to a processor.

◆ advanceHierarchy()

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.

◆ atRegridPoint()

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.

◆ getIntegratorTime()

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

Return current integration time for coarsest hierarchy level.

◆ getStartTime()

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

Return initial integration time.

◆ getEndTime()

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

Return final integration time.

◆ getIntegratorStep()

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

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

◆ getMaxIntegratorSteps()

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

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

◆ stepsRemaining() [1/2]

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

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.

◆ stepsRemaining() [2/2]

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

Return true if any integration steps remain, false otherwise.

◆ getLevelDtActual()

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

Return current time increment used to advance level.

◆ getLevelDtMax()

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

Return maximum time increment currently allowed on level.

◆ getLevelSimTime()

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

Return current simulation time for level.

◆ getLevelStep()

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

Return step count for current integration sequence on level.

◆ getLevelMaxSteps()

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

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

◆ getPatchHierarchy()

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

Return const pointer to patch hierarchy managed by integrator.

◆ getLevelIntegrator()

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

Return pointer to level integrator.

◆ getGriddingAlgorithm()

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

Return pointer to gridding algorithm object.

◆ firstLevelStep()

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

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

◆ lastLevelStep()

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

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

◆ setRegridInterval()

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

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

◆ printClassData()

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

Print data representation of this object to given output stream.

◆ printDataForLevel()

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.

◆ putToDatabase()

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.

◆ initializeRefinedTimesteppingLevelData()

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::initializeRefinedTimesteppingLevelData ( const int  level_number)
private

◆ initializeSynchronizedTimesteppingLevelData()

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::initializeSynchronizedTimesteppingLevelData ( const int  level_number)
private

◆ advanceRecursivelyForRefinedTimestepping()

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::advanceRecursivelyForRefinedTimestepping ( const int  level_number,
const double  end_time 
)
private

◆ advanceForSynchronizedTimestepping()

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::advanceForSynchronizedTimestepping ( const double  dt)
private

◆ findNextDtAndStepsRemaining()

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::findNextDtAndStepsRemaining ( const int  level_number,
const double  time_remaining,
const double  dt_bound 
)
private

◆ coarserLevelRegridsToo()

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

◆ getFromInput()

template<int DIM>
virtual void SAMRAI::algs::TimeRefinementIntegrator< DIM >::getFromInput ( tbox::Pointer< tbox::Database db,
bool  is_from_restart 
)
privatevirtual

◆ getFromRestart()

template<int DIM>
virtual void SAMRAI::algs::TimeRefinementIntegrator< DIM >::getFromRestart ( )
privatevirtual

◆ operator=()

template<int DIM>
void SAMRAI::algs::TimeRefinementIntegrator< DIM >::operator= ( const TimeRefinementIntegrator< DIM > &  )
private

Member Data Documentation

◆ d_object_name

template<int DIM>
std::string SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_object_name
private

◆ d_registered_for_restart

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_registered_for_restart
private

◆ d_patch_hierarchy

template<int DIM>
tbox::Pointer< hier::BasePatchHierarchy<DIM> > SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_patch_hierarchy
private

◆ d_refine_level_integrator

template<int DIM>
TimeRefinementLevelStrategy<DIM>* SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_refine_level_integrator
private

◆ d_gridding_algorithm

template<int DIM>
tbox::Pointer< mesh::BaseGriddingAlgorithm<DIM> > SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_gridding_algorithm
private

◆ d_use_refined_timestepping

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_use_refined_timestepping
private

◆ d_start_time

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_start_time
private

◆ d_end_time

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_end_time
private

◆ d_grow_dt

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_grow_dt
private

◆ d_max_integrator_steps

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_max_integrator_steps
private

◆ d_regrid_interval

template<int DIM>
tbox::Array<int> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_regrid_interval
private

◆ d_tag_buffer

template<int DIM>
tbox::Array<int> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_tag_buffer
private

◆ d_integrator_time

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_integrator_time
private

◆ d_integrator_step

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_integrator_step
private

◆ d_just_regridded

template<int DIM>
bool SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_just_regridded
private

◆ d_last_finest_level

template<int DIM>
int SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_last_finest_level
private

◆ d_level_old_old_time

template<int DIM>
tbox::Array<double> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_level_old_old_time
private

◆ d_level_old_time

template<int DIM>
tbox::Array<double> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_level_old_time
private

◆ d_level_sim_time

template<int DIM>
tbox::Array<double> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_level_sim_time
private

◆ d_dt_max_level

template<int DIM>
tbox::Array<double> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_dt_max_level
private

◆ d_dt_actual_level

template<int DIM>
tbox::Array<double> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_dt_actual_level
private

◆ d_step_level

template<int DIM>
tbox::Array<int> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_step_level
private

◆ d_max_steps_level

template<int DIM>
tbox::Array<int> SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_max_steps_level
private

◆ d_dt

template<int DIM>
double SAMRAI::algs::TimeRefinementIntegrator< DIM >::d_dt
private

◆ t_initialize_hier

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::algs::TimeRefinementIntegrator< DIM >::t_initialize_hier
private

◆ t_advance_hier

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::algs::TimeRefinementIntegrator< DIM >::t_advance_hier
private

The documentation for this class was generated from the following file: