Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Feel::Aitken< fs_type > Class Template Reference

#include <aitken.hpp>

Detailed Description

template<typename fs_type>
class Feel::Aitken< fs_type >

Aitken relaxation method for fixed point iterations.

auto Xh = space_type::New(mesh);
auto residual = Xh->element();
auto u_old->element();
auto u_new->element();
AitkenType relaxmethod = (AitkenType)this->vm()["relaxmethod"].as<int>();
Aitken<space_type> aitken( Xh, relaxmethod,init_theta, tol );
//where init_theta is the initial value of relaxation parameter
// if relaxmethod=0(use the AITKEN_STANDARD method)
// else if relaxmethod=1(use the AITKEN_METHOD_1 method)
// relaxmethod=2(use the FIXED_RELAXATION_METHOD method)
in this last case the relaxation parameter theta remains fixed
during the itérations(theta = init_theta) and the particular case (init_theta=1)
corresponds to the case without relaxation
// initialize aitken
aitken.initialize( residual, u_new );
aitken.restart();
while(!aitken.isFinished())
{
u_old = u_new;
commpute u_new;
residual = u_new-u_old;
u_new = aitken.apply(residual, u_new);
aitken.printInfo();
++aitken;
}
Author
Goncalo Pena
Christophe Prud'homme
Vincent Chabannes
space_ptrtype Xh;
space_type::element_type residual( Xh );
space_type::element_type u_old( Xh );
space_type::element_type u_new( Xh );
Aitken<space_type> aitken( Xh );
// initialize aitken
aitken.initialize( residual, u_new );
// reset aitken parameter before entering the fixed point loop
aitken.resetPreviousParameter();
// fixed point loop
for( int i = 0; i < niter; ++i )
{
// do some computation
aitken.SetElement( residual, u_new );
theta = aitken.calculateParameter();
// exploit aitken relaxation parameter
u = theta * u_new + (1-theta)* u_old;
aitken.shiftRight();
u_old = u_new;
}
Author
Vincent Chabannes

Public Types

typedef std::map< std::string,
double > 
convergence_iteration_type
 
typedef std::map< int,
convergence_iteration_type
convergence_type
 
typedef
functionspace_type::template
Element< typename
functionspace_type::value_type,
typename VectorUblas< typename
functionspace_type::value_type >
::range::type > 
element_range_type
 
typedef
functionspace_type::template
Element< typename
functionspace_type::value_type,
typename VectorUblas< typename
functionspace_type::value_type >
::range::type > 
element_range_type
 
typedef
functionspace_type::element_type 
element_type
 
typedef
functionspace_type::element_type 
element_type
 
typedef boost::shared_ptr
< functionspace_type > 
functionspace_ptrtype
 
typedef boost::shared_ptr
< functionspace_type > 
functionspace_ptrtype
 
typedef fs_type functionspace_type
 
typedef fs_type functionspace_type
 
typedef Aitken< fs_type > self_type
 

Public Member Functions

 Aitken (functionspace_ptrtype _Xh, double _failsafeParameter=0.1)
 
 Aitken (Aitken const &tc)
 
 Aitken (functionspace_ptrtype _Xh, AitkenType _aitkenType=AITKEN_STANDARD, double _failsafeParameter=1.0, double _tol=1.0e-6, double _minParam=1e-4)
 
 Aitken (Aitken const &tc)
 
double calculateParameter ()
 
void calculateParameter ()
 
void computeResidualNorm ()
 
convergence_type const & convergenceHistory () const
 
void forceConvergence (bool b)
 
void initialize (element_type const &residual, element_type const &elem)
 
void initialize (element_type const &residual, element_range_type const &elem)
 
bool isFinished ()
 
uint nIterations ()
 
template<typename eltType >
element_type operator() (element_type const &residual, eltType const &elem, bool _forceRelax=false)
 
self_typeoperator++ ()
 
void printInfo ()
 
void relaxationStep (element_type &new_elem)
 
template<typename eltType >
void relaxationStep (eltType &new_elem)
 
void resetPreviousParameter ()
 
double residualNorm ()
 
void restart ()
 
void saveConvergenceHistory (std::string const &fname) const
 
void setElement (element_type const &residual, element_type const &elem)
 
void setElement (element_type const &residual, element_range_type const &elem)
 
void setElement (element_type const &residual, element_type const &elem)
 
void setElement (element_type const &residual, element_range_type const &elem)
 
void setTheta (double v)
 
void setType (AitkenType t)
 set Aitken method type
 
void shiftRight ()
 
void shiftRight ()
 
double theta ()
 
AitkenType type () const
 
 ~Aitken ()
 
 ~Aitken ()
 

Member Typedef Documentation

template<typename fs_type >
typedef std::map<std::string, double> Feel::Aitken< fs_type >::convergence_iteration_type

convergence_iteration_type:

  • int: iteration number
  • double: residual 2-norm
  • double: computing time for the iteration

Constructor & Destructor Documentation

template<typename fs_type >
Feel::Aitken< fs_type >::Aitken ( functionspace_ptrtype  _Xh,
AitkenType  _aitkenType = AITKEN_STANDARD,
double  _failsafeParameter = 1.0,
double  _tol = 1.0e-6,
double  _minParam = 1e-4 
)
inline

Constructor

template<typename fs_type >
Feel::Aitken< fs_type >::Aitken ( Aitken< fs_type > const &  tc)
inline

copy constructor

template<typename fs_type >
Feel::Aitken< fs_type >::~Aitken ( )
inline

destructor

template<typename fs_type >
Feel::Aitken< fs_type >::Aitken ( functionspace_ptrtype  _Xh,
double  _failsafeParameter = 0.1 
)
inline

Constructor

the _failsafeParameter is set to 1 by default. The _failsafeParameter parameter provides an upper value for the relaxation parameter that will not be exceeded.

Parameters
_Xhthe function space from which the element will be used
_failsafeParameterfail safe parameter value
template<typename fs_type >
Feel::Aitken< fs_type >::Aitken ( Aitken< fs_type > const &  tc)
inline

copy constructor

template<typename fs_type >
Feel::Aitken< fs_type >::~Aitken ( )
inline

destructor

Member Function Documentation

template<typename fs_type >
double Feel::Aitken< fs_type >::calculateParameter ( )
Returns
the Aitken parameter
template<typename fs_type >
double Feel::Aitken< fs_type >::calculateParameter ( )

Compute Aitken parameter

template<typename fs_type >
void Feel::Aitken< fs_type >::computeResidualNorm ( )

compute a residual norm for convergence

template<typename fs_type >
convergence_type const& Feel::Aitken< fs_type >::convergenceHistory ( ) const
inline
Returns
the convergence history
template<typename fs_type >
void Feel::Aitken< fs_type >::initialize ( element_type const &  residual,
element_type const &  elem 
)
inline

initiliaze the aitken algorithm

Parameters
residualprevious residual
elemprevious element
template<typename fs_type >
uint Feel::Aitken< fs_type >::nIterations ( )
inline

get number of iterations

template<typename fs_type >
template<typename eltType >
element_type Feel::Aitken< fs_type >::operator() ( element_type const &  residual,
eltType const &  elem,
bool  _forceRelax = false 
)
inline

Compute theta and do a relaxation step : u^{n+1} = theta*u^{n+1} + (1-theta)*u^{n}

template<typename fs_type >
Aitken< fs_type >::self_type & Feel::Aitken< fs_type >::operator++ ( )

shift current step to previous step. After the call, we are ready for the next step.

template<typename fs_type >
void Feel::Aitken< fs_type >::relaxationStep ( element_type &  new_elem)
inline

Do a relaxation step

Parameters
new_elemnew element to compute the relaxation step
template<typename fs_type >
template<typename eltType >
void Feel::Aitken< fs_type >::relaxationStep ( eltType &  new_elem)

Do a relaxation step : u^{n+1} = theta*u^{n+1} + (1-theta)*u^{n}

template<typename fs_type >
void Feel::Aitken< fs_type >::resetPreviousParameter ( )
inline

reset the previous parameter

template<typename fs_type >
void Feel::Aitken< fs_type >::restart ( )

reset the previous parameter

template<typename fs_type >
void Feel::Aitken< fs_type >::saveConvergenceHistory ( std::string const &  fname) const

save converegence history

Parameters
fnamename of the file to save the convergence history
template<typename fs_type >
void Feel::Aitken< fs_type >::setElement ( element_type const &  residual,
element_type const &  elem 
)
inline

Set the current element

Parameters
residualcurrent residual
elemcurrent element
template<typename fs_type >
void Feel::Aitken< fs_type >::setElement ( element_type const &  residual,
element_type const &  elem 
)

Set the current element

template<typename fs_type >
void Feel::Aitken< fs_type >::setElement ( element_type const &  residual,
element_range_type const &  elem 
)

Set the current element

template<typename fs_type >
void Feel::Aitken< fs_type >::setTheta ( double  v)
inline

set theta

template<typename fs_type >
void Feel::Aitken< fs_type >::shiftRight ( )
inline

shift current step to previous step. After the call, we are ready for the next step.

template<typename fs_type >
void Feel::Aitken< fs_type >::shiftRight ( )

shift current step to previous step. After the call, we are ready for the next step.

template<typename fs_type >
double Feel::Aitken< fs_type >::theta ( )
inline

get theta

template<typename fs_type >
AitkenType Feel::Aitken< fs_type >::type ( ) const
inline
Returns
Aitken method type

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

Generated on Fri Oct 25 2013 14:24:28 for Feel++ by doxygen 1.8.4