![]() |
|
Self-starting BDF2 timestepper class. More...
#include <self_starting_BDF2_timestepper.h>
Public Types | |
typedef double(* | InitialConditionFctPt) (const double &t) |
Public Member Functions | |
SelfStartingBDF2 (const bool &adaptive=false) | |
SelfStartingBDF2 (const SelfStartingBDF2 &) | |
Broken copy constructor. More... | |
void | operator= (const SelfStartingBDF2 &) |
Broken assignment operator. More... | |
unsigned | order () const |
Return the actual order of the scheme. More... | |
void | turn_on_bdf1_mode () |
bool | bdf1_mode () |
Flag to indicate if the timestepper is working in BDF1 mode. More... | |
void | turn_off_bdf1_mode () |
void | undo_make_steady () |
void | assign_initial_values_impulsive (Data *const &data_pt) |
void | assign_initial_positions_impulsive (Node *const &node_pt) |
void | assign_initial_data_values (Data *const &data_pt, Vector< InitialConditionFctPt > initial_value_fct) |
void | shift_time_values (Data *const &data_pt) |
void | shift_time_positions (Node *const &node_pt) |
void | set_weights () |
void | set_weights_bdf1 () |
Set the weights to those corresponding to BDF1. More... | |
void | set_weights_bdf2 () |
Set the weights to those corresponding to BDF2. 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_bdf1 () |
Function to set the predictor weights corresponding to BDF1. More... | |
void | set_predictor_weights_bdf2 () |
Function to set the predictor weights corresponding to BDF2. More... | |
void | calculate_predicted_positions_bdf1 (Node *const &node_pt) |
Function to calculate predicted positions at a node (BDF1) More... | |
void | calculate_predicted_positions_bdf2 (Node *const &node_pt) |
Function to calculate predicted positions at a node (BDF2) More... | |
void | calculate_predicted_values_bdf1 (Data *const &data_pt) |
Function to calculate predicted data values in a Data object (BDF1) More... | |
void | calculate_predicted_values_bdf2 (Data *const &data_pt) |
Function to calculate predicted data values in a Data object (BDF2) More... | |
void | set_error_weights_bdf1 () |
Function to set the error weights corresponding to BDF1. More... | |
void | set_error_weights_bdf2 () |
Function to set the error weights corresponding to BDF2. More... | |
double | temporal_error_in_position_bdf1 (Node *const &node_pt, const unsigned &i) |
Compute the error in the position i at a node (BDF1) More... | |
double | temporal_error_in_position_bdf2 (Node *const &node_pt, const unsigned &i) |
Compute the error in the position i at a node (BDF2) More... | |
double | temporal_error_in_value_bdf1 (Data *const &data_pt, const unsigned &i) |
Compute the error in the value i in a Data structure (BDF1) More... | |
double | temporal_error_in_value_bdf2 (Data *const &data_pt, const unsigned &i) |
Compute the error in the value i in a Data structure (BDF2) More... | |
![]() | |
TimeStepper (const unsigned &tstorage, const unsigned &max_deriv) | |
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 |
void | make_steady () |
bool | is_steady () const |
bool | predict_by_explicit_step () const |
ExplicitTimeStepper * | explicit_predictor_pt () |
void | set_predictor_pt (ExplicitTimeStepper *_pred_pt) |
void | update_predicted_time (const double &new_time) |
void | check_predicted_values_up_to_date () const |
Check that the predicted values are the ones we want. More... | |
unsigned | predictor_storage_index () const |
void | enable_warning_in_assign_initial_data_values () |
void | disable_warning_in_assign_initial_data_values () |
const DenseMatrix< double > * | weights_pt () const |
Get a (const) pointer to the weights. More... | |
std::string | type () const |
void | time_derivative (const unsigned &i, Data *const &data_pt, Vector< double > &deriv) |
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) |
double | time_derivative (const unsigned &i, Node *const &node_pt, const unsigned &j) |
Time *const & | time_pt () const |
Access function for the pointer to time (const version) More... | |
Time *& | time_pt () |
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 |
bool | adaptive_flag () const |
Function to indicate whether the scheme is adaptive (false by default) More... | |
virtual void | set_predictor_weights () |
virtual void | calculate_predicted_values (Data *const &data_pt) |
virtual void | calculate_predicted_positions (Node *const &node_pt) |
virtual void | set_error_weights () |
virtual double | temporal_error_in_position (Node *const &node_pt, const unsigned &i) |
virtual double | temporal_error_in_value (Data *const &data_pt, const unsigned &i) |
virtual void | actions_before_timestep (Problem *problem_pt) |
virtual void | actions_after_timestep (Problem *problem_pt) |
Private Attributes | |
Vector< double > | Predictor_weight |
Private data for the predictor weights. More... | |
double | Error_weight |
Private data for the error weight. More... | |
bool | BDF1_mode |
Additional Inherited Members | |
![]() | |
Time * | Time_pt |
Pointer to discrete time storage scheme. More... | |
DenseMatrix< double > | Weight |
Storage for the weights associated with the timestepper. More... | |
std::string | Type |
bool | Adaptive_Flag |
bool | Is_steady |
bool | Shut_up_in_assign_initial_data_values |
bool | Predict_by_explicit_step |
ExplicitTimeStepper * | Explicit_predictor_pt |
double | Predicted_time |
int | Predictor_storage_index |
Self-starting BDF2 timestepper class.
Typedef for function that returns the (scalar) initial value at a given value of the continuous time t.
|
inline |
Constructor for the case when we allow adaptive timestepping. Set BDF1_mode flag to false (default is BDF2 mode)
References Global_Physical_Variables::adaptive, oomph::TimeStepper::Adaptive_Flag, i, j, Predictor_weight, oomph::DenseMatrix< T >::resize(), oomph::TimeStepper::Type, and oomph::TimeStepper::Weight.
|
inline |
Broken copy constructor.
References oomph::BrokenCopy::broken_copy().
|
inline |
Initialise the time-history for the Data values, corresponding to given time history, specified by Vector of function pointers.
References j, oomph::TimeStepper::ntstorage(), oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, oomph::Time::time(), oomph::TimeStepper::time(), and oomph::TimeStepper::Time_pt.
|
inlinevirtual |
Initialise the time-history for the nodal positions corresponding to an impulsive start.
Implements oomph::TimeStepper.
References oomph::TimeStepper::adaptive_flag(), i, k, oomph::Node::ndim(), oomph::Node::nposition_type(), oomph::Node::position_is_a_copy(), plotPSD::t, and oomph::Node::x_gen().
|
inlinevirtual |
Initialise the time-history for the Data values, corresponding to an impulsive start.
Implements oomph::TimeStepper.
References oomph::TimeStepper::adaptive_flag(), oomph::Data::is_a_copy(), j, oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, and oomph::Data::value().
|
inline |
void oomph::SelfStartingBDF2::calculate_predicted_positions_bdf1 | ( | Node *const & | node_pt | ) |
Function to calculate predicted positions at a node (BDF1)
Calculate predictions for the positions (BDF1)
References OOMPH_EXCEPTION_LOCATION.
void oomph::SelfStartingBDF2::calculate_predicted_positions_bdf2 | ( | Node *const & | node_pt | ) |
Function to calculate predicted positions at a node (BDF2)
Calculate predictions for the positions (BDF2)
References oomph::TimeStepper::adaptive_flag(), i, j, oomph::Node::ndim(), oomph::Node::position_is_a_copy(), Predictor_weight, and oomph::Node::x().
void oomph::SelfStartingBDF2::calculate_predicted_values_bdf1 | ( | Data *const & | data_pt | ) |
Function to calculate predicted data values in a Data object (BDF1)
Calculate the predicted values and store them at the appropriate location in the data structure (BDF1) This function must be called after the time-values have been shifted!
References OOMPH_EXCEPTION_LOCATION.
void oomph::SelfStartingBDF2::calculate_predicted_values_bdf2 | ( | Data *const & | data_pt | ) |
Function to calculate predicted data values in a Data object (BDF2)
Calculate the predicted values and store them at the appropriate location in the data structure (BDF2) This function must be called after the time-values have been shifted!
References oomph::TimeStepper::adaptive_flag(), i, oomph::Data::is_a_copy(), j, oomph::Data::nvalue(), Predictor_weight, oomph::Data::set_value(), and oomph::Data::value().
|
inlinevirtual |
Number of timestep increments that need to be stored by the scheme.
Implements oomph::TimeStepper.
|
inlinevirtual |
|
inline |
Broken assignment operator.
References oomph::BrokenCopy::broken_assign().
|
inlinevirtual |
void oomph::SelfStartingBDF2::set_error_weights_bdf1 | ( | ) |
Function to set the error weights corresponding to BDF1.
Function that sets the error weights (BDF1)
References OOMPH_EXCEPTION_LOCATION.
void oomph::SelfStartingBDF2::set_error_weights_bdf2 | ( | ) |
Function to set the error weights corresponding to BDF2.
Function that sets the error weights (BDF2)
References oomph::TimeStepper::adaptive_flag(), oomph::Time::dt(), Error_weight, Eigen::bfloat16_impl::pow(), and oomph::TimeStepper::Time_pt.
void oomph::SelfStartingBDF2::set_predictor_weights_bdf1 | ( | ) |
Function to set the predictor weights corresponding to BDF1.
Calculate the predictor weights (BDF1)
References OOMPH_EXCEPTION_LOCATION.
void oomph::SelfStartingBDF2::set_predictor_weights_bdf2 | ( | ) |
Function to set the predictor weights corresponding to BDF2.
Calculate the predictor weights (BDF2)
References oomph::TimeStepper::adaptive_flag(), oomph::Time::dt(), Predictor_weight, and oomph::TimeStepper::Time_pt.
|
inlinevirtual |
Implementation of pure virtual function in base class. Set weights corresponding to either a BDF1 scheme or a BDF2 scheme, depending on the flag.
Implements oomph::TimeStepper.
References BDF1_mode, set_weights_bdf1(), and set_weights_bdf2().
void oomph::SelfStartingBDF2::set_weights_bdf1 | ( | ) |
Set the weights to those corresponding to BDF1.
Assign the values of the weights (BDF1)
/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
References oomph::Time::dt(), oomph::TimeStepper::Time_pt, and oomph::TimeStepper::Weight.
Referenced by set_weights(), turn_on_bdf1_mode(), and undo_make_steady().
void oomph::SelfStartingBDF2::set_weights_bdf2 | ( | ) |
Set the weights to those corresponding to BDF2.
Assign the values of the weights; pass the value of the timestep (BDF2)
References oomph::TimeStepper::adaptive_flag(), oomph::Time::dt(), oomph::TimeStepper::Time_pt, and oomph::TimeStepper::Weight.
Referenced by set_weights(), turn_off_bdf1_mode(), and undo_make_steady().
|
inlinevirtual |
This function advances the time history of the positions at a node.
Implements oomph::TimeStepper.
References oomph::TimeStepper::adaptive_flag(), i, k, oomph::Node::ndim(), oomph::Node::nposition_type(), oomph::TimeStepper::ntstorage(), oomph::Node::position_is_a_copy(), plotPSD::t, Jeffery_Solution::velocity(), oomph::TimeStepper::Weight, and oomph::Node::x_gen().
|
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.
References oomph::TimeStepper::adaptive_flag(), oomph::Data::is_a_copy(), j, oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, oomph::TimeStepper::time_derivative(), oomph::Data::value(), and Jeffery_Solution::velocity().
double oomph::SelfStartingBDF2::temporal_error_in_position_bdf1 | ( | Node *const & | node_pt, |
const unsigned & | i | ||
) |
Compute the error in the position i at a node (BDF1)
Function to compute the error in position i at node (BDF1)
References OOMPH_EXCEPTION_LOCATION.
double oomph::SelfStartingBDF2::temporal_error_in_position_bdf2 | ( | Node *const & | node_pt, |
const unsigned & | i | ||
) |
Compute the error in the position i at a node (BDF2)
Function to compute the error in position i at node (BDF2)
References oomph::TimeStepper::adaptive_flag(), Error_weight, i, and oomph::Node::x().
double oomph::SelfStartingBDF2::temporal_error_in_value_bdf1 | ( | Data *const & | data_pt, |
const unsigned & | i | ||
) |
Compute the error in the value i in a Data structure (BDF1)
Function to calculate the error in the data value i (BDF1)
References OOMPH_EXCEPTION_LOCATION.
double oomph::SelfStartingBDF2::temporal_error_in_value_bdf2 | ( | Data *const & | data_pt, |
const unsigned & | i | ||
) |
Compute the error in the value i in a Data structure (BDF2)
Function to calculate the error in the data value i (BDF2)
References oomph::TimeStepper::adaptive_flag(), Error_weight, i, and oomph::Data::value().
|
inline |
Reset the timestepper to BDF2: Set the "BDF1_mode" flag to false and re-compute the weights
References BDF1_mode, and set_weights_bdf2().
|
inline |
Function to make the time stepper temporarily work as if it is BDF1. This is trivially achieved by resetting the weights to those of BDF1, before setting the weight corresponding to history value 2 to zero.
References BDF1_mode, and set_weights_bdf1().
|
inlinevirtual |
Reset the is_steady status to its default (false) and re-compute the weights
Reimplemented from oomph::TimeStepper.
References BDF1_mode, oomph::TimeStepper::Is_steady, set_weights_bdf1(), and set_weights_bdf2().
|
private |
Bool to indicate if the timestepper is in ‘BDF1’ mode i.e. it behaves just as if it were a BDF1 timestepper. This status may be achieved temporarily by calling turn_on_bdf1_mode(). It's reset to the default BDF2 behaviour by calling turn_off_bdf1_mode().
Referenced by bdf1_mode(), set_weights(), turn_off_bdf1_mode(), turn_on_bdf1_mode(), and undo_make_steady().
|
private |
Private data for the error weight.
Referenced by set_error_weights_bdf2(), temporal_error_in_position_bdf2(), and temporal_error_in_value_bdf2().
Private data for the predictor weights.
Referenced by calculate_predicted_positions_bdf2(), calculate_predicted_values_bdf2(), SelfStartingBDF2(), and set_predictor_weights_bdf2().