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 third-order Runge-Kutta method with IMEX support. 17 : * 18 : * The method as published has four stages, but is implemented with 19 : * five as a way to convert it to an EDIRK method. 20 : * 21 : * The coefficients are given as IMEX-SSP3(4,3,3) in \cite Pareschi2005. 22 : * 23 : * While this method can be implemented so that the explicit part is 24 : * strong-stability-preserving, the presentation in \cite Pareschi2005 25 : * is not, and this implementation follows that presentation. See 26 : * \cite HesthavenWarburton section 5.7 for details. 27 : * 28 : * Using this time stepper in a non-IMEX simulation is not 29 : * recommended, as it performs two unused RHS evaluations. When using 30 : * IMEX it performs one extra evaluation because there are more 31 : * implicit steps than explicit. 32 : * 33 : * The implicit portion is L-stable. 34 : * 35 : * The CFL factor/stable step size is 1.25637. 36 : */ 37 1 : class Rk3Pareschi : public ImexRungeKutta { 38 : public: 39 0 : using options = tmpl::list<>; 40 0 : static constexpr Options::String help = { 41 : "A 3rd-order 4 stage Runge-Kutta scheme devised by Pareschi and Russo."}; 42 : 43 0 : Rk3Pareschi() = default; 44 0 : Rk3Pareschi(const Rk3Pareschi&) = default; 45 0 : Rk3Pareschi& operator=(const Rk3Pareschi&) = default; 46 0 : Rk3Pareschi(Rk3Pareschi&&) = default; 47 0 : Rk3Pareschi& operator=(Rk3Pareschi&&) = default; 48 0 : ~Rk3Pareschi() override = default; 49 : 50 1 : size_t order() const override; 51 : 52 1 : double stable_step() const override; 53 : 54 1 : size_t imex_order() const override; 55 : 56 1 : size_t implicit_stage_order() const override; 57 : 58 0 : WRAPPED_PUPable_decl_template(Rk3Pareschi); // NOLINT 59 : 60 0 : explicit Rk3Pareschi(CkMigrateMessage* /*unused*/) {} 61 : 62 0 : const ButcherTableau& butcher_tableau() const override; 63 : 64 0 : const ImplicitButcherTableau& implicit_butcher_tableau() const override; 65 : }; 66 : 67 0 : inline bool constexpr operator==(const Rk3Pareschi& /*lhs*/, 68 : const Rk3Pareschi& /*rhs*/) { 69 : return true; 70 : } 71 : 72 0 : inline bool constexpr operator!=(const Rk3Pareschi& lhs, 73 : const Rk3Pareschi& rhs) { 74 : return not(lhs == rhs); 75 : } 76 : } // namespace TimeSteppers