41#ifndef NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_DIRK_TIME_INTEGRATION_SCHEME
42#define NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_DIRK_TIME_INTEGRATION_SCHEME
44#define LUE LIB_UTILITIES_EXPORT
46#include <boost/core/ignore_unused.hpp>
62 std::vector<NekDouble> freeParams)
66 "IMEX DIRK Time integration scheme invalid number "
67 "of free parameters, expected two "
68 "<implicit stages, explicit stages>, received " +
69 std::to_string(freeParams.size()));
71 size_t s = freeParams[0];
72 size_t sigma = freeParams[1];
78 if (order == 1 && s == 1 && sigma == 1)
96 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
100 variant, order, freeParams);
109 std::vector<NekDouble> freeParams)
112 "IMEX DIRK Time integration scheme invalid number "
113 "of free parameters, expected two "
114 "<implicit stages, explicit stages>, received " +
115 std::to_string(freeParams.size()) +
".");
117 size_t s = freeParams[0];
118 size_t sigma = freeParams[1];
120 phase->m_schemeType =
eIMEX;
121 phase->m_variant =
"DIRK";
122 phase->m_order = order;
123 phase->m_name =
"IMEX_DIRK"
125 std::to_string(s) +
"_" + std::to_string(sigma) +
"_" +
126 std::to_string(phase->m_order);
128 phase->m_numsteps = 1;
129 phase->m_numstages = s + 1;
147 if (s == 1 && sigma == 2 && order == 1)
151 else if (s == 1 && sigma == 2 && order == 2)
155 else if (s == 2 && sigma == 2 && order == 2)
159 else if (s == 2 && sigma == 3 && order == 2)
163 else if (s == 2 && sigma == 3 && order == 3)
167 else if (s == 3 && sigma == 4 && order == 3)
171 else if (s == 4 && sigma == 4 && order == 3)
178 "IMEX DIRK Time integration scheme bad type "
179 "(s, sigma, order) : (" +
180 std::to_string(s) +
"," + std::to_string(sigma) +
"," +
181 std::to_string(order) +
"). " +
182 "Allowed combinations: (1,1,1), (1,2,1), (1,2,2), "
183 "(2,2,2), (2,3,2), (2,3,3), (3,4,3), (4,4,3)");
186 phase->m_numMultiStepValues = 1;
187 phase->m_numMultiStepImplicitDerivs = 0;
188 phase->m_numMultiStepExplicitDerivs = 0;
190 phase->m_timeLevelOffset[0] = 0;
192 phase->CheckAndVerify();
200 phase->m_schemeType =
eIMEX;
203 std::string(
"IMEXdirk_1_1_" + std::to_string(phase->m_order));
205 phase->m_numsteps = 2;
206 phase->m_numstages = 1;
224 phase->m_A[0][0][0] = 1.0;
226 phase->m_B[0][0][0] = 1.0;
227 phase->m_B[1][1][0] = 1.0;
229 phase->m_U[0][0] = 1.0;
230 phase->m_U[0][1] = 1.0;
232 phase->m_V[0][0] = 1.0;
233 phase->m_V[0][1] = 1.0;
235 phase->m_numMultiStepValues = 1;
236 phase->m_numMultiStepImplicitDerivs = 0;
237 phase->m_numMultiStepExplicitDerivs = 1;
240 phase->m_timeLevelOffset[0] = 0;
241 phase->m_timeLevelOffset[1] = 0;
243 phase->CheckAndVerify();
252 phase->m_A[0][1][1] = 1.0;
253 phase->m_B[0][0][1] = 1.0;
255 phase->m_A[1][1][0] = 1.0;
256 phase->m_B[1][0][1] = 1.0;
266 phase->m_A[0][1][1] = 1.0 / 2.0;
267 phase->m_B[0][0][1] = 1.0;
269 phase->m_A[1][1][0] = 1.0 / 2.0;
270 phase->m_B[1][0][1] = 1.0;
283 phase->m_A[0][1][1] = glambda;
284 phase->m_A[0][2][1] = 1.0 - glambda;
285 phase->m_A[0][2][2] = glambda;
287 phase->m_B[0][0][1] = 1.0 - glambda;
288 phase->m_B[0][0][2] = glambda;
290 phase->m_A[1][1][0] = glambda;
291 phase->m_A[1][2][0] = gdelta;
292 phase->m_A[1][2][1] = 1.0 - gdelta;
294 phase->m_B[1][0][0] = gdelta;
295 phase->m_B[1][0][1] = 1.0 - gdelta;
308 phase->m_A[0][1][1] = lambda;
309 phase->m_A[0][2][1] = 1.0 - lambda;
310 phase->m_A[0][2][2] = lambda;
312 phase->m_B[0][0][1] = 1.0 - lambda;
313 phase->m_B[0][0][2] = lambda;
315 phase->m_A[1][1][0] = lambda;
316 phase->m_A[1][2][0] = delta;
317 phase->m_A[1][2][1] = 1.0 - delta;
319 phase->m_B[1][0][1] = 1.0 - lambda;
320 phase->m_B[1][0][2] = lambda;
332 phase->m_A[0][1][1] = glambda;
333 phase->m_A[0][2][1] = 1.0 - 2.0 * glambda;
334 phase->m_A[0][2][2] = glambda;
336 phase->m_B[0][0][1] = 0.5;
337 phase->m_B[0][0][2] = 0.5;
339 phase->m_A[1][1][0] = glambda;
340 phase->m_A[1][2][0] = glambda - 1.0;
341 phase->m_A[1][2][1] = 2.0 * (1.0 - glambda);
343 phase->m_B[1][0][1] = 0.5;
344 phase->m_B[1][0][2] = 0.5;
354 constexpr NekDouble lambda = 0.4358665215;
356 phase->m_A[0][1][1] = lambda;
357 phase->m_A[0][2][1] = 0.5 * (1.0 - lambda);
358 phase->m_A[0][2][2] = lambda;
359 phase->m_A[0][3][1] =
360 0.25 * (-6.0 * lambda * lambda + 16.0 * lambda - 1.0);
361 phase->m_A[0][3][2] =
362 0.25 * (6.0 * lambda * lambda - 20.0 * lambda + 5.0);
363 phase->m_A[0][3][3] = lambda;
365 phase->m_B[0][0][1] =
366 0.25 * (-6.0 * lambda * lambda + 16.0 * lambda - 1.0);
367 phase->m_B[0][0][2] =
368 0.25 * (6.0 * lambda * lambda - 20.0 * lambda + 5.0);
369 phase->m_B[0][0][3] = lambda;
371 phase->m_A[1][1][0] = 0.4358665215;
372 phase->m_A[1][2][0] = 0.3212788860;
373 phase->m_A[1][2][1] = 0.3966543747;
374 phase->m_A[1][3][0] = -0.105858296;
375 phase->m_A[1][3][1] = 0.5529291479;
376 phase->m_A[1][3][2] = 0.5529291479;
378 phase->m_B[1][0][1] =
379 0.25 * (-6.0 * lambda * lambda + 16.0 * lambda - 1.0);
380 phase->m_B[1][0][2] =
381 0.25 * (6.0 * lambda * lambda - 20.0 * lambda + 5.0);
382 phase->m_B[1][0][3] = lambda;
392 phase->m_A[0][1][1] = 1.0 / 2.0;
393 phase->m_A[0][2][1] = 1.0 / 6.0;
394 phase->m_A[0][2][2] = 1.0 / 2.0;
395 phase->m_A[0][3][1] = -1.0 / 2.0;
396 phase->m_A[0][3][2] = 1.0 / 2.0;
397 phase->m_A[0][3][3] = 1.0 / 2.0;
398 phase->m_A[0][4][1] = 3.0 / 2.0;
399 phase->m_A[0][4][2] = -3.0 / 2.0;
400 phase->m_A[0][4][3] = 1.0 / 2.0;
401 phase->m_A[0][4][4] = 1.0 / 2.0;
403 phase->m_B[0][0][1] = 3.0 / 2.0;
404 phase->m_B[0][0][2] = -3.0 / 2.0;
405 phase->m_B[0][0][3] = 1.0 / 2.0;
406 phase->m_B[0][0][4] = 1.0 / 2.0;
408 phase->m_A[1][1][0] = 1.0 / 2.0;
409 phase->m_A[1][2][0] = 11.0 / 18.0;
410 phase->m_A[1][2][1] = 1.0 / 18.0;
411 phase->m_A[1][3][0] = 5.0 / 6.0;
412 phase->m_A[1][3][1] = -5.0 / 6.0;
413 phase->m_A[1][3][2] = 1.0 / 2.0;
414 phase->m_A[1][4][0] = 1.0 / 4.0;
415 phase->m_A[1][4][1] = 7.0 / 4.0;
416 phase->m_A[1][4][2] = 3.0 / 4.0;
417 phase->m_A[1][4][3] = -7.0 / 4.0;
419 phase->m_B[1][0][0] = 1.0 / 4.0;
420 phase->m_B[1][0][1] = 7.0 / 4.0;
421 phase->m_B[1][0][2] = 3.0 / 4.0;
422 phase->m_B[1][0][3] = -7.0 / 4.0;
435 return std::string(
"IMEX");
451 std::vector<NekDouble> freeParams)
454 boost::ignore_unused(variant, order, freeParams);
462 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
463 [[maybe_unused]] std::vector<NekDouble> freeParams)
484 std::vector<NekDouble> freeParams)
487 boost::ignore_unused(variant, order, freeParams);
495 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
496 [[maybe_unused]] std::vector<NekDouble> freeParams)
500 "", 1, std::vector<NekDouble>{1, 2});
517 std::vector<NekDouble> freeParams)
520 boost::ignore_unused(variant, order, freeParams);
528 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
529 [[maybe_unused]] std::vector<NekDouble> freeParams)
533 "", 2, std::vector<NekDouble>{1, 2});
550 std::vector<NekDouble> freeParams)
553 boost::ignore_unused(variant, order, freeParams);
561 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
562 [[maybe_unused]] std::vector<NekDouble> freeParams)
583 std::vector<NekDouble> freeParams)
586 boost::ignore_unused(variant, order, freeParams);
594 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
595 [[maybe_unused]] std::vector<NekDouble> freeParams)
599 "", 2, std::vector<NekDouble>{2, 3});
617 std::vector<NekDouble> freeParams)
620 boost::ignore_unused(variant, order, freeParams);
628 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
629 [[maybe_unused]] std::vector<NekDouble> freeParams)
633 "", 3, std::vector<NekDouble>{2, 3});
651 std::vector<NekDouble> freeParams)
654 boost::ignore_unused(variant, order, freeParams);
662 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
663 [[maybe_unused]] std::vector<NekDouble> freeParams)
667 "", 3, std::vector<NekDouble>{3, 4});
685 std::vector<NekDouble> freeParams)
688 boost::ignore_unused(variant, order, freeParams);
696 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
697 [[maybe_unused]] std::vector<NekDouble> freeParams)
701 "", 3, std::vector<NekDouble>{4, 4});
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
static std::string className
static std::string TimeIntegrationMethodLookupId
IMEXdirk_1_1_1TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirk_1_1_1TimeIntegrationScheme() override
static std::string className
IMEXdirk_1_2_1TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string TimeIntegrationMethodLookupId
~IMEXdirk_1_2_1TimeIntegrationScheme() override
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string className
IMEXdirk_1_2_2TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string TimeIntegrationMethodLookupId
~IMEXdirk_1_2_2TimeIntegrationScheme() override
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirk_2_2_2TimeIntegrationScheme() override
static std::string TimeIntegrationMethodLookupId
static std::string className
IMEXdirk_2_2_2TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string TimeIntegrationMethodLookupId
~IMEXdirk_2_3_2TimeIntegrationScheme() override
static std::string className
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
IMEXdirk_2_3_2TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
IMEXdirk_2_3_3TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirk_2_3_3TimeIntegrationScheme() override
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string className
static std::string TimeIntegrationMethodLookupId
IMEXdirk_3_4_3TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirk_3_4_3TimeIntegrationScheme() override
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string className
static std::string TimeIntegrationMethodLookupId
IMEXdirk_4_4_3TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string TimeIntegrationMethodLookupId
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirk_4_4_3TimeIntegrationScheme() override
static std::string className
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, size_t order, std::vector< NekDouble > freeParams)
~IMEXdirkTimeIntegrationScheme() override
static LUE void SetupSchemeData_2_2_2(TimeIntegrationAlgorithmGLMSharedPtr &phase)
IMEXdirkTimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
LUE std::string v_GetName() const override
static LUE void SetupSchemeData_1_2_2(TimeIntegrationAlgorithmGLMSharedPtr &phase)
static LUE void SetupSchemeData_2_3_3(TimeIntegrationAlgorithmGLMSharedPtr &phase)
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData_2_3_2(TimeIntegrationAlgorithmGLMSharedPtr &phase)
static LUE void SetupSchemeData_3_4_3(TimeIntegrationAlgorithmGLMSharedPtr &phase)
LUE NekDouble v_GetTimeStability() const override
static std::string className
static LUE void SetupSchemeData_1_1_1(TimeIntegrationAlgorithmGLMSharedPtr &phase)
LUE std::string v_GetFullName() const override
static LUE void SetupSchemeData_4_4_3(TimeIntegrationAlgorithmGLMSharedPtr &phase)
static LUE void SetupSchemeData_1_2_1(TimeIntegrationAlgorithmGLMSharedPtr &phase)
Base class for GLM time integration schemes.
TimeIntegrationAlgorithmGLMVector m_integration_phases
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< TimeIntegrationAlgorithmGLM > TimeIntegrationAlgorithmGLMSharedPtr
@ eIMEX
Implicit Explicit General Linear Method.
std::vector< TimeIntegrationAlgorithmGLMSharedPtr > TimeIntegrationAlgorithmGLMVector
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
scalarT< T > sqrt(scalarT< T > in)