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

Application class performing the theta timestepping scheme. More...

#include <timestepping.h>

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

Public Member Functions

 ThetaTimestepping (ApplicationBase &app)
 Constructor, receiving the application computing the residual in each timestep.
 
 ThetaTimestepping (ApplicationBase &app, const Residual &res)
 Constructor, receiving the application computing the residual in each timestep and a Residual integrator for computing the vector 1/dt + (1-theta) A.
 
virtual double residual (FEVector &start, const FEVectors &rhs)
 Does nothing and avoids residual function of the base application being called.
 
virtual void solve (FEVector &start, const FEVectors &rhs)
 The actual timestep solver.
 
virtual void declare_parameters (ParameterHandler &param)
 Declare parameters for a parameter file.
 
virtual void initialize (ParameterHandler &param)
 Pure virtual initialization function.
 
void _initialize (ParameterHandler &param)
 Read the parameters.
 
- Public Member Functions inherited from AppFrame::ApplicationCopy
 ApplicationCopy (ApplicationBase &ex_app)
 Constructor for a derived application.
 
 ~ApplicationCopy ()
 
virtual void remesh ()
 Generates the next mesh depending on the mesh generation parameters.
 
virtual void init_vector (FEVector &dst) const
 Initialize vector to problem size.
 
virtual void start_vector (FEVector &dst, std::string caller) const
 Initialize vector to problem size.
 
virtual void Tsolve (FEVector &start, const FEVectors &rhs)
 Solve the dual system assembled with right hand side rhs and return the result in start.
 
virtual double estimate (const FEVectors &src)
 Error estimation.
 
virtual double evaluate (const FEVectors &src)
 Evaluate whatever the simulation was made for.
 
virtual void grid_out (const std::string &filename) const
 Write the mesh in the format specified by the ParameterHandler.
 
virtual void data_out (const std::string &filename, const FEVectors &src)
 Write data in the format specified by the ParameterHandler.
 
virtual std::string id () const
 Return a unique identification string for this application.
 
virtual void notify (const Event &reason)
 Add a reason for assembling.
 
- Public Member Functions inherited from AppFrame::ApplicationBase
 ApplicationBase (boost::shared_ptr< ApplicationData > ex_data=boost::shared_ptr< ApplicationData >())
 Constructor for an application.
 
 ApplicationBase (const ApplicationBase &other)
 Copy constructor.
 
virtual ~ApplicationBase ()
 Virtual destructor.
 
void print_parameters_to_file (ParameterHandler &param, const std::string &file_name, const ParameterHandler::OutputStyle &style)
 Print default parameters for the application to a file.
 
virtual double residual (FEVector &dst, const FEVectors &src, bool apply_boundaries=true)
 Compute residual of src and store it into dst.
 
virtual void data_out (const std::string &filename, const FEVectors &src, const std::vector< std::string >)
 
boost::shared_ptr
< ApplicationData
get_data ()
 Get access to the protected variable data.
 
const boost::shared_ptr
< ApplicationData
get_data () const
 Get read-only access to the protected variable data.
 
virtual void clear ()
 Reset the application class such that a call to initialize() is possible again and will produce the same result as if the object was fresh.
 
void clear_events ()
 Clear all notifications.
 

Static Public Attributes

static const Event new_time
 ThetaTimestepping notifies of this Event if the next point in time is reached.
 
static const Event new_step_size
 ThetaTimestepping notifies of this Event if the time step size has changed.
 

Protected Attributes

TimestepControl control
 
- Protected Attributes inherited from AppFrame::ApplicationCopy
SmartPointer< ApplicationBaseapp
 Pointer to the application this one depends upon.
 
- Protected Attributes inherited from AppFrame::ApplicationBase
boost::shared_ptr
< ApplicationData
data
 Object for auxiliary data.
 
Event notifications
 Accumulate reasons for reassembling here.
 

Private Attributes

double theta
 The control parameter in the range [0,1].
 
bool adaptive
 Use adaptive theta if true.
 
ApplicationResidual default_residual
 Default residual object if the function ApplicationBase::residual() shoud be used.
 
SmartPointer< const Residualcompute_residual
 The Residual object.
 

Additional Inherited Members

- Protected Member Functions inherited from AppFrame::ApplicationBase
void print_caller_name (const std::string &caller_name) const
 Print caller name.
 

Detailed Description

Application class performing the theta timestepping scheme.

The theta scheme is an abstraction of implicit and explicit Euler schemes, the Crank-Nicholson scheme and linear combinations of those. The choice of the actual scheme is controlled by the parameter theta as follows.

For fixed theta, the Crank-Nicholson scheme is the only second order scheme. Nevertheless, further stability may be achieved by choosing theta larger than ½, thereby introducing a first order error term. In order to avoid a loss of convergence order, the adaptive theta scheme can be used, where theta=½+c dt.

The scheme sets the parameters theta time and timestep in ApplicationData. The residual is called with the solution at the previous time as first vector and should compute 1/dt + (1-theta) A. The function ApplicationBase::solve() is called with this result as first vector. It is then up to the underlying application to make sure that the right residual is computed.

A class that might help you implementing the right residuals is ThetaResidual. Refer to the examples Tests::RotatingCone1 and Tests::RotatingCone1 for the use of this class with linear and nonlinear operators.

Author
Guido Kanschat, 2006

Constructor & Destructor Documentation

AppFrame::ThetaTimestepping::ThetaTimestepping ( ApplicationBase app)

Constructor, receiving the application computing the residual in each timestep.

AppFrame::ThetaTimestepping::ThetaTimestepping ( ApplicationBase app,
const Residual res 
)

Constructor, receiving the application computing the residual in each timestep and a Residual integrator for computing the vector 1/dt + (1-theta) A.

Member Function Documentation

void AppFrame::ThetaTimestepping::_initialize ( ParameterHandler &  param)

Read the parameters.

virtual void AppFrame::ThetaTimestepping::declare_parameters ( ParameterHandler &  param)
virtual

Declare parameters for a parameter file.

Pure virtual function MUST be redeclared in derived classes.

Reimplemented from AppFrame::ApplicationCopy.

virtual void AppFrame::ThetaTimestepping::initialize ( ParameterHandler &  param)
virtual

Pure virtual initialization function.

Here, the parameters declared in the constructor are actually read from ParameterHandler.

This function must be overloaded in any derived class using its own values from the parameter file.

Initialization functions of derived classes must make sure to call all functions _initialize() of the base classes.

Reimplemented from AppFrame::ApplicationCopy.

virtual double AppFrame::ThetaTimestepping::residual ( FEVector start,
const FEVectors rhs 
)
virtual

Does nothing and avoids residual function of the base application being called.

Reimplemented from AppFrame::ApplicationCopy.

virtual void AppFrame::ThetaTimestepping::solve ( FEVector start,
const FEVectors rhs 
)
virtual

The actual timestep solver.

Reimplemented from AppFrame::ApplicationCopy.

Member Data Documentation

bool AppFrame::ThetaTimestepping::adaptive
private

Use adaptive theta if true.

SmartPointer<const Residual> AppFrame::ThetaTimestepping::compute_residual
private

The Residual object.

TimestepControl AppFrame::ThetaTimestepping::control
protected
ApplicationResidual AppFrame::ThetaTimestepping::default_residual
private

Default residual object if the function ApplicationBase::residual() shoud be used.

const Event AppFrame::ThetaTimestepping::new_step_size
static

ThetaTimestepping notifies of this Event if the time step size has changed.

const Event AppFrame::ThetaTimestepping::new_time
static

ThetaTimestepping notifies of this Event if the next point in time is reached.

double AppFrame::ThetaTimestepping::theta
private

The control parameter in the range [0,1].


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