48 std::ostringstream error_stream;
50 <<
"Empty default function called.\n" 51 <<
"The function must return the solution x of the linear system\n" 53 <<
"in order for the object to be used by an ExplicitTimeStepper.\n" 54 <<
"NOTE: It is the responsibility of the object to set the size \n" 55 <<
" of the vector x\n";
59 OOMPH_CURRENT_FUNCTION,
60 OOMPH_EXCEPTION_LOCATION);
68 std::ostringstream error_stream;
70 <<
"Empty default function called.\n" 71 <<
"The function must return the current values of the degrees of \n" 72 <<
"freedom in the object.\n" 73 <<
"Note: It is the responsibility of the object to set the size\n" 77 OOMPH_CURRENT_FUNCTION,
78 OOMPH_EXCEPTION_LOCATION);
88 std::ostringstream error_stream;
90 <<
"Empty default function called.\n" 91 <<
"The function must return the t'th history values of the degrees of \n" 92 <<
"freedom in the object.\n" 93 <<
"Note: It is the responsibility of the object to set the size\n" 97 OOMPH_CURRENT_FUNCTION,
98 OOMPH_EXCEPTION_LOCATION);
107 std::ostringstream error_stream;
109 <<
"Empty default function called.\n" 110 <<
"The function must set the current values of the degrees of \n" 111 <<
"freedom in the object.\n";
114 OOMPH_CURRENT_FUNCTION,
115 OOMPH_EXCEPTION_LOCATION);
125 const double &lambda,
128 std::ostringstream error_stream;
130 <<
"Empty default function called.\n" 131 <<
"The function must add lambda multiplied by the contents of the\n" 132 <<
"input vector to the degrees of freedom in the object.\n" 133 <<
"Note: It is the responsibility of the object to ensure that the\n" 134 <<
" the degrees of freedom are in the same order as those \n" 135 <<
" returned by get_dvaluesdt()\n";
138 OOMPH_CURRENT_FUNCTION,
139 OOMPH_EXCEPTION_LOCATION);
149 std::ostringstream error_stream;
151 <<
"Empty default function called.\n" 152 <<
"The function must return a reference to the local time in the object\n";
155 OOMPH_CURRENT_FUNCTION,
156 OOMPH_EXCEPTION_LOCATION);
165 std::ostringstream error_stream;
167 <<
"Empty default function called.\n" 168 <<
"The function must return a pointer to an oomph-lib Time object.\n";
170 OOMPH_CURRENT_FUNCTION,
171 OOMPH_EXCEPTION_LOCATION);
195 object_pt->
time() += dt;
206 template<
unsigned ORDER>
210 std::ostringstream error_stream;
211 error_stream <<
"Timestep not implemented for order " << ORDER <<
"\n";
213 OOMPH_CURRENT_FUNCTION,
214 OOMPH_EXCEPTION_LOCATION);
241 object_pt->
time() += 0.5*dt;
271 object_pt->
time() += 0.5*dt;
316 object_pt->
time() += dt;
344 template<
unsigned ORDER>
347 Type =
"LowStorageRungeKutta";
353 template<
unsigned ORDER>
358 std::ostringstream error_stream;
359 error_stream <<
"Timestep not implemented for order " << ORDER <<
"\n";
361 OOMPH_CURRENT_FUNCTION,
362 OOMPH_EXCEPTION_LOCATION);
371 Type=
"LowStorageRungeKutta";
375 A[1] = - 567301805773.0/1357537059087.0;
376 A[2] = - 2404267990393.0/2016746695238.0;
377 A[3] = - 3550918686646.0/2091501179385.0;
378 A[4] = - 1275806237668.0/842570457699.0;
381 B[0] = 1432997174477.0/9575080441755.0;
382 B[1] = 5161836677717.0/13612068292357.0;
383 B[2] = 1720146321549.0/2090206949498.0;
384 B[3] = 3134564353537.0/4481467310338.0;
385 B[4] = 2277821191437.0/14882151754819.0;
389 C[1] = 2526269341429.0/6820363962896.0;
390 C[2] = 2006345519317.0/3224310063776.0;
391 C[3] = 2802321613138.0/2924317926251.0;
406 const double initial_time = object_pt->
time();
414 for(
unsigned i=0;
i<5;
i++)
422 const unsigned n_dof= minv_res.
nrow();
427 for(
unsigned n=0;n<n_dof;n++)
430 k[n] += dt*minv_res[n];
436 object_pt->
time() = initial_time + C[
i]*dt;
449 using namespace StringConversion;
456 unsigned tnm1 = tn+1;
457 unsigned tnm2 = tnm1+1;
463 if(std::abs(dt - object_pt->
time_pt()->
dt(0)) > 1
e-15)
468 OOMPH_CURRENT_FUNCTION);
473 double dtnm1 = object_pt->
time_pt()->
dt(1);
474 double dtnm2 = object_pt->
time_pt()->
dt(2);
477 set_weights(dt, dtnm1, dtnm2);
504 object_pt->
time() += dt;
522 double denom = pow(dtnm1,4)*dtnm2 + 2*pow(dtnm1,3)*pow(dtnm2,2)
523 + pow(dtnm1,2)*pow(dtnm2,3);
525 Yn_weight = -(2*pow(dtn,3)*dtnm1*dtnm2 + pow(dtn,3)*pow(dtnm2,2)
526 + 3*pow(dtn,2)*pow(dtnm1,2)*dtnm2
527 + 3*pow(dtn,2)*dtnm1*pow(dtnm2,2) + pow(dtn,2)*pow(dtnm2,3)
528 - pow(dtnm1,4)*dtnm2 - 2*pow(dtnm1,3)*pow(dtnm2,2)
529 - pow(dtnm1,2)*pow(dtnm2,3))/denom;
531 Ynm1_weight = -(-pow(dtn,3)*pow(dtnm1,2) - 2*pow(dtn,3)*dtnm1*dtnm2
532 - pow(dtn,3)*pow(dtnm2,2) - pow(dtn,2)*pow(dtnm1,3)
533 - 3*pow(dtn,2)*pow(dtnm1,2)*dtnm2
534 - 3*pow(dtn,2)*dtnm1*pow(dtnm2,2)
535 - pow(dtn,2)*pow(dtnm2,3))/denom;
537 Ynm2_weight = -(pow(dtn,3)*pow(dtnm1,2) + pow(dtn,2)*pow(dtnm1,3))/denom;
539 Fn_weight = -(-pow(dtn,3)*pow(dtnm1,2)*dtnm2 - pow(dtn,3)*dtnm1*pow(dtnm2,2)
540 - 2*pow(dtn,2)*pow(dtnm1,3)*dtnm2
541 - 3*pow(dtn,2)*pow(dtnm1,2)*pow(dtnm2,2)
542 - pow(dtn,2)*dtnm1*pow(dtnm2,3) - dtn*pow(dtnm1,4)*dtnm2
543 - 2*dtn*pow(dtnm1,3)*pow(dtnm2,2)
544 - dtn*pow(dtnm1,2)*pow(dtnm2,3))/denom;
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Function that is used to advance time in the object.
LowStorageRungeKutta()
Constructor, set the type.
virtual void actions_after_explicit_timestep()
Empty virtual function that can be overloaded to do anything needed after an explicit step...
void timestep(ExplicitTimeSteppableObject *const &object_pt, const double &dt)
Function that is used to advance the solution by time dt.
virtual double & time()
Broken virtual function that should be overloaded to return access to the local time in the object...
Class to keep track of discrete/continous time. It is essential to have a single Time object when usi...
virtual void set_dofs(const DoubleVector &dofs)
Function that sets the values of the dofs in the object.
virtual void actions_after_explicit_stage()
Empty virtual function that should be overloaded to update and slaved data or boundary conditions tha...
virtual void actions_before_explicit_stage()
Empty virtual function to do anything needed before a stage of an explicit time step (Runge-Kutta ste...
void set_weights(const double &dtn, const double &dtnm1, const double &dtnm2)
Calculate the weights for this set of step sizes.
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.
virtual Time * time_pt() const
Virtual function that should be overloaded to return a pointer to a Time object.
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...
virtual void actions_before_explicit_timestep()
Empty virtual function that can be overloaded to do anything needed before an explicit step...
double & dt(const unsigned &t=0)
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.
unsigned nrow() const
access function to the number of global rows.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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*)
virtual void get_dvaluesdt(DoubleVector &minv_res)
A single virtual function that returns the residuals vector multiplied by the inverse mass matrix...
static double Dummy_time_value
Dummy value of time always set to zero.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
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)...