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
63 std::vector<NekDouble> freeParams)
66 if (variant ==
"dirk" || variant ==
"DIRK")
69 "IMEX DIRK Time integration scheme invalid number "
70 "of free parameters, expected two "
71 "<implicit stages, explicit stages>, received " +
72 std::to_string(freeParams.size()));
74 size_t s = freeParams[0];
75 size_t sigma = freeParams[1];
81 if (order == 1 && s == 1 && sigma == 1)
93 else if (variant ==
"Gear")
106 else if (variant ==
"")
110 "IMEX Time integration scheme bad order (1-4): " +
111 std::to_string(order));
115 for (
size_t n = 0; n < order; ++n)
140 std::vector<NekDouble>{3, 4});
143 std::vector<NekDouble>{3, 4});
149 std::vector<NekDouble>{3, 4});
152 std::vector<NekDouble>{3, 4});
155 std::vector<NekDouble>{3, 4});
159 ASSERTL1(
false,
"IMEX Time integration scheme bad order: " +
160 std::to_string(order));
165 ASSERTL1(
false,
"IMEX Time integration scheme bad variant: " +
166 variant +
". Must be blank, 'dirk' or 'Gear'");
175 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
179 variant, order, freeParams);
189 constexpr NekDouble ABcoefficients[5] = {0.,
198 constexpr NekDouble UVcoefficients[5][8] =
205 { 4./ 3., -1./ 3., 4./3., -2./ 3.,
208 { 18./11., -9./11., 2./11., 18./11.,
209 -18./11., 6./11., 0., 0. },
211 { 48./25., -36./25., 16./25., -3./25.,
212 48./25., -72./25., 48./25., -12./25. } };
215 phase->m_schemeType =
eIMEX;
216 phase->m_order = order;
218 std::string(
"IMEXOrder" + std::to_string(phase->m_order));
220 phase->m_numsteps = 2 * phase->m_order;
221 phase->m_numstages = 1;
240 phase->m_B[1][phase->m_order][0] = 1.0;
242 phase->m_A[0][0][0] = ABcoefficients[phase->m_order];
243 phase->m_B[0][0][0] = ABcoefficients[phase->m_order];
245 for (
size_t n = 0; n < 2 * phase->m_order; ++n)
247 phase->m_U[0][n] = UVcoefficients[phase->m_order][n];
248 phase->m_V[0][n] = UVcoefficients[phase->m_order][n];
252 for (
size_t n = 1; n < 2 * phase->m_order; ++n)
254 if (n != phase->m_order)
255 phase->m_V[n][n - 1] = 1.0;
258 phase->m_numMultiStepValues = phase->m_order;
259 phase->m_numMultiStepImplicitDerivs = 0;
260 phase->m_numMultiStepExplicitDerivs = phase->m_order;
265 for (
size_t n = 0; n < phase->m_order; ++n)
267 phase->m_timeLevelOffset[n] = n;
268 phase->m_timeLevelOffset[phase->m_order + n] = n;
271 phase->CheckAndVerify();
282 return std::string(
"IMEX");
298 std::vector<NekDouble> freeParams)
301 boost::ignore_unused(variant);
302 boost::ignore_unused(order);
306 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
308 boost::ignore_unused(variant);
309 boost::ignore_unused(order);
328 std::vector<NekDouble> freeParams)
331 boost::ignore_unused(variant);
332 boost::ignore_unused(order);
336 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
338 boost::ignore_unused(variant);
339 boost::ignore_unused(order);
358 std::vector<NekDouble> freeParams)
361 boost::ignore_unused(variant);
362 boost::ignore_unused(order);
366 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
368 boost::ignore_unused(variant);
369 boost::ignore_unused(order);
388 std::vector<NekDouble> freeParams)
391 boost::ignore_unused(variant);
392 boost::ignore_unused(order);
396 std::string variant,
size_t order, std::vector<NekDouble> freeParams)
398 boost::ignore_unused(variant);
399 boost::ignore_unused(order);
#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
static std::string className
virtual LUE std::string v_GetFullName() const override
virtual LUE std::string v_GetName() const override
virtual LUE NekDouble v_GetTimeStability() const override
virtual ~IMEXTimeIntegrationScheme()
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)
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
The above copyright notice and this permission notice shall be included.