Public Types | Public Member Functions | Private Attributes | List of all members
oomph::BDF< NSTEPS > Class Template Reference

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// More...

#include <timesteppers.h>

+ Inheritance diagram for oomph::BDF< NSTEPS >:

Public Types

typedef double(* InitialConditionFctPt) (const double &t)
 Typedef for function that returns the (scalar) initial value at a given value of the continuous time t. More...
 

Public Member Functions

 BDF (const bool &adaptive=false)
 Constructor for the case when we allow adaptive timestepping. More...
 
 BDF (const BDF &)=delete
 Broken copy constructor. More...
 
void operator= (const BDF &)=delete
 Broken assignment operator. More...
 
unsigned order () const
 Return the actual order of the scheme. More...
 
void assign_initial_values_impulsive (Data *const &data_pt)
 Initialise the time-history for the Data values, corresponding to an impulsive start. More...
 
void assign_initial_positions_impulsive (Node *const &node_pt)
 Initialise the time-history for the nodal positions corresponding to an impulsive start. More...
 
void assign_initial_data_values (Data *const &data_pt, Vector< InitialConditionFctPt > initial_value_fct)
 Initialise the time-history for the Data values, corresponding to given time history, specified by Vector of function pointers. More...
 
void shift_time_values (Data *const &data_pt)
 This function updates the Data's time history so that we can advance to the next timestep. For BDF schemes, we simply push the values backwards... More...
 
void shift_time_positions (Node *const &node_pt)
 This function advances the time history of the positions at a node. More...
 
void set_weights ()
 Set the weights. More...
 
unsigned nprev_values () const
 Number of previous values available. More...
 
unsigned ndt () const
 Number of timestep increments that need to be stored by the scheme. More...
 
void set_predictor_weights ()
 Function to set the predictor weights. More...
 
void calculate_predicted_positions (Node *const &node_pt)
 Function to calculate predicted positions at a node. More...
 
void calculate_predicted_values (Data *const &data_pt)
 Function to calculate predicted data values in a Data object. More...
 
void set_error_weights ()
 Function to set the error weights. More...
 
double temporal_error_in_position (Node *const &node_pt, const unsigned &i)
 Compute the error in the position i at a node. More...
 
double temporal_error_in_value (Data *const &data_pt, const unsigned &i)
 Compute the error in the value i in a Data structure. More...
 
void set_weights ()
 ///////////////////////////////////////////////////////////////////// More...
 
void set_predictor_weights ()
 Set the predictor weights (Gresho and Sani pg. 270) More...
 
void calculate_predicted_values (Data *const &data_pt)
 Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted! More...
 
void calculate_predicted_positions (Node *const &node_pt)
 Calculate predictions for the positions. More...
 
void set_error_weights ()
 Set the error weights (Gresho and Sani pg. 270) More...
 
double temporal_error_in_position (Node *const &node_pt, const unsigned &i)
 Function to compute the error in position i at node. More...
 
double temporal_error_in_value (Data *const &data_pt, const unsigned &i)
 Function to calculate the error in the data value i. More...
 
void set_weights ()
 Assign the values of the weights. The scheme used is from Gresho & Sani, Incompressible Flow and the Finite Element Method (advection-diffusion and isothermal laminar flow), 1998, pg. 715 (with some algebraic rearrangement). More...
 
void set_predictor_weights ()
 Calculate the predictor weights. The scheme used is from Gresho & Sani, Incompressible Flow and the Finite Element Method (advection-diffusion and isothermal laminar flow), 1998, pg. 715. More...
 
void calculate_predicted_values (Data *const &data_pt)
 Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted! More...
 
void calculate_predicted_positions (Node *const &node_pt)
 Calculate predictions for the positions. More...
 
void set_error_weights ()
 Function that sets the error weights. More...
 
double temporal_error_in_position (Node *const &node_pt, const unsigned &i)
 Function to compute the error in position i at node. More...
 
double temporal_error_in_value (Data *const &data_pt, const unsigned &i)
 Function to calculate the error in the data value i. More...
 
void set_weights ()
 Assign the values of the weights; pass the value of the timestep. More...
 
void set_predictor_weights ()
 Calculate the predictor weights. More...
 
void calculate_predicted_values (Data *const &data_pt)
 Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted! More...
 
void calculate_predicted_positions (Node *const &node_pt)
 Calculate predictions for the positions. More...
 
void set_error_weights ()
 Function that sets the error weights. More...
 
double temporal_error_in_position (Node *const &node_pt, const unsigned &i)
 Function to compute the error in position i at node. More...
 
double temporal_error_in_value (Data *const &data_pt, const unsigned &i)
 Function to calculate the error in the data value i. More...
 
- Public Member Functions inherited from oomph::TimeStepper
 TimeStepper (const unsigned &tstorage, const unsigned &max_deriv)
 Constructor. Pass the amount of storage required by timestepper (present value + history values) and the order of highest time-derivative. More...
 
 TimeStepper ()
 Broken empty constructor. More...
 
 TimeStepper (const TimeStepper &)=delete
 Broken copy constructor. More...
 
void operator= (const TimeStepper &)=delete
 Broken assignment operator. More...
 
virtual ~TimeStepper ()
 virtual destructor More...
 
unsigned highest_derivative () const
 Highest order derivative that the scheme can compute. More...
 
double & time ()
 Return current value of continous time. More...
 
double time () const
 Return current value of continous time. More...
 
virtual unsigned nprev_values_for_value_at_evaluation_time () const
 Number of previous values needed to calculate the value at the current time. i.e. how many previous values must we loop over to calculate the values at the evaluation time. For most methods this is 1, i.e. just use the value at t_{n+1}. See midpoint method for a counter-example. More...
 
void make_steady ()
 Function to make the time stepper temporarily steady. This is trivially achieved by setting all the weights to zero. More...
 
bool is_steady () const
 Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-dependence) More...
 
bool predict_by_explicit_step () const
 Flag: is adaptivity done by taking a separate step using an ExplicitTimeStepper object? More...
 
ExplicitTimeStepperexplicit_predictor_pt ()
 Get the pointer to the explicit timestepper to use as a predictor in adaptivity if Predict_by_explicit_step is set. More...
 
void set_predictor_pt (ExplicitTimeStepper *_pred_pt)
 Set the pointer to the explicit timestepper to use as a predictor in adaptivity if Predict_by_explicit_step is set. More...
 
void update_predicted_time (const double &new_time)
 Set the time that the current predictions apply for, only needed for paranoid checks when doing Predict_by_explicit_step. More...
 
void check_predicted_values_up_to_date () const
 Check that the predicted values are the ones we want. More...
 
unsigned predictor_storage_index () const
 Return the time-index in each Data where predicted values are stored if the timestepper is adaptive. More...
 
void enable_warning_in_assign_initial_data_values ()
 Enable the output of warnings due to possible fct pointer vector size mismatch in assign_initial_data_values (Default) More...
 
void disable_warning_in_assign_initial_data_values ()
 Disable the output of warnings due to possible fct pointer vector size mismatch in assign_initial_data_values. More...
 
const DenseMatrix< double > * weights_pt () const
 Get a (const) pointer to the weights. More...
 
virtual void undo_make_steady ()
 Reset the is_steady status of a specific TimeStepper to its default and re-assign the weights. More...
 
std::string type () const
 Return string that indicates the type of the timestepper (e.g. "BDF", "Newmark", etc.) More...
 
void time_derivative (const unsigned &i, Data *const &data_pt, Vector< double > &deriv)
 Evaluate i-th derivative of all values in Data and return in Vector deriv[]. More...
 
double time_derivative (const unsigned &i, Data *const &data_pt, const unsigned &j)
 Evaluate i-th derivative of j-th value in Data. More...
 
void time_derivative (const unsigned &i, Node *const &node_pt, Vector< double > &deriv)
 Evaluate i-th derivative of all values in Node and return in Vector deriv[] (this can't be simply combined with time_derivative(.., Data, ...) because of differences with haning nodes). More...
 
double time_derivative (const unsigned &i, Node *const &node_pt, const unsigned &j)
 Evaluate i-th derivative of j-th value in Node. Note the use of the node's value() function so that hanging nodes are taken into account (this is why the functions for Data and Node cannot be combined through simple polymorphism: value is not virtual). More...
 
Time *const & time_pt () const
 Access function for the pointer to time (const version) More...
 
Time *& time_pt ()
 Access function for the pointer to time (can't have a paranoid test for null pointers because this is used as a set function). More...
 
virtual double weight (const unsigned &i, const unsigned &j) const
 Access function for j-th weight for the i-th derivative. More...
 
unsigned ntstorage () const
 Return the number of doubles required to represent history (one for steady) More...
 
bool adaptive_flag () const
 Function to indicate whether the scheme is adaptive (false by default) More...
 
virtual void actions_before_timestep (Problem *problem_pt)
 Interface for any actions that need to be performed before a time step. More...
 
virtual void actions_after_timestep (Problem *problem_pt)
 Interface for any actions that need to be performed after a time step. More...
 

Private Attributes

Vector< double > Predictor_weight
 Private data for the predictor weights. More...
 
double Error_weight
 Private data for the error weight. More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::TimeStepper
TimeTime_pt
 Pointer to discrete time storage scheme. More...
 
DenseMatrix< double > Weight
 Storage for the weights associated with the timestepper. More...
 
std::string Type
 String that indicates the type of the timestepper (e.g. "BDF", "Newmark", etc.) More...
 
bool Adaptive_Flag
 Boolean variable to indicate whether the timestepping scheme can be adaptive. More...
 
bool Is_steady
 Bool to indicate if the timestepper is steady, i.e. its time-derivatives evaluate to zero. This status may be achieved temporarily by calling make_steady(). It can be reset to the appropriate default by the function undo_make_steady(). More...
 
bool Shut_up_in_assign_initial_data_values
 Boolean to indicate if the timestepper will output warnings when setting possibly an incorrect number of initial data values from function pointers. More...
 
bool Predict_by_explicit_step
 Flag: is adaptivity done by taking a separate step using an ExplicitTimeStepper object? More...
 
ExplicitTimeStepperExplicit_predictor_pt
 Pointer to explicit time stepper to use as predictor if Predict_by_explicit_step is set. ??ds merge the two? predict by explicit if pointer is set? More...
 
double Predicted_time
 Store the time that the predicted values currently stored are at, to compare for paranoid checks. More...
 
int Predictor_storage_index
 The time-index in each Data object where predicted values are stored. -1 if not set. More...
 

Detailed Description

template<unsigned NSTEPS>
class oomph::BDF< NSTEPS >

////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

Templated class for BDF-type time-steppers with fixed or variable timestep. 1st time derivative recovered directly from the previous function values. Template parameter represents the number of previous timesteps stored, so that BDF<1> is the classical first order backward Euler scheme. Need to reset weights after every change in timestep.

Definition at line 1164 of file timesteppers.h.

Member Typedef Documentation

◆ InitialConditionFctPt

template<unsigned NSTEPS>
typedef double(* oomph::BDF< NSTEPS >::InitialConditionFctPt) (const double &t)

Typedef for function that returns the (scalar) initial value at a given value of the continuous time t.

Definition at line 1302 of file timesteppers.h.

Constructor & Destructor Documentation

◆ BDF() [1/2]

template<unsigned NSTEPS>
oomph::BDF< NSTEPS >::BDF ( const bool &  adaptive = false)
inline

◆ BDF() [2/2]

template<unsigned NSTEPS>
oomph::BDF< NSTEPS >::BDF ( const BDF< NSTEPS > &  )
delete

Broken copy constructor.

Member Function Documentation

◆ assign_initial_data_values()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::assign_initial_data_values ( Data *const &  data_pt,
Vector< InitialConditionFctPt initial_value_fct 
)
inline

Initialise the time-history for the Data values, corresponding to given time history, specified by Vector of function pointers.

Definition at line 1307 of file timesteppers.h.

References oomph::TimeStepper::ntstorage(), oomph::Data::nvalue(), oomph::Data::set_value(), t, oomph::Time::time(), and oomph::TimeStepper::Time_pt.

◆ assign_initial_positions_impulsive()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::assign_initial_positions_impulsive ( Node *const &  node_pt)
inlinevirtual

Initialise the time-history for the nodal positions corresponding to an impulsive start.

Implements oomph::TimeStepper.

Definition at line 1263 of file timesteppers.h.

References oomph::TimeStepper::adaptive_flag(), i, oomph::Node::ndim(), oomph::Node::nposition_type(), oomph::Node::position_is_a_copy(), t, and oomph::Node::x_gen().

◆ assign_initial_values_impulsive()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::assign_initial_values_impulsive ( Data *const &  data_pt)
inlinevirtual

Initialise the time-history for the Data values, corresponding to an impulsive start.

Implements oomph::TimeStepper.

Definition at line 1234 of file timesteppers.h.

References oomph::TimeStepper::adaptive_flag(), oomph::Data::is_a_copy(), oomph::Data::nvalue(), oomph::Data::set_value(), t, and oomph::Data::value().

◆ calculate_predicted_positions() [1/4]

void oomph::BDF< 1 >::calculate_predicted_positions ( Node *const &  node_pt)
virtual

Calculate predictions for the positions.

Reimplemented from oomph::TimeStepper.

Definition at line 148 of file timesteppers.cc.

References i, oomph::Node::ndim(), oomph::Node::position_is_a_copy(), and oomph::Node::x().

◆ calculate_predicted_positions() [2/4]

void oomph::BDF< 2 >::calculate_predicted_positions ( Node *const &  node_pt)
virtual

Calculate predictions for the positions.

Reimplemented from oomph::TimeStepper.

Definition at line 310 of file timesteppers.cc.

References i, oomph::Node::ndim(), oomph::Node::position_is_a_copy(), and oomph::Node::x().

◆ calculate_predicted_positions() [3/4]

void oomph::BDF< 4 >::calculate_predicted_positions ( Node *const &  node_pt)
virtual

Calculate predictions for the positions.

Reimplemented from oomph::TimeStepper.

Definition at line 453 of file timesteppers.cc.

◆ calculate_predicted_positions() [4/4]

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::calculate_predicted_positions ( Node *const &  node_pt)
virtual

Function to calculate predicted positions at a node.

Reimplemented from oomph::TimeStepper.

◆ calculate_predicted_values() [1/4]

void oomph::BDF< 1 >::calculate_predicted_values ( Data *const &  data_pt)
virtual

Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted!

Reimplemented from oomph::TimeStepper.

Definition at line 115 of file timesteppers.cc.

References i, oomph::Data::is_a_copy(), oomph::Data::nvalue(), oomph::Data::set_value(), and oomph::Data::value().

◆ calculate_predicted_values() [2/4]

void oomph::BDF< 2 >::calculate_predicted_values ( Data *const &  data_pt)
virtual

Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted!

Reimplemented from oomph::TimeStepper.

Definition at line 277 of file timesteppers.cc.

References i, oomph::Data::is_a_copy(), oomph::Data::nvalue(), oomph::Data::set_value(), and oomph::Data::value().

◆ calculate_predicted_values() [3/4]

void oomph::BDF< 4 >::calculate_predicted_values ( Data *const &  data_pt)
virtual

Calculate the predicted values and store them at the appropriate location in the data structure This function must be called after the time-values have been shifted!

Reimplemented from oomph::TimeStepper.

Definition at line 445 of file timesteppers.cc.

◆ calculate_predicted_values() [4/4]

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::calculate_predicted_values ( Data *const &  data_pt)
virtual

Function to calculate predicted data values in a Data object.

Reimplemented from oomph::TimeStepper.

◆ ndt()

template<unsigned NSTEPS>
unsigned oomph::BDF< NSTEPS >::ndt ( ) const
inlinevirtual

Number of timestep increments that need to be stored by the scheme.

Implements oomph::TimeStepper.

Definition at line 1440 of file timesteppers.h.

◆ nprev_values()

template<unsigned NSTEPS>
unsigned oomph::BDF< NSTEPS >::nprev_values ( ) const
inlinevirtual

Number of previous values available.

Implements oomph::TimeStepper.

Definition at line 1434 of file timesteppers.h.

Referenced by oomph::BDF< NSTEPS >::shift_time_values().

◆ operator=()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::operator= ( const BDF< NSTEPS > &  )
delete

Broken assignment operator.

◆ order()

template<unsigned NSTEPS>
unsigned oomph::BDF< NSTEPS >::order ( ) const
inlinevirtual

Return the actual order of the scheme.

Reimplemented from oomph::TimeStepper.

Definition at line 1227 of file timesteppers.h.

◆ set_error_weights() [1/4]

void oomph::BDF< 1 >::set_error_weights ( )
virtual

Set the error weights (Gresho and Sani pg. 270)

Reimplemented from oomph::TimeStepper.

Definition at line 181 of file timesteppers.cc.

◆ set_error_weights() [2/4]

void oomph::BDF< 2 >::set_error_weights ( )
virtual

Function that sets the error weights.

Reimplemented from oomph::TimeStepper.

Definition at line 343 of file timesteppers.cc.

◆ set_error_weights() [3/4]

void oomph::BDF< 4 >::set_error_weights ( )
virtual

Function that sets the error weights.

Reimplemented from oomph::TimeStepper.

Definition at line 461 of file timesteppers.cc.

◆ set_error_weights() [4/4]

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::set_error_weights ( )
virtual

Function to set the error weights.

Reimplemented from oomph::TimeStepper.

◆ set_predictor_weights() [1/4]

void oomph::BDF< 1 >::set_predictor_weights ( )
virtual

Set the predictor weights (Gresho and Sani pg. 270)

Reimplemented from oomph::TimeStepper.

Definition at line 92 of file timesteppers.cc.

◆ set_predictor_weights() [2/4]

void oomph::BDF< 2 >::set_predictor_weights ( )
virtual

Calculate the predictor weights. The scheme used is from Gresho & Sani, Incompressible Flow and the Finite Element Method (advection-diffusion and isothermal laminar flow), 1998, pg. 715.

Reimplemented from oomph::TimeStepper.

Definition at line 253 of file timesteppers.cc.

◆ set_predictor_weights() [3/4]

void oomph::BDF< 4 >::set_predictor_weights ( )
virtual

Calculate the predictor weights.

Reimplemented from oomph::TimeStepper.

Definition at line 429 of file timesteppers.cc.

◆ set_predictor_weights() [4/4]

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::set_predictor_weights ( )
virtual

Function to set the predictor weights.

Reimplemented from oomph::TimeStepper.

◆ set_weights() [1/4]

void oomph::BDF< 1 >::set_weights ( )
virtual

/////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////// Assign the values of the weights

Implements oomph::TimeStepper.

Definition at line 80 of file timesteppers.cc.

◆ set_weights() [2/4]

void oomph::BDF< 2 >::set_weights ( )
virtual

Assign the values of the weights. The scheme used is from Gresho & Sani, Incompressible Flow and the Finite Element Method (advection-diffusion and isothermal laminar flow), 1998, pg. 715 (with some algebraic rearrangement).

Implements oomph::TimeStepper.

Definition at line 232 of file timesteppers.cc.

◆ set_weights() [3/4]

void oomph::BDF< 4 >::set_weights ( )
virtual

Assign the values of the weights; pass the value of the timestep.

Implements oomph::TimeStepper.

Definition at line 402 of file timesteppers.cc.

References i.

◆ set_weights() [4/4]

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::set_weights ( )
virtual

Set the weights.

Implements oomph::TimeStepper.

◆ shift_time_positions()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::shift_time_positions ( Node *const &  node_pt)
inlinevirtual

◆ shift_time_values()

template<unsigned NSTEPS>
void oomph::BDF< NSTEPS >::shift_time_values ( Data *const &  data_pt)
inlinevirtual

This function updates the Data's time history so that we can advance to the next timestep. For BDF schemes, we simply push the values backwards...

Implements oomph::TimeStepper.

Definition at line 1333 of file timesteppers.h.

References oomph::TimeStepper::adaptive_flag(), oomph::Data::is_a_copy(), oomph::BDF< NSTEPS >::nprev_values(), oomph::Data::nvalue(), oomph::Data::set_value(), t, oomph::TimeStepper::time_derivative(), and oomph::Data::value().

◆ temporal_error_in_position() [1/4]

double oomph::BDF< 1 >::temporal_error_in_position ( Node *const &  node_pt,
const unsigned &  i 
)
virtual

Function to compute the error in position i at node.

Reimplemented from oomph::TimeStepper.

Definition at line 190 of file timesteppers.cc.

References i, and oomph::Node::x().

◆ temporal_error_in_position() [2/4]

double oomph::BDF< 2 >::temporal_error_in_position ( Node *const &  node_pt,
const unsigned &  i 
)
virtual

Function to compute the error in position i at node.

Reimplemented from oomph::TimeStepper.

Definition at line 362 of file timesteppers.cc.

References i, and oomph::Node::x().

◆ temporal_error_in_position() [3/4]

double oomph::BDF< 4 >::temporal_error_in_position ( Node *const &  node_pt,
const unsigned &  i 
)
virtual

Function to compute the error in position i at node.

Reimplemented from oomph::TimeStepper.

Definition at line 471 of file timesteppers.cc.

◆ temporal_error_in_position() [4/4]

template<unsigned NSTEPS>
double oomph::BDF< NSTEPS >::temporal_error_in_position ( Node *const &  node_pt,
const unsigned &  i 
)
virtual

Compute the error in the position i at a node.

Reimplemented from oomph::TimeStepper.

◆ temporal_error_in_value() [1/4]

double oomph::BDF< 1 >::temporal_error_in_value ( Data *const &  data_pt,
const unsigned &  i 
)
virtual

Function to calculate the error in the data value i.

Reimplemented from oomph::TimeStepper.

Definition at line 210 of file timesteppers.cc.

References i, and oomph::Data::value().

◆ temporal_error_in_value() [2/4]

double oomph::BDF< 2 >::temporal_error_in_value ( Data *const &  data_pt,
const unsigned &  i 
)
virtual

Function to calculate the error in the data value i.

Reimplemented from oomph::TimeStepper.

Definition at line 382 of file timesteppers.cc.

References i, and oomph::Data::value().

◆ temporal_error_in_value() [3/4]

double oomph::BDF< 4 >::temporal_error_in_value ( Data *const &  data_pt,
const unsigned &  i 
)
virtual

Function to calculate the error in the data value i.

Reimplemented from oomph::TimeStepper.

Definition at line 484 of file timesteppers.cc.

◆ temporal_error_in_value() [4/4]

template<unsigned NSTEPS>
double oomph::BDF< NSTEPS >::temporal_error_in_value ( Data *const &  data_pt,
const unsigned &  i 
)
virtual

Compute the error in the value i in a Data structure.

Reimplemented from oomph::TimeStepper.

Member Data Documentation

◆ Error_weight

template<unsigned NSTEPS>
double oomph::BDF< NSTEPS >::Error_weight
private

Private data for the error weight.

Definition at line 1189 of file timesteppers.h.

◆ Predictor_weight

template<unsigned NSTEPS>
Vector<double> oomph::BDF< NSTEPS >::Predictor_weight
private

Private data for the predictor weights.

Definition at line 1186 of file timesteppers.h.

Referenced by oomph::BDF< NSTEPS >::BDF().


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