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::Bdf< SpaceType > Class Template Reference

#include <bdf.hpp>

Detailed Description

template<typename SpaceType>
class Feel::Bdf< SpaceType >

Backward differencing formula time discretization.

A differential equation of the form

$ M u' = A u + f $

is discretized in time as

$ M p'(t_{k+1}) = A u_{k+1} + f_{k+1} $

where p denotes the polynomial of order n in t that interpolates (t_i,u_i) for i = k-n+1,...,k+1.

The approximative time derivative $ p'(t_{k+1}) $ is a linear combination of state vectors u_i:

$ p'(t_{k+1}) = \frac{1}{\Delta t} (\alpha_0 u_{k+1} - \sum_{i=0}^n \alpha_i u_{k+1-i} )$

Thus we have

$ \frac{\alpha_0}{\Delta t} M u_{k+1} = A u_{k+1} + f + M \bar{p} $

with

$ \bar{p} = \frac{1}{\Delta t} \sum_{i=1}^n \alpha_i u_{k+1-i} $

This class stores the n last state vectors in order to be able to calculate $ \bar{p} $. It also provides alpha_i and can extrapolate the the new state from the n last states with a polynomial of order n-1:

$ u_{k+1} \approx \sum_{i=0}^{n-1} \beta_i u_{k-i} $

Inherits Feel::BdfBase.

Public Types

typedef boost::shared_ptr
< bdf_type
bdf_ptrtype
 
typedef Bdf< SpaceType > bdf_type
 
typedef space_type::element_type element_type
 
typedef space_type::element_type element_type
 
typedef node< value_type >::type node_type
 
typedef node< value_type >::type node_type
 
typedef space_type::return_type return_type
 
typedef space_type::return_type return_type
 
typedef boost::shared_ptr
< space_type > 
space_ptrtype
 
typedef boost::shared_ptr
< space_type > 
space_ptrtype
 
typedef SpaceType space_type
 
typedef SpaceType space_type
 
typedef super::time_iterator time_iterator
 
typedef boost::shared_ptr
< element_type > 
unknown_type
 
typedef boost::shared_ptr
< element_type > 
unknown_type
 
typedef std::vector< unknown_type > unknowns_type
 
typedef std::vector< unknown_type > unknowns_type
 
typedef element_type::value_type value_type
 
typedef element_type::value_type value_type
 
- Public Types inherited from Feel::BdfBase
typedef std::vector< double >
::const_iterator 
time_const_iterator
 
typedef std::vector< double >
::iterator 
time_iterator
 
typedef std::vector< double > time_values_map_type
 

Public Member Functions

 Bdf (space_ptrtype const &space)
 
 Bdf (po::variables_map const &vm, space_ptrtype const &space, std::string const &name, std::string const &prefix="")
 
 Bdf (space_ptrtype const &space, std::string const &name)
 
 Bdf (Bdf const &b)
 copy operator
 
bdf_ptrtype deepCopy () const
 return a deep copy of the bdf object
 
element_type derivate (int, scalar_type dt) const
 
element_type derivate (int n) const
 
double derivateCoefficient (int n, size_type i, double dt=1.0) const
 Return the i-th coefficient of the time derivative alpha_i.
 
element_type extrapolate (int n) const
 
double extrapolateCoefficient (int n, size_type i, double dt=1.0) const
 Return the i-th coefficient of the time extrapolation beta_i.
 
void initialize (element_type const &u0)
 
void initialize (unknowns_type const &uv0)
 
void initialize (element_type const &u0)
 
void initialize (unknowns_type const &uv0)
 
void loadCurrent ()
 
BDFTimeScheme order () const
 
element_type poly () const
 
element_type polyDeriv () const
 
double restart ()
 
template<typename container_type >
void setUnknown (int i, typename space_type::template Element< value_type, container_type > const &e)
 
template<typename container_type >
void setUnknown (int i, typename space_type::template Element< value_type, container_type > const &e)
 
template<typename container_type >
void shiftRight (typename space_type::template Element< value_type, container_type > const &u_curr)
 
template<typename container_type >
void shiftRight (typename space_type::template Element< value_type, container_type > const &u_curr)
 
void showMe (std::ostream &__out=std::cout) const
 
void showMe (std::ostream &__out=std::cout) const
 
double start ()
 
double start (element_type const &u0)
 
double start (unknowns_type const &uv0)
 
element_type & unknown (int i)
 Return a vector with the last n state vectors.
 
element_type & unknown (int i)
 Return a vector with the last n state vectors.
 
unknowns_type const & unknowns () const
 Return a vector with the last n state vectors.
 
unknowns_type const & unknowns () const
 Return a vector with the last n state vectors.
 
- Public Member Functions inherited from Feel::BdfBase
 BdfBase (po::variables_map const &vm, std::string name, std::string const &prefix, WorldComm const &worldComm)
 
 BdfBase (std::string name, WorldComm const &worldComm)
 
 BdfBase (BdfBase const &b)
 
bool doRestartAtLastSave () const
 return value of do restart at last save
 
bool isFinished () const
 return true if Bdf is finished, false otherwise
 
bool isRestart () const
 return the value of the bool restart
 
int iteration () const
 return the iteration number
 
double next () const
 
int nRestart () const
 return the number of restarts
 
int numberOfIterationsBetweenOrderChange () const
 return the number of iterations between order change
 
int numberOfIterationsSinceOrderChange () const
 return the number of iterations since last order change
 
BdfBase & operator= (BdfBase const &b)
 
fs::path path ()
 return the relative path where the bdf data is stored
 
double polyCoefficient (int i) const
 
double polyDerivCoefficient (int i) const
 
void print () const
 
bool rankProcInNameOfFiles () const
 
double realTimePerIteration () const
 return the real time in seconds spent in the iteration
 
double restart ()
 restart the bdf
 
fs::path restartPath ()
 
int saveFreq () const
 
bool saveInFile () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 save/load Bdf metadata
 
void setOrder (int order)
 
void setRankProcInNameOfFiles (bool b)
 
void setRestart (bool doRestart)
 
void setRestartAtLastSave (bool b)
 
void setRestartPath (std::string s)
 
void setSaveFreq (int v)
 
void setSaveInFile (bool b)
 
void setSteady (bool steady=true)
 
void setStrategy (int strategy)
 
void setTimeFinal (double T)
 
void setTimeInitial (double ti)
 
void setTimeStep (double dt)
 
virtual void shiftRight ()
 
double start ()
 start the bdf
 
BDFState state () const
 return the state of the BDF
 
BDFStragegy strategy () const
 return the BDF strategy
 
double time () const
 return the current time
 
double timeFinal () const
 return the final time
 
double timeInitial () const
 return the initial time
 
int timeOrder () const
 return the order in time
 
double timeStep () const
 return the final step
 
time_values_map_type timeValues () const
 return vector of time
 
virtual void update ()
 
WorldComm const & worldComm () const
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Member Functions inherited from Feel::BdfBase
void init ()
 
- Protected Attributes inherited from Feel::BdfBase
std::vector< ublas::vector
< double > > 
M_alpha
 Coefficients $ \alpha_i $ of the time bdf discretization.
 
std::vector< ublas::vector
< double > > 
M_beta
 Coefficients $ \beta_i $ of the extrapolation.
 
double M_dt
 timestep
 
int M_iteration
 
int M_iterations_between_order_change
 
int M_last_iteration_since_order_change
 
int M_n_restart
 
std::string M_name
 name of the file holding the bdf data
 
int M_order
 time order
 
int M_order_cur
 
fs::path M_path_save
 path to the directory to store the functions
 
bool M_rankProcInNameOfFiles
 put the rank of the processor in generated files
 
double M_real_time_per_iteration
 real time spent per iteration (in seconds)
 
bool M_restart
 do a restart
 
bool M_restartAtLastSave
 do restart with ti the last save
 
fs::path M_restartPath
 restart path
 
int M_saveFreq
 frequence of save solutions
 
bool M_saveInFile
 Save solutions in file after each step.
 
BDFState M_state
 Bdf state.
 
BDFStragegy M_strategy
 BDF strategy (constant timestep or adaptative timestep)
 
double M_Tf
 final time
 
double M_Ti
 initial time to start
 
double M_time
 time
 
std::vector< int > M_time_orders
 vector that holds the time order at each bdf step
 
time_values_map_type M_time_values_map
 vector that holds the time value at each bdf step
 
boost::timer M_timer
 timer for real time per iteration
 
WorldComm M_worldComm
 mpi communicator tool
 

Constructor & Destructor Documentation

template<typename SpaceType >
Feel::Bdf< SpaceType >::Bdf ( space_ptrtype const &  space)

Constructor

Parameters
spaceapproximation space
norder of the BDF

BDF_ORDER_FOUR:

template<typename SpaceType >
Feel::Bdf< SpaceType >::Bdf ( po::variables_map const &  vm,
space_ptrtype const &  space,
std::string const &  name,
std::string const &  prefix = "" 
)

Constructor

Parameters
spaceapproximation space
norder of the BDF
template<typename SpaceType >
Feel::Bdf< SpaceType >::Bdf ( space_ptrtype const &  space,
std::string const &  name 
)

Constructor

Parameters
spaceapproximation space
namename of the BDF

Member Function Documentation

template<typename SpaceType >
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::derivate ( int  n,
scalar_type  dt 
) const

Returns the right hand side $ \bar{p} $ of the time derivative formula

template<typename SpaceType >
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::derivate ( int  n) const

Returns the right hand side $ \bar{p} \Delta t $ of the time derivative formula. The timestep is taken into account elsewhere, e. g. in the mass matrix.

template<typename SpaceType >
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::extrapolate ( int  n) const

Compute the polynomial extrapolation approximation of order n-1 of u^{n+1} defined by the n stored state vectors

References Feel::Vector< T >::size().

template<typename SpaceType >
void Feel::Bdf< SpaceType >::initialize ( element_type const &  u0)

Initialize all the entries of the unknown vector to be derived with the vector u0 (duplicated)

template<typename SpaceType >
void Feel::Bdf< SpaceType >::initialize ( unknowns_type const &  uv0)

Initialize all the entries of the unknown vector to be derived with a set of vectors uv0

template<typename SpaceType>
void Feel::Bdf< SpaceType >::initialize ( element_type const &  u0)

Initialize all the entries of the unknown vector to be derived with the vector u0 (duplicated)

template<typename SpaceType>
void Feel::Bdf< SpaceType >::initialize ( unknowns_type const &  uv0)

Initialize all the entries of the unknown vector to be derived with a set of vectors uv0

template<typename SpaceType>
BDFTimeScheme Feel::Bdf< SpaceType >::order ( ) const
inline

get the order of the BDF

Returns
order of the BDF
template<typename SpaceType >
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::poly ( ) const

Compute the polynomial extrapolation approximation of order n-1 of u^{n+1} defined by the n stored state vectors

template<typename SpaceType >
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::polyDeriv ( ) const

Returns the right hand side $ \bar{p} $ of the time derivative formula

template<typename SpaceType >
double Feel::Bdf< SpaceType >::restart ( void  )

restart the bdf

template<typename SpaceType >
template<typename container_type >
void Feel::Bdf< SpaceType >::shiftRight ( typename space_type::template Element< value_type, container_type > const &  u_curr)

Update the vectors of the previous time steps by shifting on the right the old values.

Parameters
u_currcurrent (new) value of the state vector
template<typename SpaceType>
template<typename container_type >
void Feel::Bdf< SpaceType >::shiftRight ( typename space_type::template Element< value_type, container_type > const &  u_curr)

Update the vectors of the previous time steps by shifting on the right the old values.

Parameters
u_currcurrent (new) value of the state vector
template<typename SpaceType >
double Feel::Bdf< SpaceType >::start ( )

start the bdf


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