Nektar++
MCNABTimeIntegrationScheme.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: MCNABTimeIntegrationScheme.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_MCNAB_TIME_INTEGRATION_SCHEME
41 #define NEKTAR_LIB_UTILITIES_TIME_INTEGRATION_MCNAB_TIME_INTEGRATION_SCHEME
42 
43 #define LUE LIB_UTILITIES_EXPORT
44 
47 
48 namespace Nektar
49 {
50 namespace LibUtilities
51 {
52 
54 {
55 public:
56  MCNABTimeIntegrationScheme(std::string variant, unsigned int order,
57  std::vector<NekDouble> freeParams)
58  : TimeIntegrationSchemeGLM("", 2, freeParams)
59  {
60  boost::ignore_unused(variant);
61  boost::ignore_unused(order);
62 
65  new TimeIntegrationAlgorithmGLM(this));
67  new TimeIntegrationAlgorithmGLM(this));
69  new TimeIntegrationAlgorithmGLM(this));
70 
72  m_integration_phases[0], 3, std::vector<NekDouble>{3, 4});
74  m_integration_phases[1], 3, std::vector<NekDouble>{3, 4});
76  }
77 
79  {
80  }
81 
83  std::string variant, unsigned int order,
84  std::vector<NekDouble> freeParams)
85  {
86  boost::ignore_unused(variant);
87  boost::ignore_unused(order);
88 
91  "", 2, freeParams);
92 
93  return p;
94  }
95 
96  static std::string className;
97 
98  LUE virtual std::string GetName() const
99  {
100  return std::string("MCNAB");
101  }
102 
104  {
105  return 1.0;
106  }
107 
109  {
110  phase->m_schemeType = eIMEX;
111  phase->m_order = 2;
112  phase->m_name =
113  std::string("MCNABOrder" + std::to_string(phase->m_order));
114 
115  phase->m_numsteps = 5;
116  phase->m_numstages = 1;
117 
118  phase->m_A = Array<OneD, Array<TwoD, NekDouble>>(2);
119  phase->m_B = Array<OneD, Array<TwoD, NekDouble>>(2);
120 
121  phase->m_A[0] =
122  Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numstages, 0.0);
123  phase->m_B[0] =
124  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numstages, 0.0);
125  phase->m_A[1] =
126  Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numstages, 0.0);
127  phase->m_B[1] =
128  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numstages, 0.0);
129  phase->m_U =
130  Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numsteps, 0.0);
131  phase->m_V =
132  Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numsteps, 0.0);
133 
134  phase->m_A[0][0][0] = 9.0 / 16.0;
135  phase->m_B[0][0][0] = 9.0 / 16.0;
136  phase->m_B[0][1][0] = 1.0;
137 
138  phase->m_B[1][3][0] = 1.0;
139 
140  phase->m_U[0][0] = 1.0;
141  phase->m_U[0][1] = 6.0 / 16.0;
142  phase->m_U[0][2] = 1.0 / 16.0;
143  phase->m_U[0][3] = 24.0 / 16.0;
144  phase->m_U[0][4] = -8.0 / 16.0;
145 
146  phase->m_V[0][0] = 1.0;
147  phase->m_V[0][1] = 6.0 / 16.0;
148  phase->m_V[0][2] = 1.0 / 16.0;
149  phase->m_V[0][3] = 24.0 / 16.0;
150  phase->m_V[0][4] = -8.0 / 16.0;
151 
152  phase->m_V[2][1] = 1.0;
153  phase->m_V[4][3] = 1.0;
154 
155  phase->m_numMultiStepValues = 1;
156  phase->m_numMultiStepDerivs = 4;
157  phase->m_timeLevelOffset = Array<OneD, unsigned int>(phase->m_numsteps);
158  phase->m_timeLevelOffset[0] = 0;
159  phase->m_timeLevelOffset[1] = 0;
160  phase->m_timeLevelOffset[2] = 1;
161  phase->m_timeLevelOffset[3] = 0;
162  phase->m_timeLevelOffset[4] = 1;
163 
164  phase->CheckAndVerify();
165  }
166 
167 }; // end class MCNABTimeIntegrationScheme
168 
169 } // end namespace LibUtilities
170 } // end namespace Nektar
171 
172 #endif
#define LUE
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, unsigned int order, std::vector< NekDouble > freeParams)
static TimeIntegrationSchemeSharedPtr create(std::string variant, unsigned int order, std::vector< NekDouble > freeParams)
MCNABTimeIntegrationScheme(std::string variant, unsigned int order, std::vector< NekDouble > freeParams)
static LUE void SetupSchemeData(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.
Definition: CoupledSolver.h:1
double NekDouble