43 std::ostringstream error_stream;
45 <<
"Empty default function called.\n"
46 <<
"The function must return the solution x of the linear system\n"
48 <<
"in order for the object to be used by an ExplicitTimeStepper.\n"
49 <<
"NOTE: It is the responsibility of the object to set the size \n"
50 <<
" of the vector x\n";
54 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
62 std::ostringstream error_stream;
64 <<
"Empty default function called.\n"
65 <<
"The function must return the current values of the degrees of \n"
66 <<
"freedom in the object.\n"
67 <<
"Note: It is the responsibility of the object to set the size\n"
71 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
80 std::ostringstream error_stream;
82 <<
"Empty default function called.\n"
83 <<
"The function must return the t'th history values of the degrees of \n"
84 <<
"freedom in the object.\n"
85 <<
"Note: It is the responsibility of the object to set the size\n"
89 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
97 std::ostringstream error_stream;
99 <<
"Empty default function called.\n"
100 <<
"The function must set the current values of the degrees of \n"
101 <<
"freedom in the object.\n";
104 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
113 const double& lambda,
const DoubleVector& increment_dofs)
115 std::ostringstream error_stream;
117 <<
"Empty default function called.\n"
118 <<
"The function must add lambda multiplied by the contents of the\n"
119 <<
"input vector to the degrees of freedom in the object.\n"
120 <<
"Note: It is the responsibility of the object to ensure that the\n"
121 <<
" the degrees of freedom are in the same order as those \n"
122 <<
" returned by get_dvaluesdt()\n";
125 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
134 std::ostringstream error_stream;
135 error_stream <<
"Empty default function called.\n"
136 <<
"The function must return a reference to the local time in "
140 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
149 std::ostringstream error_stream;
151 <<
"Empty default function called.\n"
152 <<
"The function must return a pointer to an oomph-lib Time object.\n";
154 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
178 object_pt->
time() += dt;
189 template<
unsigned ORDER>
193 std::ostringstream error_stream;
194 error_stream <<
"Timestep not implemented for order " << ORDER <<
"\n";
196 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
223 object_pt->
time() += 0.5 * dt;
253 object_pt->
time() += 0.5 * dt;
298 object_pt->
time() += dt;
326 template<
unsigned ORDER>
329 Type =
"LowStorageRungeKutta";
335 template<
unsigned ORDER>
339 std::ostringstream error_stream;
340 error_stream <<
"Timestep not implemented for order " << ORDER <<
"\n";
342 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
351 Type =
"LowStorageRungeKutta";
355 A[1] = -567301805773.0 / 1357537059087.0;
356 A[2] = -2404267990393.0 / 2016746695238.0;
357 A[3] = -3550918686646.0 / 2091501179385.0;
358 A[4] = -1275806237668.0 / 842570457699.0;
361 B[0] = 1432997174477.0 / 9575080441755.0;
362 B[1] = 5161836677717.0 / 13612068292357.0;
363 B[2] = 1720146321549.0 / 2090206949498.0;
364 B[3] = 3134564353537.0 / 4481467310338.0;
365 B[4] = 2277821191437.0 / 14882151754819.0;
369 C[1] = 2526269341429.0 / 6820363962896.0;
370 C[2] = 2006345519317.0 / 3224310063776.0;
371 C[3] = 2802321613138.0 / 2924317926251.0;
384 const double initial_time = object_pt->
time();
392 for (
unsigned i = 0;
i < 5;
i++)
400 const unsigned n_dof = minv_res.
nrow();
408 for (
unsigned n = 0; n < n_dof; n++)
411 k[n] += dt * minv_res[n];
417 object_pt->
time() = initial_time + C[
i] * dt;
430 using namespace StringConversion;
437 unsigned tnm1 = tn + 1;
438 unsigned tnm2 = tnm1 + 1;
444 if (std::abs(dt - object_pt->
time_pt()->
dt(0)) > 1
e-15)
447 "Inconsistent dts! Predictor is stepping by " +
to_string(dt);
450 err, OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
455 double dtnm1 = object_pt->
time_pt()->
dt(1);
456 double dtnm2 = object_pt->
time_pt()->
dt(2);
486 object_pt->
time() += dt;
505 double denom = pow(dtnm1, 4) * dtnm2 + 2 * pow(dtnm1, 3) * pow(dtnm2, 2) +
506 pow(dtnm1, 2) * pow(dtnm2, 3);
509 -(2 * pow(dtn, 3) * dtnm1 * dtnm2 + pow(dtn, 3) * pow(dtnm2, 2) +
510 3 * pow(dtn, 2) * pow(dtnm1, 2) * dtnm2 +
511 3 * pow(dtn, 2) * dtnm1 * pow(dtnm2, 2) + pow(dtn, 2) * pow(dtnm2, 3) -
512 pow(dtnm1, 4) * dtnm2 - 2 * pow(dtnm1, 3) * pow(dtnm2, 2) -
513 pow(dtnm1, 2) * pow(dtnm2, 3)) /
517 -(-pow(dtn, 3) * pow(dtnm1, 2) - 2 * pow(dtn, 3) * dtnm1 * dtnm2 -
518 pow(dtn, 3) * pow(dtnm2, 2) - pow(dtn, 2) * pow(dtnm1, 3) -
519 3 * pow(dtn, 2) * pow(dtnm1, 2) * dtnm2 -
520 3 * pow(dtn, 2) * dtnm1 * pow(dtnm2, 2) - pow(dtn, 2) * pow(dtnm2, 3)) /
524 -(pow(dtn, 3) * pow(dtnm1, 2) + pow(dtn, 2) * pow(dtnm1, 3)) / denom;
527 -(-pow(dtn, 3) * pow(dtnm1, 2) * dtnm2 -
528 pow(dtn, 3) * dtnm1 * pow(dtnm2, 2) -
529 2 * pow(dtn, 2) * pow(dtnm1, 3) * dtnm2 -
530 3 * pow(dtn, 2) * pow(dtnm1, 2) * pow(dtnm2, 2) -
531 pow(dtn, 2) * dtnm1 * pow(dtnm2, 3) - dtn * pow(dtnm1, 4) * dtnm2 -
532 2 * dtn * pow(dtnm1, 3) * pow(dtnm2, 2) -
533 dtn * pow(dtnm1, 2) * pow(dtnm2, 3)) /
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
unsigned nrow() const
access function to the number of global rows.
A vector in the mathematical sense, initially developed for linear algebra type applications....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Function that is used to advance the solution by time dt.
void set_weights(const double &dtn, const double &dtnm1, const double &dtnm2)
Calculate the weights for this set of step sizes.
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Overload function that is used to advance time in the object reference by object_pt by an amount dt.
Class for objects than can be advanced in time by an Explicit Timestepper. WARNING: For explicit time...
virtual void add_to_dofs(const double &lambda, const DoubleVector &increment_dofs)
Function that adds the values to the dofs.
virtual void get_dofs(DoubleVector &dofs) const
Function that gets the values of the dofs in the object.
virtual void actions_after_explicit_timestep()
Empty virtual function that can be overloaded to do anything needed after an explicit step.
virtual double & time()
Broken virtual function that should be overloaded to return access to the local time in the object.
virtual Time * time_pt() const
Virtual function that should be overloaded to return a pointer to a Time object.
virtual void actions_before_explicit_stage()
Empty virtual function to do anything needed before a stage of an explicit time step (Runge-Kutta ste...
virtual void set_dofs(const DoubleVector &dofs)
Function that sets the values of the dofs in the object.
virtual void get_dvaluesdt(DoubleVector &minv_res)
A single virtual function that returns the residuals vector multiplied by the inverse mass matrix.
virtual void actions_after_explicit_stage()
Empty virtual function that should be overloaded to update any dependent data or boundary conditions ...
virtual void actions_before_explicit_timestep()
Empty virtual function that can be overloaded to do anything needed before an explicit step.
static double Dummy_time_value
Dummy value of time always set to zero.
=========================================================== Runge Kutta Timestepping that uses low st...
LowStorageRungeKutta()
Constructor, set the type.
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Function that is used to advance the solution by time dt.
An OomphLibError object which should be thrown when an run-time error is encountered....
=========================================================== Standard Runge Kutta Timestepping
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Function that is used to advance time in the object.
Class to keep track of discrete/continous time. It is essential to have a single Time object when usi...
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.
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
//////////////////////////////////////////////////////////////////// ////////////////////////////////...