SpECTRE Documentation Coverage Report
Current view: top level - Time/TimeSteppers - DormandPrince5.hpp Hit Total Coverage
Commit: 35a1e98cd3e4fdea528eb8100f99c2f707894fda Lines: 5 18 27.8 %
Date: 2024-04-19 00:10:48
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Defines class DormandPrince5.
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <cstddef>
      10             : 
      11             : #include "Options/String.hpp"
      12             : #include "Time/TimeSteppers/RungeKutta.hpp"
      13             : #include "Utilities/Serialization/CharmPupable.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : namespace TimeSteppers {
      17             : 
      18             : /*!
      19             :  * \ingroup TimeSteppersGroup
      20             :  *
      21             :  * The standard 5th-order Dormand-Prince time stepping method, given e.g. in
      22             :  * Sec. 7.2 of \cite NumericalRecipes.
      23             :  *
      24             :  * \f{eqnarray}{
      25             :  * \frac{du}{dt} & = & \mathcal{L}(t,u).
      26             :  * \f}
      27             :  * Given a solution \f$u(t^n)=u^n\f$, this stepper computes
      28             :  * \f$u(t^{n+1})=u^{n+1}\f$ using the following equations:
      29             :  *
      30             :  * \f{align}{
      31             :  * k^{(1)} & = dt \mathcal{L}(t^n, u^n),\\
      32             :  * k^{(i)} & = dt \mathcal{L}(t^n + c_i dt,
      33             :  *                              u^n + \sum_{j=1}^{i-1} a_{ij} k^{(j)}),
      34             :  *                              \mbox{ } 2 \leq i \leq 6,\\
      35             :  * u^{n+1} & = u^n + \sum_{i=1}^{6} b_i k^{(i)}.
      36             :  * \f}
      37             :  *
      38             :  * Here the coefficients \f$a_{ij}\f$, \f$b_i\f$, and \f$c_i\f$ are given
      39             :  * in e.g. Sec. 7.2 of \cite NumericalRecipes. Note that \f$c_1 = 0\f$.
      40             :  *
      41             :  * The CFL factor/stable step size is 1.6532839463174733.
      42             :  */
      43           1 : class DormandPrince5 : public RungeKutta {
      44             :  public:
      45           0 :   using options = tmpl::list<>;
      46           0 :   static constexpr Options::String help = {
      47             :       "The standard Dormand-Prince 5th-order time stepper."};
      48             : 
      49           0 :   DormandPrince5() = default;
      50           0 :   DormandPrince5(const DormandPrince5&) = default;
      51           0 :   DormandPrince5& operator=(const DormandPrince5&) = default;
      52           0 :   DormandPrince5(DormandPrince5&&) = default;
      53           0 :   DormandPrince5& operator=(DormandPrince5&&) = default;
      54           0 :   ~DormandPrince5() override = default;
      55             : 
      56           1 :   size_t order() const override;
      57             : 
      58           1 :   size_t error_estimate_order() const override;
      59             : 
      60           1 :   double stable_step() const override;
      61             : 
      62           0 :   WRAPPED_PUPable_decl_template(DormandPrince5);  // NOLINT
      63             : 
      64           0 :   explicit DormandPrince5(CkMigrateMessage* /*unused*/) {}
      65             : 
      66           0 :   const ButcherTableau& butcher_tableau() const override;
      67             : };
      68             : 
      69           0 : inline bool constexpr operator==(const DormandPrince5& /*lhs*/,
      70             :                                  const DormandPrince5& /*rhs*/) {
      71             :   return true;
      72             : }
      73             : 
      74           0 : inline bool constexpr operator!=(const DormandPrince5& /*lhs*/,
      75             :                                  const DormandPrince5& /*rhs*/) {
      76             :   return false;
      77             : }
      78             : }  // namespace TimeSteppers

Generated by: LCOV version 1.14