|
SpECTRE
v2026.04.01
|
#include <ClassicalRungeKutta4.hpp>
Public Types | |
| using | options = tmpl::list<> |
| Public Types inherited from TimeStepper | |
| using | provided_time_stepper_interfaces = tmpl::list<TimeStepper> |
Public Member Functions | |
| ClassicalRungeKutta4 (const ClassicalRungeKutta4 &)=default | |
| ClassicalRungeKutta4 & | operator= (const ClassicalRungeKutta4 &)=default |
| ClassicalRungeKutta4 (ClassicalRungeKutta4 &&)=default | |
| ClassicalRungeKutta4 & | operator= (ClassicalRungeKutta4 &&)=default |
| variants::TaggedVariant< Tags::FixedOrder, Tags::VariableOrder > | order () const override |
| The convergence order of the stepper. | |
| double | stable_step () const override |
| Rough estimate of the maximum step size this method can take stably as a multiple of the step for Euler's method. | |
| WRAPPED_PUPable_decl_template (ClassicalRungeKutta4) | |
| ClassicalRungeKutta4 (CkMigrateMessage *) | |
| const ButcherTableau & | butcher_tableau () const override |
| Public Member Functions inherited from TimeSteppers::RungeKutta | |
| uint64_t | number_of_substeps () const override |
| Number of substeps in this TimeStepper. | |
| uint64_t | number_of_substeps_for_error () const override |
| Number of substeps in this TimeStepper when providing an error measure for adaptive time-stepping. | |
| size_t | number_of_past_steps () const override |
| Number of past time steps needed for multi-step method. | |
| bool | monotonic () const override |
| Whether computational and temporal orderings of operations match. | |
| TimeStepId | next_time_id (const TimeStepId ¤t_id, const TimeDelta &time_step) const override |
| The TimeStepId after the current substep. | |
| TimeStepId | next_time_id_for_error (const TimeStepId ¤t_id, const TimeDelta &time_step) const override |
| The TimeStepId after the current substep when providing an error measure for adaptive time-stepping. | |
| Public Member Functions inherited from TimeStepper | |
| WRAPPED_PUPable_abstract (TimeStepper) | |
| template<typename Vars> | |
| void | update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const TimeDelta &time_step) const |
Set u to the value at the end of the current substep. | |
| template<typename Vars> | |
| std::optional< StepperErrorEstimate > | update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const TimeDelta &time_step, const StepperErrorTolerances &tolerances) const |
Set u to the value at the end of the current substep; report the error measure when available. | |
| template<typename Vars> | |
| void | clean_history (const gsl::not_null< TimeSteppers::History< Vars > * > history) const |
| Remove old entries from the history. | |
| template<typename Vars> | |
| bool | dense_update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const double time) const |
| Compute the solution value at a time between steps. To evaluate at a time within a given step, call this method at the start of the step containing the time. The function returns true on success, otherwise the call should be retried after the next substep. | |
| template<typename Vars> | |
| bool | can_change_step_size (const TimeStepId &time_id, const TimeSteppers::History< Vars > &history) const |
| Whether a change in the step size is allowed before taking a step. Step sizes can never be changed on a substep. | |
Static Public Attributes | |
| static constexpr Options::String | help |
| Static Public Attributes inherited from TimeStepper | |
| static constexpr bool | local_time_stepping = false |
| static constexpr bool | imex = false |
The standard 4th-order Runge-Kutta method, given e.g. in https://en.wikipedia.org/wiki/Runge-Kutta_methods that solves equations of the form
\begin{eqnarray}\frac{du}{dt} & = & \mathcal{L}(t,u). \end{eqnarray}
Given a solution \(u(t^n)=u^n\), this stepper computes \(u(t^{n+1})=u^{n+1}\) using the following equations:
\begin{eqnarray}v^{(1)} & = & u^n + dt\cdot \mathcal{L}(t^n, u^n)/2,\\ v^{(2)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt/2, v^{(1)})/2,\\ v^{(3)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt/2, v^{(2)}),\\ v^{(4)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt, v^{(3)}),\\ u^{n+1} & = & (2v^{(1)} + 4v^{(2)} + 2v^{(3)} + v^{(4)} - 3 u^n)/6. \end{eqnarray}
Note that in the implementation, the expression for \(u^{n+1}\) is computed simultaneously with \(v^{(4)}\), so that there are actually only four substeps per step.
The CFL factor/stable step size is 1.3926467817026411.
|
overridevirtual |
Implements TimeSteppers::RungeKutta.
|
overridevirtual |
The convergence order of the stepper.
Implements TimeStepper.
|
overridevirtual |
Rough estimate of the maximum step size this method can take stably as a multiple of the step for Euler's method.
Implements TimeStepper.
|
staticconstexpr |