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 "DataStructures/TaggedVariant.hpp"
9 : #include "Options/String.hpp"
10 : #include "Time/TimeSteppers/ImexRungeKutta.hpp"
11 : #include "Utilities/Serialization/CharmPupable.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : namespace TimeSteppers {
15 : /*!
16 : * \ingroup TimeSteppersGroup
17 : * \brief A third-order Runge-Kutta method with IMEX support.
18 : *
19 : * The coefficients are given as ARK3(2)4L[2]SA in \cite Kennedy2003.
20 : *
21 : * The implicit part is stiffly accurate and L-stable.
22 : *
23 : * The CFL factor/stable step size is 1.832102281377816.
24 : */
25 1 : class Rk3Kennedy : public ImexRungeKutta {
26 : public:
27 0 : using options = tmpl::list<>;
28 0 : static constexpr Options::String help = {
29 : "A 3rd-order Runge-Kutta scheme devised by Kennedy and Carpenter."};
30 :
31 0 : Rk3Kennedy() = default;
32 0 : Rk3Kennedy(const Rk3Kennedy&) = default;
33 0 : Rk3Kennedy& operator=(const Rk3Kennedy&) = default;
34 0 : Rk3Kennedy(Rk3Kennedy&&) = default;
35 0 : Rk3Kennedy& operator=(Rk3Kennedy&&) = default;
36 0 : ~Rk3Kennedy() override = default;
37 :
38 1 : variants::TaggedVariant<Tags::FixedOrder, Tags::VariableOrder> order()
39 : const override;
40 :
41 1 : double stable_step() const override;
42 :
43 1 : size_t imex_order() const override;
44 :
45 1 : size_t implicit_stage_order() const override;
46 :
47 0 : WRAPPED_PUPable_decl_template(Rk3Kennedy); // NOLINT
48 :
49 0 : explicit Rk3Kennedy(CkMigrateMessage* /*unused*/) {}
50 :
51 0 : const ButcherTableau& butcher_tableau() const override;
52 :
53 0 : const ImplicitButcherTableau& implicit_butcher_tableau() const override;
54 : };
55 :
56 0 : inline bool constexpr operator==(const Rk3Kennedy& /*lhs*/,
57 : const Rk3Kennedy& /*rhs*/) {
58 : return true;
59 : }
60 :
61 0 : inline bool constexpr operator!=(const Rk3Kennedy& lhs, const Rk3Kennedy& rhs) {
62 : return not(lhs == rhs);
63 : }
64 : } // namespace TimeSteppers
|