41#ifndef NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_TIME_INTEGRATION_SCHEME
42#define NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_TIME_INTEGRATION_SCHEME
44#define LUE LIB_UTILITIES_EXPORT
46#include <boost/core/ignore_unused.hpp>
62 std::vector<NekDouble> freeParams)
65 if (variant ==
"dirk" || variant ==
"DIRK")
68 "IMEX DIRK Time integration scheme invalid number "
69 "of free parameters, expected two "
70 "<implicit stages, explicit stages>, received " +
71 std::to_string(freeParams.size()));
73 size_t s = freeParams[0];
74 size_t sigma = freeParams[1];
80 if (order == 1 && s == 1 && sigma == 1)
92 else if (variant ==
"Gear")
105 else if (variant ==
"")
109 "IMEX Time integration scheme bad order (1-4): " +
110 std::to_string(order));
114 for (
size_t n = 0; n < order; ++n)
139 std::vector<NekDouble>{3, 4});
142 std::vector<NekDouble>{3, 4});
148 std::vector<NekDouble>{3, 4});
151 std::vector<NekDouble>{3, 4});
154 std::vector<NekDouble>{3, 4});
158 ASSERTL1(
false,
"IMEX Time integration scheme bad order: " +
159 std::to_string(order));
164 ASSERTL1(
false,
"IMEX Time integration scheme bad variant: " +
165 variant +
". Must be blank, 'dirk' or 'Gear'");
174 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
178 variant, order, freeParams);
188 constexpr NekDouble ABcoefficients[5] = {0.,
197 constexpr NekDouble UVcoefficients[5][8] =
204 { 4./ 3., -1./ 3., 4./3., -2./ 3.,
207 { 18./11., -9./11., 2./11., 18./11.,
208 -18./11., 6./11., 0., 0. },
210 { 48./25., -36./25., 16./25., -3./25.,
211 48./25., -72./25., 48./25., -12./25. } };
214 phase->m_schemeType =
eIMEX;
215 phase->m_order = order;
217 std::string(
"IMEXOrder" + std::to_string(phase->m_order));
219 phase->m_numsteps = 2 * phase->m_order;
220 phase->m_numstages = 1;
239 phase->m_B[1][phase->m_order][0] = 1.0;
241 phase->m_A[0][0][0] = ABcoefficients[phase->m_order];
242 phase->m_B[0][0][0] = ABcoefficients[phase->m_order];
244 for (
size_t n = 0; n < 2 * phase->m_order; ++n)
246 phase->m_U[0][n] = UVcoefficients[phase->m_order][n];
247 phase->m_V[0][n] = UVcoefficients[phase->m_order][n];
251 for (
size_t n = 1; n < 2 * phase->m_order; ++n)
253 if (n != phase->m_order)
255 phase->m_V[n][n - 1] = 1.0;
259 phase->m_numMultiStepValues = phase->m_order;
260 phase->m_numMultiStepImplicitDerivs = 0;
261 phase->m_numMultiStepExplicitDerivs = phase->m_order;
266 for (
size_t n = 0; n < phase->m_order; ++n)
268 phase->m_timeLevelOffset[n] = n;
269 phase->m_timeLevelOffset[phase->m_order + n] = n;
272 phase->CheckAndVerify();
283 return std::string(
"IMEX");
299 std::vector<NekDouble> freeParams)
302 boost::ignore_unused(variant, order);
306 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
307 std::vector<NekDouble> freeParams)
326 std::vector<NekDouble> freeParams)
329 boost::ignore_unused(variant, order);
333 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
334 std::vector<NekDouble> freeParams)
353 std::vector<NekDouble> freeParams)
356 boost::ignore_unused(variant, order);
360 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
361 std::vector<NekDouble> freeParams)
380 std::vector<NekDouble> freeParams)
383 boost::ignore_unused(variant, order);
387 [[maybe_unused]] std::string variant, [[maybe_unused]]
size_t order,
388 std::vector<NekDouble> freeParams)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase)
IMEXOrder1TimeIntegrationScheme(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 className
static std::string TimeIntegrationMethodLookupId
IMEXOrder2TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string className
static std::string TimeIntegrationMethodLookupId
static TimeIntegrationSchemeSharedPtr create(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)
static std::string className
IMEXOrder3TimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static std::string TimeIntegrationMethodLookupId
IMEXOrder4TimeIntegrationScheme(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 className
LUE std::string v_GetFullName() const override
~IMEXTimeIntegrationScheme() override
static std::string className
LUE NekDouble v_GetTimeStability() const override
IMEXTimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, size_t order)
static TimeIntegrationSchemeSharedPtr create(std::string variant, size_t order, std::vector< NekDouble > freeParams)
LUE std::string v_GetName() const override
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, size_t order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData_1_1_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