#include <bdf.hpp>
Backward differencing formula time discretization.
A differential equation of the form
is discretized in time as
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 is a linear combination of state vectors u_i:
Thus we have
with
This class stores the n last state vectors in order to be able to calculate . It also provides alpha_i and can extrapolate the the new state from the n last states with a polynomial of order n-1:
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 |
![]() | |
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. | |
![]() | |
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 | |
![]() | |
void | init () |
![]() | |
std::vector< ublas::vector < double > > | M_alpha |
Coefficients ![]() | |
std::vector< ublas::vector < double > > | M_beta |
Coefficients ![]() | |
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
space | approximation space |
n | order of the BDF |
BDF_ORDER_FOUR:
Feel::Bdf< SpaceType >::Bdf | ( | po::variables_map const & | vm, |
space_ptrtype const & | space, | ||
std::string const & | name, | ||
std::string const & | prefix = "" |
||
) |
Constructor
space | approximation space |
n | order of the BDF |
Feel::Bdf< SpaceType >::Bdf | ( | space_ptrtype const & | space, |
std::string const & | name | ||
) |
Constructor
space | approximation space |
name | name of the BDF |
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::derivate | ( | int | n, |
scalar_type | dt | ||
) | const |
Returns the right hand side of the time derivative formula
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::derivate | ( | int | n | ) | const |
Returns the right hand side of the time derivative formula. The timestep is taken into account elsewhere, e. g. in the mass matrix.
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().
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)
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
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)
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
|
inline |
get the order of the BDF
Compute the polynomial extrapolation approximation of order n-1 of u^{n+1} defined by the n stored state vectors
Bdf< SpaceType >::element_type Feel::Bdf< SpaceType >::polyDeriv | ( | ) | const |
Returns the right hand side of the time derivative formula
double Feel::Bdf< SpaceType >::restart | ( | void | ) |
restart the bdf
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.
u_curr | current (new) value of the state vector |
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.
u_curr | current (new) value of the state vector |
double Feel::Bdf< SpaceType >::start | ( | ) |
start the bdf