#include <source/algorithm/method_of_lines/MethodOfLinesIntegrator.h>
Inheritance diagram for SAMRAI::algs::MethodOfLinesIntegrator< DIM >:
Public Types | |
enum | MOL_VAR_TYPE { SOLN = 0, RHS = 1 } |
Public Member Functions | |
MethodOfLinesIntegrator (const std::string &object_name, tbox::Pointer< tbox::Database > input_db, MethodOfLinesPatchStrategy< DIM > *patch_strategy, bool register_for_restart=true) | |
virtual | ~MethodOfLinesIntegrator () |
void | initializeIntegrator (tbox::Pointer< mesh::GriddingAlgorithm< DIM > > gridding_alg) |
double | getTimestep (const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, const double time) const |
void | advanceHierarchy (const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, const double time, const double dt) |
void | registerVariable (const tbox::Pointer< hier::Variable< DIM > > variable, const hier::IntVector< DIM > &ghosts, const MOL_VAR_TYPE m_v_type, const tbox::Pointer< xfer::Geometry< DIM > > &transfer_geom, const std::string &coarsen_name=std::string(), const std::string &refine_name=std::string()) |
virtual void | printClassData (std::ostream &os) const |
void | initializeLevelData (const tbox::Pointer< hier::BasePatchHierarchy< DIM > > hierarchy, const int level_number, const double init_time, const bool can_be_refined, const bool initial_time, const tbox::Pointer< hier::BasePatchLevel< DIM > > old_level=tbox::Pointer< hier::BasePatchLevel< DIM > >((0)), const bool allocate_data=true) |
void | resetHierarchyConfiguration (const tbox::Pointer< hier::BasePatchHierarchy< DIM > > hierarchy, const int coarsest_level, const int finest_level) |
virtual void | applyGradientDetector (const tbox::Pointer< hier::BasePatchHierarchy< DIM > > hierarchy, const int level_number, const double time, const int tag_index, const bool initial_time, const bool uses_richardson_extrapolation_too) |
void | putToDatabase (tbox::Pointer< tbox::Database > db) |
The original non-adaptive version of the algorithm is described in S. Gottlieb, C.W. Shu, E. Tadmor, SIAM Review, Vol. 43, No. 1, pp. 89-112. The advanceHierarchy() method integrates all levels of an AMR hierarchy through a specified timestep. See this method for details of the time-stepping process. Application-specific numerical routines that are necessary for these operations are provided by the MethodOfLinesPatchStrategy<DIM> data member. The collaboration between this class and the patch strategy follows the the Strategy design pattern. A concrete patch strategy object is derived from the base class to provide those routines for a specific problem.
This class is derived from the mesh::StandardTagAndInitStrategy<DIM> abstract base class which defines an interface for routines required by the dynamic adaptive mesh refinement routines in the mesh::GriddingAlgorithm<DIM> class. This collaboration also follows the Strategy design pattern.
Initialization of an MethodOfLinesIntegrator<DIM> object is performed by first setting default values, then reading from input. All input values may override values read from restart. Data read from input is summarized as follows:
Required input keys and data types: NONE
Optional input keys, data types, and defaults:
The following represents a sample input entry:
* MethodOfLinesIntegrator{ * order = 3 * alpha_1 = 1., 0.75, 0.33333 * alpha_2 = 0., 0.25, 0.66666 * beta = 1., 0.25, 0.66666 * } *
enum SAMRAI::algs::MethodOfLinesIntegrator::MOL_VAR_TYPE |
Enumerated type for the different categories of variable quantities allowed by the method of lines integration algorithm. See registerVariable(...) function for more details.
SAMRAI::algs::MethodOfLinesIntegrator< DIM >::MethodOfLinesIntegrator | ( | const std::string & | object_name, | |
tbox::Pointer< tbox::Database > | input_db, | |||
MethodOfLinesPatchStrategy< DIM > * | patch_strategy, | |||
bool | register_for_restart = true | |||
) |
The constructor for MethodOfLinesIntegrator<DIM> configures the method of lines integration algorithm with the concrete patch strategy object (containing problem-specific numerical routines) and initializes integration algorithm parameters provided in the specified input database and in the restart database corresponding to the specified object_name. 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.
When assertion checking is active, passing in any null pointer or an empty string will result in an unrecoverable exception.
SAMRAI::algs::MethodOfLinesIntegrator< DIM >::~MethodOfLinesIntegrator | ( | ) | [virtual] |
The destructor for MethodOfLinesIntegrator<DIM> unregisters the integrator object with the restart manager when so registered.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::initializeIntegrator | ( | tbox::Pointer< mesh::GriddingAlgorithm< DIM > > | gridding_alg | ) |
Initialize integrator by setting the number of time levels of data needed based on specifications of the gridding algorithm.
This routine also invokes variable registration in the patch strategy.
double SAMRAI::algs::MethodOfLinesIntegrator< DIM >::getTimestep | ( | const tbox::Pointer< hier::PatchHierarchy< DIM > > | hierarchy, | |
const double | time | |||
) | const |
Return a suitable time increment over which to integrate the ODE problem. A minimum is taken over the increment computed on each patch in the hierarchy.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::advanceHierarchy | ( | const tbox::Pointer< hier::PatchHierarchy< DIM > > | hierarchy, | |
const double | time, | |||
const double | dt | |||
) |
Advance the solution through the specified dt, which is assumed for the problem and state of the solution. Advances all patches in the hierarchy passed in.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::registerVariable | ( | const tbox::Pointer< hier::Variable< DIM > > | variable, | |
const hier::IntVector< DIM > & | ghosts, | |||
const MOL_VAR_TYPE | m_v_type, | |||
const tbox::Pointer< xfer::Geometry< DIM > > & | transfer_geom, | |||
const std::string & | coarsen_name = std::string() , |
|||
const std::string & | refine_name = std::string() | |||
) |
Register variable quantity defined in the patch strategy with the method of lines integrator which manipulates its storage.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::printClassData | ( | std::ostream & | os | ) | const [virtual] |
Print all data members of MethodOfLinesIntegrator<DIM> object.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::initializeLevelData | ( | const tbox::Pointer< hier::BasePatchHierarchy< DIM > > | hierarchy, | |
const int | level_number, | |||
const double | init_time, | |||
const bool | can_be_refined, | |||
const bool | initial_time, | |||
const tbox::Pointer< hier::BasePatchLevel< DIM > > | old_level = tbox::Pointer< hier::BasePatchLevel< DIM > >((0)) , |
|||
const bool | allocate_data = true | |||
) | [virtual] |
Initialize data on a new level after it is inserted into an AMR patch hierarchy by the gridding algorithm. The level number indicates that of the new level. The old_level pointer corresponds to the level that resided in the hierarchy before the level with the specified number was introduced. If the pointer is NULL, there was no level in the hierarchy prior to the call and the level data is set based on the user routines and the simulation time. Otherwise, the specified level replaces the old level and the new level receives data from the old level appropriately before it is destroyed.
Typically, when data is set, it is interpolated from coarser levels in the hierarchy. If the data is to be set, the level number must match that of the old level, if non-NULL. If the old level is non-NULL, then data is copied from the old level to the new level on regions of intersection between those levels before interpolation occurs. Then, user-supplied patch routines are called to further initialize the data if needed. The boolean argument after_regrid is passed into the user's routines.
The boolean argument initial_time indicates whether the integration time corresponds to the initial simulation time. If true, the level should be initialized with initial simulation values. Otherwise, it should be assumed that the simulation time is at some point after the start of the simulation. This information is provided since the initialization of the data on a patch may be different in each of those circumstances. The can_be_refined boolean argument indicates whether the level is the finest allowable level in the hierarchy.
Note: This function is overloaded from the base class mesh::StandardTagAndInitStrategy<DIM>.
Implements SAMRAI::mesh::StandardTagAndInitStrategy< DIM >.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::resetHierarchyConfiguration | ( | const tbox::Pointer< hier::BasePatchHierarchy< DIM > > | hierarchy, | |
const int | coarsest_level, | |||
const int | finest_level | |||
) | [virtual] |
Reset cached communication schedules after the hierarchy has changed (due to regridding, for example) and the data has been initialized on the new levels. The intent is that the cost of data movement on the hierarchy will be amortized across multiple communication cycles, if possible. Note, that whenever this routine is called, communication schedules are updated for every level finer than and including that indexed by coarsest_level.
Note: This function is overloaded from the base class mesh::StandardTagAndInitStrategy<DIM>.
Implements SAMRAI::mesh::StandardTagAndInitStrategy< DIM >.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::applyGradientDetector | ( | const tbox::Pointer< hier::BasePatchHierarchy< DIM > > | hierarchy, | |
const int | level_number, | |||
const double | time, | |||
const int | tag_index, | |||
const bool | initial_time, | |||
const bool | uses_richardson_extrapolation_too | |||
) | [virtual] |
Set integer tags to "one" on the given level where refinement of that level should occur using the user-supplied gradient detector. The boolean argument initial_time is true when the level is being subject to error estimation at initialization time. If it is false, the error estimation process is being invoked at some later time after the AMR hierarchy was initially constructed. The boolean argument uses_richardson_extrapolation_too is true when Richardson extrapolation error estimation is used in addition to the gradient detector, and false otherwise. This argument helps the user to manage multiple regridding criteria. This information is passed along to the user's patch data tagging routines since the application of the error estimator may be different in each of those circumstances.
Note: This function is overloaded from the base class mesh::StandardTagAndInitStrategy<DIM>.
Reimplemented from SAMRAI::mesh::StandardTagAndInitStrategy< DIM >.
void SAMRAI::algs::MethodOfLinesIntegrator< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | db | ) | [virtual] |
Writes object state out to the given database.
When assertion checking is enabled, the database pointer must be non-null.
Implements SAMRAI::tbox::Serializable.