26 #ifndef OOMPH_TRAPEZOID_RULE_H
27 #define OOMPH_TRAPEZOID_RULE_H
110 double dtr = dt / dtprev;
135 err, OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
158 OOMPH_EXCEPTION_LOCATION,
159 OOMPH_CURRENT_FUNCTION);
167 OOMPH_EXCEPTION_LOCATION,
168 OOMPH_CURRENT_FUNCTION);
182 std::string err =
"Initial derivative of TR has not been set";
184 err, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
192 <<
"Solving for derivative at initial time."
193 <<
" Warning: if residual is not in the correct form this may fail."
213 unsigned n_value = data_pt->
nvalue();
220 for (
unsigned j = 0; j < n_value; j++)
230 double ynm1 = data_pt->
value(1, j);
231 double yn = data_pt->
value(0, j);
232 double fn = (2 / dtn) * (yn - ynm1) - fnm1;
241 std::cout <<
"didn't shift derivatives" << std::endl;
267 unsigned n_dim = node_pt->
ndim();
268 for (
unsigned j = 0; j < n_dim; j++)
274 double predicted_value = 0.0;
278 for (
unsigned i = 1;
i < 4;
i++)
293 unsigned n_value = data_pt->
nvalue();
294 for (
unsigned j = 0; j < n_value; j++)
301 double predicted_value = 0.0;
302 for (
unsigned i = 1;
i < 4;
i++)
A class that represents a collection of data; each Data object may contain many different individual ...
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
virtual bool is_a_copy() const
Return a boolean to indicate whether the Data objact contains any copied values. A base Data object c...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
A vector in the mathematical sense, initially developed for linear algebra type applications....
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
virtual bool position_is_a_copy() const
Return whether any position coordinate has been copied (always false)
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
virtual void get_dvaluesdt(DoubleVector &f)
Get the time derivative of all values (using get_inverse_mass_matrix_times_residuals(....
void set_dofs(const DoubleVector &dofs)
Set the values of the dofs.
Trapezoid rule time stepping scheme.
unsigned order() const
Return the actual order of the scheme.
void shift_time_positions(Node *const &node_pt)
This function advances the time history of the positions at a node.
Vector< double > Predictor_weight
Private data for the predictor weights.
void calculate_predicted_values(Data *const &data_pt)
Function to calculate predicted data values in a Data object.
virtual ~TR()
Virtual destructor.
unsigned predicted_value_index() const
Location of predicted value.
void assign_initial_positions_impulsive(Node *const &node_pt)
Initialise the time-history for the nodal positions corresponding to an impulsive start.
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.
void operator=(const TR &dummy)=delete
Broken assignment operator.
double Error_weight
Private data for the error weight.
void calculate_predicted_positions(Node *const &node_pt)
Function to calculate predicted positions at a node.
void assign_initial_values_impulsive(Data *const &data_pt)
Initialise the time-history for the Data values, corresponding to an impulsive start.
void actions_before_timestep(Problem *problem_pt)
Interface for any actions that need to be performed before a time step.
void set_error_weights()
Set the weights for the error computation, (currently empty – overwrite for specific scheme)
void setup_initial_derivative(Problem *problem_pt)
unsigned derivative_index(const unsigned &t) const
Location in data of derivatives.
unsigned ndt() const
Number of timestep increments that need to be stored by the scheme.
TR(const bool &adaptive=false)
Constructor, storage for two history derivatives (one for TR and one for the predictor step),...
unsigned nprev_values() const
Number of previous values available.
bool Initial_derivative_set
void actions_after_timestep(Problem *problem_pt)
Interface for any actions that need to be performed after a time step.
double temporal_error_in_position(Node *const &node_pt, const unsigned &i)
Compute the error in the position i at a node.
void set_predictor_weights()
Function to set the predictor weights.
TR(const TR &dummy)=delete
Broken copy constructor.
void set_weights()
Set the weights.
double temporal_error_in_value(Data *const &data_pt, const unsigned &i)
Compute the error in the value i in a Data structure.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
DenseMatrix< double > Weight
Storage for the weights associated with the timestepper.
Time * Time_pt
Pointer to discrete time storage scheme.
Time *const & time_pt() const
Access function for the pointer to time (const version)
bool Adaptive_Flag
Boolean variable to indicate whether the timestepping scheme can be adaptive.
double & dt(const unsigned &t=0)
Return the value of the t-th stored timestep (t=0: present; t>0: previous).
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...