Nektar++
IMEXGearTimeIntegrationScheme.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: IMEXGearTimeIntegrationScheme.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2018 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Header file of time integration scheme wrappers
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 // Note : If adding a new integrator be sure to register the
37 // integrator with the Time Integration Scheme Facatory in
38 // SchemeInitializor.cpp.
39 
40 #ifndef NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_GEAR_TIME_INTEGRATION_SCHEME
41 #define NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_IMEX_GEAR_TIME_INTEGRATION_SCHEME
42 
43 #define LUE LIB_UTILITIES_EXPORT
44 
47 
49 
50 namespace Nektar
51 {
52 namespace LibUtilities
53 {
54 
56 {
57 public:
58  IMEXGearTimeIntegrationScheme(std::string variant, unsigned int order,
59  std::vector<NekDouble> freeParams)
60  : TimeIntegrationSchemeGLM("", 2, freeParams)
61  {
62  boost::ignore_unused(order);
63  boost::ignore_unused(variant);
64 
67  new TimeIntegrationAlgorithmGLM(this));
69  new TimeIntegrationAlgorithmGLM(this));
70 
72  m_integration_phases[0], 2, std::vector<NekDouble>{2, 2});
74  }
75 
77  {
78  }
79 
81  std::string variant, unsigned int order,
82  std::vector<NekDouble> freeParams)
83  {
84  boost::ignore_unused(order);
85  boost::ignore_unused(variant);
86 
89  "", 2, freeParams);
90 
91  return p;
92  }
93 
94  static std::string className;
95 
97  {
98  phase->m_schemeType = eIMEX;
99  phase->m_variant = "Gear";
100  phase->m_order = 2;
101  phase->m_name =
102  std::string("IMEXGearOrder" + std::to_string(phase->m_order));
103 
104  phase->m_numsteps = 4;
105  phase->m_numstages = 1;
106 
107  phase->m_A = Array<OneD, Array<TwoD, NekDouble>>(2);
108  phase->m_B = Array<OneD, Array<TwoD, NekDouble>>(2);
109 
110  NekDouble twothirds = 2.0 / 3.0;
111 
112  phase->m_A[0] = Array<TwoD, NekDouble>(phase->m_numstages,
113  phase->m_numstages, twothirds);
114  phase->m_B[0] =
115  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numstages, 0.0);
116  phase->m_A[1] =
117  Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numstages, 0.0);
118  phase->m_B[1] =
119  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numstages, 0.0);
120  phase->m_U =
121  Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numsteps, 0.0);
122  phase->m_V =
123  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numsteps, 0.0);
124 
125  phase->m_B[0][0][0] = twothirds;
126  phase->m_B[1][2][0] = 1.0;
127  phase->m_U[0][0] = 2.0 * twothirds;
128  phase->m_U[0][1] = -0.5 * twothirds;
129  phase->m_U[0][2] = 2.0 * twothirds;
130  phase->m_U[0][3] = -twothirds;
131 
132  phase->m_V[0][0] = 2.0 * twothirds;
133  phase->m_V[0][1] = -0.5 * twothirds;
134  phase->m_V[0][2] = 2.0 * twothirds;
135  phase->m_V[0][3] = -twothirds;
136  phase->m_V[1][0] = 1.0;
137  phase->m_V[3][2] = 1.0;
138 
139  phase->m_numMultiStepValues = 2;
140  phase->m_numMultiStepImplicitDerivs = 0;
141  phase->m_numMultiStepDerivs = 2;
142  phase->m_timeLevelOffset = Array<OneD, unsigned int>(phase->m_numsteps);
143  phase->m_timeLevelOffset[0] = 0;
144  phase->m_timeLevelOffset[1] = 1;
145  phase->m_timeLevelOffset[2] = 0;
146  phase->m_timeLevelOffset[3] = 1;
147 
148  phase->CheckAndVerify();
149  }
150 
151 protected:
152  LUE virtual std::string v_GetName() const override
153  {
154  return std::string("IMEX");
155  }
156 
157  LUE virtual NekDouble v_GetTimeStability() const override
158  {
159  return 1.0;
160  }
161 
162 }; // end class IMEXGearTimeIntegrationScheme
163 
164 } // end namespace LibUtilities
165 } // end namespace Nektar
166 
167 #endif
IMEXGearTimeIntegrationScheme(std::string variant, unsigned int order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase)
static TimeIntegrationSchemeSharedPtr create(std::string variant, unsigned int order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, unsigned int order, std::vector< NekDouble > freeParams)
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.
Definition: CoupledSolver.h:2
double NekDouble