30 #ifndef OOMPH_TRAPEZOID_RULE_H 31 #define OOMPH_TRAPEZOID_RULE_H 88 unsigned order()
const {
return 2;}
112 double dtr = dt/dtprev;
134 OOMPH_CURRENT_FUNCTION);
144 unsigned ndt()
const {
return 2;}
151 OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
159 OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
173 std::string err =
"Initial derivative of TR has not been set";
175 OOMPH_EXCEPTION_LOCATION);
182 oomph_info <<
"Solving for derivative at initial time." 183 <<
" Warning: if residual is not in the correct form this may fail." 203 unsigned n_value = data_pt->
nvalue();
210 for(
unsigned j=0; j<n_value; j++)
220 double ynm1 = data_pt->
value(1, j);
221 double yn = data_pt->
value(0, j);
222 double fn = (2/dtn)*(yn - ynm1) - fnm1;
231 std::cout <<
"didn't shift derivatives" << std::endl;
236 data_pt->
value(0, j));
260 unsigned n_dim = node_pt->
ndim();
261 for(
unsigned j=0;j<n_dim;j++)
267 double predicted_value = 0.0;
271 for(
unsigned i=1;
i<4;
i++)
286 unsigned n_value = data_pt->
nvalue();
287 for(
unsigned j=0;j<n_value;j++)
294 double predicted_value = 0.0;
295 for(
unsigned i=1;
i<4;
i++)
void shift_time_positions(Node *const &node_pt)
This function advances the time history of the positions at a node.
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 ...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
unsigned ndt() const
Number of timestep increments that need to be stored by the scheme.
unsigned predicted_value_index() const
Location of predicted value.
void actions_after_timestep(Problem *problem_pt)
double Error_weight
Private data for the error weight.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned nprev_values() const
Number of previous values available.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
void set_dofs(const DoubleVector &dofs)
Set the values of the dofs.
unsigned derivative_index(const unsigned &t) const
Location in data of derivatives.
void setup_initial_derivative(Problem *problem_pt)
void set_predictor_weights()
Function to set the predictor weights.
bool Initial_derivative_set
void actions_before_timestep(Problem *problem_pt)
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
DenseMatrix< double > Weight
Storage for the weights associated with the timestepper.
virtual void get_dvaluesdt(DoubleVector &f)
Get the time derivative of all values (using get_inverse_mass_matrix_times_residuals(..) with all time steppers set to steady) e.g. for use in explicit time steps. The approach used is slighty hacky, beware if you have a residual which is non-linear or implicit in the derivative or if you have overloaded get_jacobian(...).
double temporal_error_in_value(Data *const &data_pt, const unsigned &i)
Compute the error in the value i in a Data structure.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
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...
double & dt(const unsigned &t=0)
Time * Time_pt
Pointer to discrete time storage scheme.
unsigned order() const
Return the actual order of the scheme.
A class that represents a collection of data; each Data object may contain many different individual ...
void assign_initial_positions_impulsive(Node *const &node_pt)
Initialise the time-history for the nodal positions corresponding to an impulsive start...
double temporal_error_in_position(Node *const &node_pt, const unsigned &i)
Compute the error in the position i at a node.
void operator=(const TR &dummy)
Broken assignment operator.
TR(const TR &dummy)
Broken copy constructor.
Vector< double > Predictor_weight
Private data for the predictor weights.
bool Adaptive_Flag
Boolean variable to indicate whether the timestepping scheme can be adaptive.
void set_weights()
Set the weights.
virtual ~TR()
Virtual destructor.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
void assign_initial_values_impulsive(Data *const &data_pt)
Initialise the time-history for the Data values, corresponding to an impulsive start.
Time *const & time_pt() const
Access function for the pointer to time (const version)
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void set_error_weights()
Set the weights for the error computation, (currently empty – overwrite for specific scheme) ...
virtual bool position_is_a_copy() const
Return whether any position coordinate has been copied (always false)
TR(const bool &adaptive=false)
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.
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
void calculate_predicted_positions(Node *const &node_pt)
Function to calculate predicted positions at a node.
virtual bool is_a_copy() const
Return a boolean to indicate whether the Data objact contains any copied values. A base Data object c...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
void calculate_predicted_values(Data *const &data_pt)
Function to calculate predicted data values in a Data object.