#include <trapezoid_rule.h>
Public Member Functions | |
TR (const bool &adaptive=false) | |
virtual | ~TR () |
Virtual destructor. More... | |
unsigned | order () const |
Return the actual order of the scheme. More... | |
void | set_weights () |
Set the weights. More... | |
void | set_error_weights () |
Set the weights for the error computation, (currently empty – overwrite for specific scheme) More... | |
void | set_predictor_weights () |
Function to set the predictor weights. More... | |
unsigned | nprev_values () const |
Number of previous values available. More... | |
unsigned | derivative_index (const unsigned &t) const |
Location in data of derivatives. More... | |
unsigned | predicted_value_index () const |
Location of predicted value. More... | |
unsigned | ndt () const |
Number of timestep increments that need to be stored by 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 | actions_after_timestep (Problem *problem_pt) |
void | actions_before_timestep (Problem *problem_pt) |
void | setup_initial_derivative (Problem *problem_pt) |
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. More... | |
void | shift_time_positions (Node *const &node_pt) |
This function advances the time history of the positions at a node. 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... | |
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... | |
![]() | |
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 &) | |
Broken copy constructor. More... | |
void | operator= (const TimeStepper &) |
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... | |
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 |
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 () |
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... | |
Public Attributes | |
bool | Initial_derivative_set |
bool | Shift_f |
Private Member Functions | |
TR (const TR &dummy) | |
Broken copy constructor. More... | |
void | operator= (const TR &dummy) |
Broken assignment operator. 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 | |
![]() | |
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 |
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... | |
ExplicitTimeStepper * | Explicit_predictor_pt |
double | Predicted_time |
int | Predictor_storage_index |
The time-index in each Data object where predicted values are stored. -1 if not set. More... | |
Trapezoid rule time stepping scheme.
This method requires a value of dy/dt at the initial time. The implementation of this calculation is exactly the same as is used for explicit time stepping.
The function setup_initial_derivative(Problem* problem_pt) should be called after the initial conditions have been set, but before beginning time stepping, to compute this initial value of dy/dt.
Warning: moving nodes not implemented (I have no test case).
Definition at line 50 of file trapezoid_rule.h.
|
inline |
Constructor, storage for two history derivatives (one for TR and one for the predictor step), one history value, present value and predicted value.
Definition at line 68 of file trapezoid_rule.h.
References oomph::TimeStepper::Adaptive_Flag, Error_weight, Initial_derivative_set, Predictor_weight, Shift_f, and oomph::TimeStepper::Weight.
|
inlinevirtual |
Virtual destructor.
Definition at line 85 of file trapezoid_rule.h.
|
inlineprivate |
Broken copy constructor.
Definition at line 334 of file trapezoid_rule.h.
References oomph::BrokenCopy::broken_copy().
|
inlinevirtual |
Interface for any actions that need to be performed after a time step.
Reimplemented from oomph::TimeStepper.
Definition at line 162 of file trapezoid_rule.h.
References Shift_f.
|
inlinevirtual |
Interface for any actions that need to be performed before a time step.
Reimplemented from oomph::TimeStepper.
Definition at line 168 of file trapezoid_rule.h.
References Initial_derivative_set, and oomph::Global_string_for_annotation::string().
|
inlinevirtual |
Initialise the time-history for the nodal positions corresponding to an impulsive start.
Implements oomph::TimeStepper.
Definition at line 156 of file trapezoid_rule.h.
|
inlinevirtual |
Initialise the time-history for the Data values, corresponding to an impulsive start.
Implements oomph::TimeStepper.
Definition at line 148 of file trapezoid_rule.h.
|
inlinevirtual |
Function to calculate predicted positions at a node.
Reimplemented from oomph::TimeStepper.
Definition at line 257 of file trapezoid_rule.h.
References i, oomph::Node::ndim(), oomph::Node::position_is_a_copy(), predicted_value_index(), Predictor_weight, and oomph::Node::x().
|
inlinevirtual |
Function to calculate predicted data values in a Data object.
Reimplemented from oomph::TimeStepper.
Definition at line 283 of file trapezoid_rule.h.
References i, oomph::Data::is_a_copy(), oomph::Data::nvalue(), predicted_value_index(), Predictor_weight, oomph::Data::set_value(), and oomph::Data::value().
|
inline |
Location in data of derivatives.
Definition at line 127 of file trapezoid_rule.h.
References oomph::Global_string_for_annotation::string().
Referenced by predicted_value_index(), set_predictor_weights(), set_weights(), setup_initial_derivative(), and shift_time_values().
|
inlinevirtual |
Number of timestep increments that need to be stored by the scheme.
Implements oomph::TimeStepper.
Definition at line 144 of file trapezoid_rule.h.
|
inlinevirtual |
Number of previous values available.
Implements oomph::TimeStepper.
Definition at line 124 of file trapezoid_rule.h.
|
inlineprivate |
Broken assignment operator.
Definition at line 338 of file trapezoid_rule.h.
References oomph::BrokenCopy::broken_assign().
|
inlinevirtual |
Return the actual order of the scheme.
Reimplemented from oomph::TimeStepper.
Definition at line 88 of file trapezoid_rule.h.
|
inline |
Location of predicted value.
Definition at line 141 of file trapezoid_rule.h.
References derivative_index().
Referenced by calculate_predicted_positions(), calculate_predicted_values(), temporal_error_in_position(), and temporal_error_in_value().
|
inlinevirtual |
Set the weights for the error computation, (currently empty – overwrite for specific scheme)
Reimplemented from oomph::TimeStepper.
Definition at line 99 of file trapezoid_rule.h.
References oomph::Time::dt(), Error_weight, and oomph::TimeStepper::Time_pt.
|
inlinevirtual |
Function to set the predictor weights.
Reimplemented from oomph::TimeStepper.
Definition at line 107 of file trapezoid_rule.h.
References derivative_index(), oomph::Time::dt(), Predictor_weight, and oomph::TimeStepper::Time_pt.
|
inlinevirtual |
Set the weights.
Implements oomph::TimeStepper.
Definition at line 91 of file trapezoid_rule.h.
References derivative_index(), oomph::Time::dt(), oomph::TimeStepper::Time_pt, and oomph::TimeStepper::Weight.
|
inline |
Definition at line 180 of file trapezoid_rule.h.
References derivative_index(), oomph::Problem::get_dvaluesdt(), Initial_derivative_set, oomph::oomph_info, oomph::Problem::set_dofs(), and Shift_f.
|
inlinevirtual |
This function advances the time history of the positions at a node.
Implements oomph::TimeStepper.
Definition at line 249 of file trapezoid_rule.h.
|
inlinevirtual |
This function updates the Data's time history so that we can advance to the next timestep.
Implements oomph::TimeStepper.
Definition at line 200 of file trapezoid_rule.h.
References derivative_index(), oomph::Time::dt(), oomph::Data::is_a_copy(), oomph::Data::nvalue(), oomph::Data::set_value(), Shift_f, oomph::TimeStepper::time_pt(), and oomph::Data::value().
|
inlinevirtual |
Compute the error in the position i at a node.
Reimplemented from oomph::TimeStepper.
Definition at line 308 of file trapezoid_rule.h.
References Error_weight, predicted_value_index(), and oomph::Node::x().
|
inlinevirtual |
Compute the error in the value i in a Data structure.
Reimplemented from oomph::TimeStepper.
Definition at line 316 of file trapezoid_rule.h.
References Error_weight, predicted_value_index(), and oomph::Data::value().
|
private |
Private data for the error weight.
Definition at line 331 of file trapezoid_rule.h.
Referenced by set_error_weights(), temporal_error_in_position(), temporal_error_in_value(), and TR().
bool oomph::TR::Initial_derivative_set |
Definition at line 243 of file trapezoid_rule.h.
Referenced by actions_before_timestep(), setup_initial_derivative(), and TR().
|
private |
Private data for the predictor weights.
Definition at line 328 of file trapezoid_rule.h.
Referenced by calculate_predicted_positions(), calculate_predicted_values(), set_predictor_weights(), and TR().
bool oomph::TR::Shift_f |
Definition at line 245 of file trapezoid_rule.h.
Referenced by actions_after_timestep(), setup_initial_derivative(), shift_time_values(), and TR().