#include <source/algorithm/implicit/ImplicitIntegrator.h>
Inheritance diagram for SAMRAI::algs::ImplicitIntegrator< DIM >:
Public Member Functions | |
ImplicitIntegrator (const std::string &object_name, tbox::Pointer< tbox::Database > input_db, ImplicitEquationStrategy< DIM > *implicit_equations, solv::NonlinearSolverStrategy< DIM > *nonlinear_solver, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy) | |
virtual | ~ImplicitIntegrator () |
void | initialize () |
int | advanceSolution (const double dt, const bool first_step) |
Integrate entire patch hierarchy through the specified time increment. | |
double | getNextDt (const bool good_solution, const int solver_retcode) |
bool | checkNewSolution (const int solver_retcode) const |
double | updateSolution () |
double | getInitialTime () const |
double | getFinalTime () const |
double | getCurrentTime () const |
double | getCurrentDt () const |
int | getIntegratorStep () const |
int | getMaxIntegratorSteps () const |
bool | stepsRemaining () const |
virtual void | printClassData (std::ostream &os) const |
void | putToDatabase (tbox::Pointer< tbox::Database > db) |
Class ImplicitIntegrator<DIM> manages implicit time integration over an AMR patch hierarchy. It maintains references to ImplicitEquationStrategy<DIM> and solv::NonlinearSolverStrategy<DIM> objects, which provide operations describing the implicit equations and solving the problem at each time step, respectively. When a time step is performed, data on all levels is integrated through the same time increment.
Initialization of an ImplicitIntegrator<DIM> object is performed via a combination of default parameters and values read from input. Data read from input is summarized as follows:
Required input keys and data types:
initial_time | double value for the initial simulation time. | |
final_time | double value for the final simulation time. | |
max_integrator_steps | integer value for the maximum number of timesteps allowed. |
A sample input file entry might look like:
initial_time = 0.0 final_time = 1.0 max_integrator_steps = 100
SAMRAI::algs::ImplicitIntegrator< DIM >::ImplicitIntegrator | ( | const std::string & | object_name, | |
tbox::Pointer< tbox::Database > | input_db, | |||
ImplicitEquationStrategy< DIM > * | implicit_equations, | |||
solv::NonlinearSolverStrategy< DIM > * | nonlinear_solver, | |||
const tbox::Pointer< hier::PatchHierarchy< DIM > > | hierarchy | |||
) |
The constructor for ImplicitIntegrator<DIM> initializes the default state of the integrator. The integrator is configured with the concrete strategy objects in the argument list that provide operations related to the nonlinear solver and implicit equations to solve. Data members are initialized from the input and restart databases.
Note that no vectors are created in the constructor. Vectors are created and the nonlinear solver is initialized in the initialize() member function.
If assertion checking is turned on, an unrecoverable assertion will result if any of the database, strategy, or hierarchy pointers is null. Exceptions may also be thrown if any checks for consistency among input parameters fail.
SAMRAI::algs::ImplicitIntegrator< DIM >::~ImplicitIntegrator | ( | ) | [virtual] |
Empty destructor for ImplicitIntegrator<DIM>
void SAMRAI::algs::ImplicitIntegrator< DIM >::initialize | ( | ) |
Initialize state of time integrator. This includes creating solution vector and initializing solver components.
int SAMRAI::algs::ImplicitIntegrator< DIM >::advanceSolution | ( | const double | dt, | |
const bool | first_step | |||
) |
Integrate entire patch hierarchy through the specified time increment.
Integrate entire patch hierarchy through the specified time increment. The time advance assumes the use of a nonlinear solver to implicitly integrate the discrete equations. The integer return value is the return code generated by the particular solver package in use. It is the user's responsibility to interpret this code in a manner consistent with the solver she is using.
The boolean first_step argument is true when this is the very first call to the advance function or if the call occurs immediately after the hierarchy has changed due to regridding. Otherwise it is false. Note that, when the argument is true, the use of extrapolation to construct the initial guess for the advanced solution may not be possible.
dt | Time step size | |
first_step | Whether this is the first step after grid change |
double SAMRAI::algs::ImplicitIntegrator< DIM >::getNextDt | ( | const bool | good_solution, | |
const int | solver_retcode | |||
) |
Return time increment for next solution advance. Timestep selection is generally based on whether the nonlinear solution iteration converged and, if so, whether the solution meets some user-defined criteria. This routine assumes that, before it is called, the routine checkNewSolution() was called. The boolean argument is the return value from that call. The integer argument is the return code generated by the nonlinear solver package that computed the solution.
bool SAMRAI::algs::ImplicitIntegrator< DIM >::checkNewSolution | ( | const int | solver_retcode | ) | const |
Check time advanced solution to determine whether it is acceptable. Return true if the solution is acceptable; return false otherwise. The integer argument is the return code generated by the call to the nonlinear solver "solve" routine. The meaning of this value depends on the particular nonlinear solver in use and must be intepreted properly by the user-supplied solution checking routine.
double SAMRAI::algs::ImplicitIntegrator< DIM >::updateSolution | ( | ) |
Update solution (e.g., reset pointers for solution data, update dependent variables, etc.) after time advance. It is assumed that when this routine is invoked, an acceptable new solution has been computed. The double return value is the simulation time corresponding to the advanced solution.
double SAMRAI::algs::ImplicitIntegrator< DIM >::getInitialTime | ( | ) | const [inline] |
Return initial integration time.
double SAMRAI::algs::ImplicitIntegrator< DIM >::getFinalTime | ( | ) | const [inline] |
Return final integration time.
double SAMRAI::algs::ImplicitIntegrator< DIM >::getCurrentTime | ( | ) | const [inline] |
Return current integration time.
double SAMRAI::algs::ImplicitIntegrator< DIM >::getCurrentDt | ( | ) | const [inline] |
Return current timestep.
int SAMRAI::algs::ImplicitIntegrator< DIM >::getIntegratorStep | ( | ) | const [inline] |
Return current integration step number.
int SAMRAI::algs::ImplicitIntegrator< DIM >::getMaxIntegratorSteps | ( | ) | const [inline] |
Return maximum number of integration steps.
bool SAMRAI::algs::ImplicitIntegrator< DIM >::stepsRemaining | ( | ) | const [inline] |
Return true if the number of integration steps performed by the integrator has not reached the specified maximum; return false otherwise.
void SAMRAI::algs::ImplicitIntegrator< DIM >::printClassData | ( | std::ostream & | os | ) | const [virtual] |
Print out all members of integrator instance to given output stream.
void SAMRAI::algs::ImplicitIntegrator< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | db | ) | [virtual] |
Write out state of object to given database.
When assertion checking is active, the database pointer must be non-null.
Implements SAMRAI::tbox::Serializable.