51 template<
unsigned NSTEPS>
54 template<
unsigned NSTEPS>
57 template<
unsigned NSTEPS>
82 double dt = Time_pt->dt(0);
83 Weight(1, 0) = 1.0 / dt;
84 Weight(1, 1) = -1.0 / dt;
97 double dt = Time_pt->dt(0);
100 Predictor_weight[0] = 0.0;
101 Predictor_weight[1] = 1.0;
104 Predictor_weight[2] = dt;
132 for (
unsigned i = 1;
i < 3;
i++)
156 for (
unsigned j = 0;
j <
n_dim;
j++)
165 for (
unsigned i = 1;
i < 3;
i++)
196 return Error_weight *
216 return Error_weight *
234 double dt = Time_pt->dt(0);
235 double dtprev = Time_pt->dt(1);
236 Weight(1, 0) = 1.0 / dt + 1.0 / (dt +
dtprev);
259 double dt = Time_pt->dt(0);
260 double dtprev = Time_pt->dt(1);
263 Predictor_weight[0] = 0.0;
264 Predictor_weight[1] = 1.0 - (dt * dt) / (
dtprev *
dtprev);
267 Predictor_weight[3] = (1.0 + dt /
dtprev) * dt;
294 for (
unsigned i = 1;
i < 4;
i++)
318 for (
unsigned j = 0;
j <
n_dim;
j++)
327 for (
unsigned i = 1;
i < 4;
i++)
347 double dt = Time_pt->dt(0);
348 double dtprev = Time_pt->dt(1);
368 return Error_weight *
388 return Error_weight *
405 double dt0 = Time_pt->dt(0);
406 for (
unsigned i = 0;
i < Time_pt->ndt();
i++)
408 if (
dt0 != Time_pt->dt(
i))
410 throw OomphLibError(
"BDF4 currently only works for fixed timesteps \n",
416 double dt = Time_pt->dt(0);
417 Weight(1, 0) = 25.0 / 12.0 / dt;
418 Weight(1, 1) = -48.0 / 12.0 / dt;
419 Weight(1, 2) = 36.0 / 12.0 / dt;
420 Weight(1, 3) = -16.0 / 12.0 / dt;
421 Weight(1, 4) = 3.0 / 12.0 / dt;
502 template<
unsigned NSTEPS>
531 template<
unsigned NSTEPS>
540 for (
unsigned i = 0;
i <
n_dim;
i++)
568 template<
unsigned NSTEPS>
583 throw OomphLibError(
"The Vectors of fcts for values, velocities and "
584 "acceleration must be the same size",
597 if (
n_value >
n_fcts && !Shut_up_in_assign_initial_data_values)
600 message <<
"There are more data values than initial value fcts.\n";
601 message <<
"Only the first " <<
n_fcts <<
" data values will be set\n";
613 if (!Shut_up_in_assign_initial_data_values)
616 message <<
"Ignoring value " <<
j <<
" in assignment of ic.\n";
618 "Newmark<NSTEPS>::assign_initial_data_values",
639 double time_ = Time_pt->time();
643 time_ = Time_pt->time(1);
648 time_ = Time_pt->time(0);
653 time_ = Time_pt->time(0);
658 vect[1] =
Udot - Weight(1, 0) * U - Weight(1, 1) *
U0;
687 template<
unsigned NSTEPS>
689 Node*
const& node_pt,
703 throw OomphLibError(
"The Vectors of fcts for values, velocities and "
704 "acceleration must be the same size",
705 "Newmark<NSTEPS>::assign_initial_data_values",
717 if (
n_value >
n_fcts && !Shut_up_in_assign_initial_data_values)
720 message <<
"There are more nodal values than initial value fcts.\n";
721 message <<
"Only the first " <<
n_fcts <<
" nodal values will be set\n";
738 if (!Shut_up_in_assign_initial_data_values)
741 message <<
"Ignoring value " <<
j <<
" in assignment of ic.\n";
763 double time_ = Time_pt->time();
767 time_ = Time_pt->time(1);
772 time_ = Time_pt->time(0);
777 time_ = Time_pt->time(0);
782 vect[1] =
Udot - Weight(1, 0) * U - Weight(1, 1) *
U0;
830 template<
unsigned NSTEPS>
867 <<
" is not possible with a Newmark scheme "
888 template<
unsigned NSTEPS>
915 vect[1] =
Udot - Weight(1, 0) * U - Weight(1, 1) *
U0;
949 template<
unsigned NSTEPS>
956 time_derivative(1,
data_pt, veloc);
959 time_derivative(2,
data_pt, accel);
982 template<
unsigned NSTEPS>
998 for (
unsigned i = 0;
i <
n_dim;
i++)
1002 veloc[
k][
i] = accel[
k][
i] = 0.0;
1013 for (
unsigned i = 0;
i <
n_dim;
i++)
1038 template<
unsigned NSTEPS>
1041 double dt = Time_pt->dt(0);
1044 Weight(2, 0) = 2.0 / (Beta2 * dt * dt);
1045 Weight(2, 1) = -2.0 / (Beta2 * dt * dt);
1050 Weight(2,
NSTEPS + 1) = -2.0 / (dt * Beta2);
1051 Weight(2,
NSTEPS + 2) = (Beta2 - 1.0) / Beta2;
1054 Weight(1, 0) = Beta1 * dt * Weight(2, 0);
1055 Weight(1, 1) = Beta1 * dt * Weight(2, 1);
1060 Weight(1,
NSTEPS + 1) = 1.0 + Beta1 * dt * Weight(2,
NSTEPS + 1);
1062 dt * (1.0 - Beta1) + Beta1 * dt * Weight(2,
NSTEPS + 2);
1081 template<
unsigned NSTEPS>
1100 veloc[
i] += Newmark_veloc_weight[
t] *
data_pt->value(
t,
i);
1101 accel[
i] += this->weight(2,
t) *
data_pt->value(
t,
i);
1111 if (
data_pt->is_a_copy(
j) ==
false)
1127 template<
unsigned NSTEPS>
1143 for (
unsigned i = 0;
i <
n_dim;
i++)
1147 veloc[
k][
i] = accel[
k][
i] = 0.0;
1158 for (
unsigned i = 0;
i <
n_dim;
i++)
1188 double dt = Time_pt->dt(0);
1189 Weight(2, 0) = 2.0 / (Beta2 * dt * dt);
1190 Weight(2, 1) = -2.0 / (Beta2 * dt * dt);
1191 Weight(2, 2) = -2.0 / (dt * Beta2);
1192 Weight(2, 3) = (Beta2 - 1.0) / Beta2;
1195 Weight(1, 0) = 1.0 / dt;
1196 Weight(1, 1) = -1.0 / dt;
1201 set_newmark_veloc_weights(dt);
1211 double dt = Time_pt->dt(0);
1212 Weight(2, 0) = 2.0 / (Beta2 * dt * dt);
1213 Weight(2, 1) = -2.0 / (Beta2 * dt * dt);
1215 Weight(2, 3) = -2.0 / (dt * Beta2);
1216 Weight(2, 4) = (Beta2 - 1.0) / Beta2;
1219 if (Degrade_to_bdf1_for_first_derivs)
1221 this->Weight(1, 0) = 1.0 / dt;
1222 this->Weight(1, 1) = -1.0 / dt;
1223 unsigned nweights = this->Weight.ncol();
1226 this->Weight(1,
i) = 0.0;
1231 double dtprev = Time_pt->dt(1);
1232 Weight(1, 0) = 1.0 / dt + 1.0 / (dt +
dtprev);
1240 set_newmark_veloc_weights(dt);
1250 double dt = Time_pt->dt(0);
1251 Weight(2, 0) = 2.0 / (Beta2 * dt * dt);
1252 Weight(2, 1) = -2.0 / (Beta2 * dt * dt);
1256 Weight(2, 5) = -2.0 / (dt * Beta2);
1257 Weight(2, 6) = (Beta2 - 1.0) / Beta2;
1261 for (
unsigned i = 0;
i < Time_pt->ndt();
i++)
1263 if (dt != Time_pt->dt(
i))
1265 throw OomphLibError(
"BDF4 currently only works for fixed timesteps \n",
1273 if (Degrade_to_bdf1_for_first_derivs)
1275 this->Weight(1, 0) = 1.0 / dt;
1276 this->Weight(1, 1) = -1.0 / dt;
1277 unsigned nweights = this->Weight.ncol();
1280 this->Weight(1,
i) = 0.0;
1285 Weight(1, 0) = 25.0 / 12.0 / dt;
1286 Weight(1, 1) = -48.0 / 12.0 / dt;
1287 Weight(1, 2) = 36.0 / 12.0 / dt;
1288 Weight(1, 3) = -16.0 / 12.0 / dt;
1289 Weight(1, 4) = 3.0 / 12.0 / dt;
1295 set_newmark_veloc_weights(dt);
void calculate_predicted_positions(Node *const &node_pt)
Function to calculate predicted positions at a node.
void calculate_predicted_values(Data *const &data_pt)
Function to calculate predicted data values in a Data object.
void set_weights()
Set the weights.
void set_predictor_weights()
Function to set the predictor weights.
double temporal_error_in_value(Data *const &data_pt, const unsigned &i)
Compute the error in the value i in a Data structure.
double temporal_error_in_position(Node *const &node_pt, const unsigned &i)
Compute the error in the position i at a node.
void set_error_weights()
Function to set the error weights.
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void set_weights()
Set weights.
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 shift_time_positions(Node *const &node_pt)
This function updates a nodal time history so that we can advance to the next timestep.
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 assign_initial_data_values_stage1(const unsigned t_deriv, Data *const &data_pt)
First step in a two-stage procedure to assign the history values for the Newmark scheme so that the v...
void assign_initial_data_values_stage2(Data *const &data_pt)
Second step in a two-stage procedure to assign the history values for the Newmark scheme so that the ...
void assign_initial_positions_impulsive(Node *const &node_pt)
Initialise the time-history for the values, corresponding to an impulsive start.
void assign_initial_values_impulsive(Data *const &data_pt)
Initialise the time-history for the values, corresponding to an impulsive start.
void assign_initial_data_values(Data *const &data_pt, Vector< InitialConditionFctPt > initial_value_fct, Vector< InitialConditionFctPt > initial_veloc_fct, Vector< InitialConditionFctPt > initial_accel_fct)
Initialise the time-history for the Data values, so that the Newmark representations for current velo...
void set_weights()
Set weights.
void shift_time_positions(Node *const &node_pt)
This function updates a nodal time history so that we can advance to the next timestep.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
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)
double & x(const unsigned &i)
Return the i-th nodal coordinate.
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
double & x_gen(const unsigned &k, const unsigned &i)
Reference to the generalised position x(k,i). ‘Type’: k; Coordinate direction: i.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Faux time-stepper for steady problems. Allows storage for NSTEPS previous values.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
virtual ~TimeStepper()
virtual destructor
ExplicitTimeStepper * Explicit_predictor_pt
Pointer to explicit time stepper to use as predictor if Predict_by_explicit_step is set....
Class to keep track of discrete/continous time. It is essential to have a single Time object when usi...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).