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

Application class performing Newton's iteration. More...

#include <newton.h>

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

Public Member Functions

 Newton (ApplicationBase &app)
 Constructor, receiving the application computing the residual and solving the linear problem.
 
 Newton (ApplicationBase &app, const Residual &res)
 Constructor receiving the application for solving the linear problem and the residual for computing residuals.
 
virtual double residual (FEVector &start, const FEVectors &rhs)
 
virtual void solve (FEVector &start, const FEVectors &rhs)
 The actual Newton solver.
 
virtual void declare_parameters (ParameterHandler &param)
 Declare parameters for a parameter file.
 
void _initialize (ParameterHandler &param)
 Read the parameters.
 
virtual void initialize (ParameterHandler &param)
 Pure virtual initialization function.
 
double threshold (double new_value)
 Set the maximal residual reduction allowed without triggering assembling in the next step.
 
- 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.
 

Public Attributes

ReductionControl control
 Control object for the Newton iteration.
 

Static Public Attributes

static const Event bad_derivative
 The Event set by Newton if convergence is becoming bad and a new matrix should be assembled.
 

Private Attributes

ApplicationResidual default_residual
 Default residual object if the function ApplicationBase::residual() shoud be used.
 
SmartPointer< const Residualcompute_residual
 The Residual object.
 
bool assemble_now
 This flag is set by the function assemble(), indicating that the matrix must be assembled anew upon start.
 
unsigned int n_stepsize_iterations
 A flag used to decide how many stepsize iteration should be made.
 
double assemble_threshold
 Threshold for re-assembling matrix.
 
bool debug_solution
 Print updated solution after each step into file Newton_uNNN?
 
bool debug_update
 Print Newton update after each step into file Newton_dNNN?
 
bool debug_residual
 Print Newton residual after each step into file Newton_rNNN?
 
unsigned int debug
 Write debug output to #deallog; the higher the number, the more output.
 

Additional Inherited Members

- Protected Member Functions inherited from AppFrame::ApplicationBase
void print_caller_name (const std::string &caller_name) const
 Print caller name.
 
- Protected Attributes inherited from AppFrame::ApplicationCopy
SmartPointer< ApplicationBaseapp
 Pointer to the application this one depends upon.
 

Detailed Description

Application class performing Newton's iteration.

Author
Guido Kanschat, 2006

Constructor & Destructor Documentation

AppFrame::Newton::Newton ( ApplicationBase app)

Constructor, receiving the application computing the residual and solving the linear problem.

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

Constructor receiving the application for solving the linear problem and the residual for computing residuals.

Member Function Documentation

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

Read the parameters.

virtual void AppFrame::Newton::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::Newton::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::Newton::residual ( FEVector start,
const FEVectors rhs 
)
virtual

Reimplemented from AppFrame::ApplicationCopy.

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

The actual Newton solver.

Reimplemented from AppFrame::ApplicationCopy.

double AppFrame::Newton::threshold ( double  new_value)

Set the maximal residual reduction allowed without triggering assembling in the next step.

Return the previous value.

Member Data Documentation

bool AppFrame::Newton::assemble_now
private

This flag is set by the function assemble(), indicating that the matrix must be assembled anew upon start.

double AppFrame::Newton::assemble_threshold
private

Threshold for re-assembling matrix.

If the quotient of two consecutive residuals is smaller than this threshold, the system matrix is not assembled in this step.

Note
This parameter should be adjusted to the residual gain of the inner solver.
const Event AppFrame::Newton::bad_derivative
static

The Event set by Newton if convergence is becoming bad and a new matrix should be assembled.

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

The Residual object.

ReductionControl AppFrame::Newton::control

Control object for the Newton iteration.

unsigned int AppFrame::Newton::debug
private

Write debug output to #deallog; the higher the number, the more output.

bool AppFrame::Newton::debug_residual
private

Print Newton residual after each step into file Newton_rNNN?

bool AppFrame::Newton::debug_solution
private

Print updated solution after each step into file Newton_uNNN?

bool AppFrame::Newton::debug_update
private

Print Newton update after each step into file Newton_dNNN?

ApplicationResidual AppFrame::Newton::default_residual
private

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

unsigned int AppFrame::Newton::n_stepsize_iterations
private

A flag used to decide how many stepsize iteration should be made.

Default is the original value of 21.

Enter zero here to turn of stepsize control.

Note
Controlled by Stepsize iterations in parameter file

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