OpenFCST: The open-source Fuel Cell Simulation Toolbox
|
Control class for timestepping schemes. More...
#include <timestep_control.h>
Public Types | |
enum | Strategy { uniform, doubling, inner_residual } |
The time stepping strategies. More... | |
Public Member Functions | |
TimestepControl (double start=0., double final=1., double tolerance=1.e-2, double start_step=1.e-2, double print_step=-1., bool autonomous=false) | |
Constructor setting default values. | |
void | parse_parameters (ParameterHandler ¶m) |
double | start () const |
The left end of the time interval. | |
double | final () const |
The right end of the time interval. | |
double | tolerance () const |
The tolerance value controlling the time steps. | |
double | step () const |
The size of the current time step. | |
double | now () const |
The current time. | |
double | next (const double indicator) |
Compute the next time step according to tolerance() and the strategy(). | |
bool | autonomous () const |
Returns true if the problem is autonomous (and therefore, no assembling is required in the time steps). | |
void | start (double) |
Set start value. | |
void | final (double) |
Set final time value. | |
void | tolerance (double) |
Set tolerance. | |
void | strategy (Strategy) |
Set strategy. | |
void | start_step (double) |
Set size of the first step. | |
void | max_step (double) |
Set size of the maximum step size. | |
void | autonomous (bool) |
Set the autonomous flag. | |
void | restart () |
Set now() equal to start(). | |
bool | print () |
Return true if this timestep should be written to disk. | |
void | file_name_format (const char *) |
Set the output name template. | |
const char * | file_name_format () |
Static Public Member Functions | |
static void | declare_parameters (ParameterHandler ¶m) |
Private Attributes | |
double | start_val |
double | final_val |
double | tolerance_val |
Strategy | strategy_val |
double | start_step_val |
double | max_step_val |
double | min_step_val |
double | current_step_val |
The size of the current time step. | |
double | step_val |
bool | is_autonomous |
double | now_val |
double | print_step |
double | next_print_val |
char | format [30] |
Control class for timestepping schemes.
Its main task is determining the size of the next time step and the according point in the time interval. Additionally, it controls writing the solution to a file.
The time stepping strategies.
These controlled by the value of TimestepControl::tolerance() and TimestepControl::start_step().
uniform |
Choose a uniform time step. |
doubling |
Start with the time step size given and double it in every step. |
inner_residual |
Modifies the time step according to the start residual of the inner iteration of the previous time step. This is meant to generate a sequence of time steps approaching infinity fast (for computing a stationary limit), while keeping an inner Newton iteration in its domain of convergence. If this residual was larger than the tolerance, divide the time step by two. If the residual was smaller than one half of tolerance, the time step is doubled. |
AppFrame::TimestepControl::TimestepControl | ( | double | start = 0. , |
double | final = 1. , |
||
double | tolerance = 1.e-2 , |
||
double | start_step = 1.e-2 , |
||
double | print_step = -1. , |
||
bool | autonomous = false |
||
) |
Constructor setting default values.
|
inline |
Returns true if the problem is autonomous (and therefore, no assembling is required in the time steps).
|
inline |
Set the autonomous flag.
|
static |
|
inline |
Set the output name template.
|
inline |
|
inline |
The right end of the time interval.
The control mechanism ensures that the final time step ends at this point.
|
inline |
Set final time value.
|
inline |
Set size of the maximum step size.
double AppFrame::TimestepControl::next | ( | const double | indicator | ) |
Compute the next time step according to tolerance() and the strategy().
Takes the control object of the inner iteration for input.
|
inline |
The current time.
void AppFrame::TimestepControl::parse_parameters | ( | ParameterHandler & | param | ) |
bool AppFrame::TimestepControl::print | ( | ) |
Return true if this timestep should be written to disk.
|
inline |
|
inline |
The left end of the time interval.
|
inline |
Set start value.
|
inline |
Set size of the first step.
This may be overwritten by the time stepping strategy.
|
inline |
The size of the current time step.
|
inline |
Set strategy.
|
inline |
The tolerance value controlling the time steps.
|
inline |
Set tolerance.
|
private |
The size of the current time step.
This may differ from step_val, if we aimed at a print_step.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |