24#ifndef VULPES_TIMEINTEGRATION_BUTCHER_TABLES_HPP_
25#define VULPES_TIMEINTEGRATION_BUTCHER_TABLES_HPP_
37 const double b_sum = std::accumulate(t.b.begin(), t.b.end(), 0.0);
38 const bool b_sum_1 = (std::abs(b_sum - 1.) < 1e-14);
42 for (std::size_t i = 0; i < T::n_stages; ++i) {
43 const auto Arow = std::accumulate(t.A[i].begin(), t.A[i].end(), 0.0);
44 const bool A_row_sum_c = (std::abs(Arow - t.c[i]) < 1e-14);
52template <
typename T, std::
size_t N>
53constexpr std::array<T, N + 1>
padStartArray(
const std::array<T, N>& input) {
54 std::array<T, N + 1> result{};
55 for (std::size_t i = 0; i < N; ++i) {
56 result[i + 1] = input[i];
61template <
typename T, std::
size_t N>
62constexpr std::array<T, N + 1>
padEndArray(
const std::array<T, N>& input) {
63 std::array<T, N + 1> result{};
64 for (std::size_t i = 0; i < N; ++i) {
70template <
typename T, std::
size_t N>
72 const std::array<std::array<T, N>, N>& input) {
73 std::array<std::array<T, N + 1>, N + 1> result{};
74 for (std::size_t i = 0; i < N; ++i) {
75 for (std::size_t j = 0; j < N; ++j) {
76 result[i + 1][j + 1] = input[i][j];
82template <
typename T, std::
size_t N>
84 const std::array<std::array<T, N>, N>& input) {
85 std::array<std::array<T, N + 1>, N + 1> result{};
86 for (std::size_t i = 0; i < N; ++i) {
87 for (std::size_t j = 0; j < N; ++j) {
88 result[i + 1][j] = input[i][j];
94template <
typename ButcherTableType>
96 return (ButcherTableType::c.back() == 1.0) &&
97 (ButcherTableType::A.back() == ButcherTableType::b);
102template <std::
size_t S>
112template <std::
size_t S>
164 {{0, 0, 0}, {0.5, 0, 0}, {0, 0.75, 0}}};
165 static inline constexpr ArrayType b = {2. / 9., 1. / 3., 4. / 9.};
171 {{0, 0, 0}, {1., 0, 0}, {0.25, 0.25, 0}}};
172 static inline constexpr ArrayType b = {1. / 6., 1. / 6., 2. / 3.};
178 {{0, 0, 0, 0}, {0.5, 0, 0, 0}, {0, 0.5, 0, 0}, {0, 0, 1., 0}}};
179 static inline constexpr ArrayType b = {1. / 6., 1. / 3., 1. / 3., 1. / 6.};
185 {{0, 0, 0}, {.25, .25, 0}, {0.0, 1.0, 0.0}}};
186 static inline constexpr ArrayType b = {1. / 6., 4. / 6., 1. / 6.};
195 {{0, 0, 0}, {.25, .25, 0}, {1. / 6., 4. / 6., 1. / 6.}}};
196 static inline constexpr ArrayType b = {1. / 6., 4. / 6., 1. / 6.};
203 {1. / 6., 1. / 6., 0, 0},
204 {1. / 12., 0.5, 1. / 12., 0},
205 {1. / 8., 3. / 8., 3. / 8., 1. / 8.}}};
206 static inline constexpr ArrayType b = {1. / 8., 3. / 8., 3. / 8., 1. / 8.};
207 static inline constexpr ArrayType c = {0, 1. / 3., 2. / 3., 1.0};
212 {{1, 0, 0}, {-1. / 12., 5. / 12., 0}, {0, 0.75, 0.25}}};
220 static inline constexpr double gamma = 0.58578643762690495124;
221 static inline constexpr double d = 0.29289321881345247562;
222 static inline constexpr double w = 0.3535533905932737622;
231 {1. / 6., 1. / 2., 0, 0},
232 {-0.5, 0.5, 0.5, 0.0},
233 {1.5, -1.5, 0.5, 0.5}}};
235 static inline constexpr ArrayType c = {0.5, 2. / 3., 0.5, 1.};
254template <
typename PlainButcher>
256 static inline constexpr std::size_t
n_stages = PlainButcher::n_stages;
265template <
typename PlainButcher>
267 static inline constexpr std::size_t
n_stages = PlainButcher::n_stages + 1;
333 {11. / 18, 1. / 18., 0, 0, 0},
334 {5. / 6., -5. / 6., 0.5, 0, 0},
335 {0.25, 7. / 4., 3. / 4., -7. / 4., 0}}};
337 0.25, 7. / 4., 3. / 4., -7. / 4., 0};
341 {1. / 6., 0.5, 0, 0},
343 {1.5, -1.5, 0.5, 0.5}}});
345 static inline constexpr ArrayType c = {0, 0.5, 2. / 3., 0.5, 1.};
Definition butcher_tables.hpp:34
constexpr std::array< T, N+1 > padStartArray(const std::array< T, N > &input)
Definition butcher_tables.hpp:53
constexpr std::array< T, N+1 > padEndArray(const std::array< T, N > &input)
Definition butcher_tables.hpp:62
constexpr std::array< std::array< T, N+1 >, N+1 > padTopRightMat(const std::array< std::array< T, N >, N > &input)
Definition butcher_tables.hpp:83
constexpr bool checkButcherTable(const T &t)
Definition butcher_tables.hpp:36
constexpr std::array< std::array< T, N+1 >, N+1 > padTopLeftMat(const std::array< std::array< T, N >, N > &input)
Definition butcher_tables.hpp:71
constexpr bool checkFSAL()
Definition butcher_tables.hpp:95
Definition butcher_tables.hpp:32
Definition cell_manager.hpp:38
Definition butcher_tables.hpp:324
static constexpr ArrayType c
Definition butcher_tables.hpp:345
static constexpr MatrixType A_im
Definition butcher_tables.hpp:338
static constexpr MatrixType A_ex
Definition butcher_tables.hpp:330
ButcherTable< n_stages >::ArrayType ArrayType
Definition butcher_tables.hpp:326
static constexpr bool has_explicit_part
Definition butcher_tables.hpp:329
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:325
static constexpr bool has_implicit_part
Definition butcher_tables.hpp:328
static constexpr ArrayType b_ex
Definition butcher_tables.hpp:336
static constexpr ArrayType b_im
Definition butcher_tables.hpp:344
ButcherTable< n_stages >::MatrixType MatrixType
Definition butcher_tables.hpp:327
Definition butcher_tables.hpp:284
Definition butcher_tables.hpp:132
static constexpr ArrayType c
Definition butcher_tables.hpp:135
static constexpr ArrayType b
Definition butcher_tables.hpp:134
static constexpr MatrixType A
Definition butcher_tables.hpp:133
Definition butcher_tables.hpp:113
static constexpr ArrayType b_im
Definition butcher_tables.hpp:122
static constexpr ArrayType c
Definition butcher_tables.hpp:123
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:114
ButcherTable< S >::ArrayType ArrayType
Definition butcher_tables.hpp:115
ButcherTable< S >::MatrixType MatrixType
Definition butcher_tables.hpp:116
static constexpr MatrixType A_im
Definition butcher_tables.hpp:121
static constexpr ArrayType b_ex
Definition butcher_tables.hpp:120
static constexpr MatrixType A_ex
Definition butcher_tables.hpp:119
static constexpr bool has_explicit_part
Definition butcher_tables.hpp:118
static constexpr bool has_implicit_part
Definition butcher_tables.hpp:117
Definition butcher_tables.hpp:103
static constexpr MatrixType A
Definition butcher_tables.hpp:107
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:106
static constexpr ArrayType b
Definition butcher_tables.hpp:108
static constexpr ArrayType c
Definition butcher_tables.hpp:109
std::array< double, S > ArrayType
Definition butcher_tables.hpp:104
std::array< std::array< double, S >, S > MatrixType
Definition butcher_tables.hpp:105
Definition butcher_tables.hpp:287
Definition butcher_tables.hpp:193
static constexpr MatrixType A
Definition butcher_tables.hpp:194
static constexpr ArrayType b
Definition butcher_tables.hpp:196
static constexpr ArrayType c
Definition butcher_tables.hpp:197
Definition butcher_tables.hpp:288
Definition butcher_tables.hpp:200
static constexpr ArrayType c
Definition butcher_tables.hpp:207
static constexpr ArrayType b
Definition butcher_tables.hpp:206
static constexpr MatrixType A
Definition butcher_tables.hpp:201
Definition butcher_tables.hpp:285
Definition butcher_tables.hpp:156
static constexpr ArrayType b
Definition butcher_tables.hpp:158
static constexpr MatrixType A
Definition butcher_tables.hpp:157
static constexpr ArrayType c
Definition butcher_tables.hpp:159
Definition butcher_tables.hpp:255
static constexpr MatrixType A_ex
Definition butcher_tables.hpp:260
ButcherTable< n_stages >::ArrayType ArrayType
Definition butcher_tables.hpp:257
ButcherTable< n_stages >::MatrixType MatrixType
Definition butcher_tables.hpp:258
static constexpr bool has_explicit_part
Definition butcher_tables.hpp:259
static constexpr ArrayType c
Definition butcher_tables.hpp:262
static constexpr ArrayType b_ex
Definition butcher_tables.hpp:261
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:256
Definition butcher_tables.hpp:293
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:294
ButcherTable< n_stages >::ArrayType ArrayType
Definition butcher_tables.hpp:295
static constexpr ArrayType b_im
Definition butcher_tables.hpp:305
static constexpr ArrayType b_ex
Definition butcher_tables.hpp:301
static constexpr bool has_explicit_part
Definition butcher_tables.hpp:298
static constexpr MatrixType A_ex
Definition butcher_tables.hpp:299
ButcherTable< n_stages >::MatrixType MatrixType
Definition butcher_tables.hpp:296
static constexpr ArrayType c
Definition butcher_tables.hpp:307
static constexpr MatrixType A_im
Definition butcher_tables.hpp:303
static constexpr bool has_implicit_part
Definition butcher_tables.hpp:297
Definition butcher_tables.hpp:279
Definition butcher_tables.hpp:126
static constexpr ArrayType c
Definition butcher_tables.hpp:129
static constexpr ArrayType b
Definition butcher_tables.hpp:128
static constexpr MatrixType A
Definition butcher_tables.hpp:127
Definition butcher_tables.hpp:280
Definition butcher_tables.hpp:144
static constexpr ArrayType b
Definition butcher_tables.hpp:146
static constexpr ArrayType c
Definition butcher_tables.hpp:147
static constexpr MatrixType A
Definition butcher_tables.hpp:145
Definition butcher_tables.hpp:266
static constexpr MatrixType A_im
Definition butcher_tables.hpp:271
static constexpr bool has_implicit_part
Definition butcher_tables.hpp:270
static constexpr ArrayType b_im
Definition butcher_tables.hpp:273
ButcherTable< n_stages >::MatrixType MatrixType
Definition butcher_tables.hpp:269
ButcherTable< n_stages >::ArrayType ArrayType
Definition butcher_tables.hpp:268
static constexpr ArrayType c
Definition butcher_tables.hpp:275
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:267
Definition butcher_tables.hpp:311
static constexpr MatrixType A_ex
Definition butcher_tables.hpp:317
static constexpr ArrayType b_im
Definition butcher_tables.hpp:320
ButcherTable< n_stages >::ArrayType ArrayType
Definition butcher_tables.hpp:313
static constexpr bool has_explicit_part
Definition butcher_tables.hpp:316
static constexpr MatrixType A_im
Definition butcher_tables.hpp:319
static constexpr bool has_implicit_part
Definition butcher_tables.hpp:315
ButcherTable< n_stages >::MatrixType MatrixType
Definition butcher_tables.hpp:314
static constexpr ArrayType c
Definition butcher_tables.hpp:321
static constexpr ArrayType b_ex
Definition butcher_tables.hpp:318
static constexpr std::size_t n_stages
Definition butcher_tables.hpp:312
Definition butcher_tables.hpp:286
Definition butcher_tables.hpp:183
static constexpr ArrayType b
Definition butcher_tables.hpp:186
static constexpr ArrayType c
Definition butcher_tables.hpp:187
static constexpr MatrixType A
Definition butcher_tables.hpp:184
Definition butcher_tables.hpp:290
Definition butcher_tables.hpp:228
static constexpr ArrayType b
Definition butcher_tables.hpp:234
static constexpr MatrixType A
Definition butcher_tables.hpp:229
static constexpr ArrayType c
Definition butcher_tables.hpp:235
Definition butcher_tables.hpp:138
static constexpr MatrixType A
Definition butcher_tables.hpp:139
static constexpr ArrayType b
Definition butcher_tables.hpp:140
static constexpr ArrayType c
Definition butcher_tables.hpp:141
Definition butcher_tables.hpp:289
Definition butcher_tables.hpp:210
static constexpr MatrixType A
Definition butcher_tables.hpp:211
static constexpr ArrayType c
Definition butcher_tables.hpp:214
static constexpr ArrayType b
Definition butcher_tables.hpp:213
Definition butcher_tables.hpp:282
Definition butcher_tables.hpp:176
static constexpr ArrayType b
Definition butcher_tables.hpp:179
static constexpr MatrixType A
Definition butcher_tables.hpp:177
static constexpr ArrayType c
Definition butcher_tables.hpp:180
Definition butcher_tables.hpp:150
static constexpr MatrixType A
Definition butcher_tables.hpp:151
static constexpr ArrayType b
Definition butcher_tables.hpp:152
static constexpr ArrayType c
Definition butcher_tables.hpp:153
Definition butcher_tables.hpp:162
static constexpr MatrixType A
Definition butcher_tables.hpp:163
static constexpr ArrayType b
Definition butcher_tables.hpp:165
static constexpr ArrayType c
Definition butcher_tables.hpp:166
Definition butcher_tables.hpp:281
Definition butcher_tables.hpp:169
static constexpr ArrayType c
Definition butcher_tables.hpp:173
static constexpr MatrixType A
Definition butcher_tables.hpp:170
static constexpr ArrayType b
Definition butcher_tables.hpp:172
Definition butcher_tables.hpp:291
Definition butcher_tables.hpp:219
static constexpr ArrayType b
Definition butcher_tables.hpp:224
static constexpr double gamma
Definition butcher_tables.hpp:220
static constexpr double w
Definition butcher_tables.hpp:222
static constexpr double d
Definition butcher_tables.hpp:221
static constexpr MatrixType A
Definition butcher_tables.hpp:223
static constexpr ArrayType c
Definition butcher_tables.hpp:225