OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
AppFrame::TimestepControl Class Reference

Control class for timestepping schemes. More...

#include <timestep_control.h>

Inheritance diagram for AppFrame::TimestepControl:
Inheritance graph
[legend]
Collaboration diagram for AppFrame::TimestepControl:
Collaboration graph
[legend]

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 &param)
 
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 &param)
 

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]
 

Detailed Description

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.

Member Enumeration Documentation

The time stepping strategies.

These controlled by the value of TimestepControl::tolerance() and TimestepControl::start_step().

Enumerator:
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.

Constructor & Destructor Documentation

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.

Member Function Documentation

bool AppFrame::TimestepControl::autonomous ( ) const
inline

Returns true if the problem is autonomous (and therefore, no assembling is required in the time steps).

void AppFrame::TimestepControl::autonomous ( bool  b)
inline

Set the autonomous flag.

static void AppFrame::TimestepControl::declare_parameters ( ParameterHandler &  param)
static
void AppFrame::TimestepControl::file_name_format ( const char *  fmt)
inline

Set the output name template.

const char * AppFrame::TimestepControl::file_name_format ( )
inline
double AppFrame::TimestepControl::final ( ) const
inline

The right end of the time interval.

The control mechanism ensures that the final time step ends at this point.

void AppFrame::TimestepControl::final ( double  t)
inline

Set final time value.

void AppFrame::TimestepControl::max_step ( double  t)
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.

double AppFrame::TimestepControl::now ( ) const
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.

void AppFrame::TimestepControl::restart ( )
inline

Set now() equal to start().

Initialize step() and print() to their initial values.

double AppFrame::TimestepControl::start ( ) const
inline

The left end of the time interval.

void AppFrame::TimestepControl::start ( double  t)
inline

Set start value.

void AppFrame::TimestepControl::start_step ( double  t)
inline

Set size of the first step.

This may be overwritten by the time stepping strategy.

double AppFrame::TimestepControl::step ( ) const
inline

The size of the current time step.

void AppFrame::TimestepControl::strategy ( Strategy  t)
inline

Set strategy.

double AppFrame::TimestepControl::tolerance ( ) const
inline

The tolerance value controlling the time steps.

void AppFrame::TimestepControl::tolerance ( double  t)
inline

Set tolerance.

Member Data Documentation

double AppFrame::TimestepControl::current_step_val
private

The size of the current time step.

This may differ from step_val, if we aimed at a print_step.

double AppFrame::TimestepControl::final_val
private
char AppFrame::TimestepControl::format[30]
private
bool AppFrame::TimestepControl::is_autonomous
private
double AppFrame::TimestepControl::max_step_val
private
double AppFrame::TimestepControl::min_step_val
private
double AppFrame::TimestepControl::next_print_val
private
double AppFrame::TimestepControl::now_val
private
double AppFrame::TimestepControl::print_step
private
double AppFrame::TimestepControl::start_step_val
private
double AppFrame::TimestepControl::start_val
private
double AppFrame::TimestepControl::step_val
private
Strategy AppFrame::TimestepControl::strategy_val
private
double AppFrame::TimestepControl::tolerance_val
private

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