Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : 8 : #include "Options/String.hpp" 9 : #include "Time/TimeSteppers/ImexRungeKutta.hpp" 10 : #include "Utilities/Serialization/CharmPupable.hpp" 11 : #include "Utilities/TMPL.hpp" 12 : 13 : namespace TimeSteppers { 14 : /*! 15 : * \ingroup TimeSteppersGroup 16 : * \brief A fourth-order Runge-Kutta method with IMEX support. 17 : * 18 : * The coefficients are given as ARK4(3)6L[2]SA in \cite Kennedy2003. 19 : * 20 : * The implicit part is stiffly accurate and L-stable. 21 : * 22 : * The CFL factor/stable step size is 2.1172491998184686. 23 : */ 24 1 : class Rk4Kennedy : public ImexRungeKutta { 25 : public: 26 0 : using options = tmpl::list<>; 27 0 : static constexpr Options::String help = { 28 : "A 4th-order Runge-Kutta scheme devised by Kennedy and Carpenter."}; 29 : 30 0 : Rk4Kennedy() = default; 31 0 : Rk4Kennedy(const Rk4Kennedy&) = default; 32 0 : Rk4Kennedy& operator=(const Rk4Kennedy&) = default; 33 0 : Rk4Kennedy(Rk4Kennedy&&) = default; 34 0 : Rk4Kennedy& operator=(Rk4Kennedy&&) = default; 35 0 : ~Rk4Kennedy() override = default; 36 : 37 1 : size_t order() const override; 38 : 39 1 : double stable_step() const override; 40 : 41 1 : size_t imex_order() const override; 42 : 43 1 : size_t implicit_stage_order() const override; 44 : 45 0 : WRAPPED_PUPable_decl_template(Rk4Kennedy); // NOLINT 46 : 47 0 : explicit Rk4Kennedy(CkMigrateMessage* /*unused*/) {} 48 : 49 0 : const ButcherTableau& butcher_tableau() const override; 50 : 51 0 : const ImplicitButcherTableau& implicit_butcher_tableau() const override; 52 : }; 53 : 54 0 : inline bool constexpr operator==(const Rk4Kennedy& /*lhs*/, 55 : const Rk4Kennedy& /*rhs*/) { 56 : return true; 57 : } 58 : 59 0 : inline bool constexpr operator!=(const Rk4Kennedy& lhs, const Rk4Kennedy& rhs) { 60 : return not(lhs == rhs); 61 : } 62 : } // namespace TimeSteppers