Nektar++
TimeIntegrationWrapper.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: TimeIntegrationWrapper.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 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: Time integration scheme wrappers; one class per time integration
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
38 
39 namespace Nektar {
40 namespace LibUtilities {
41 
43  {
44  typedef Loki::SingletonHolder<TimeIntegrationWrapperFactory,
45  Loki::CreateUsingNew,
46  Loki::NoDestroy,
47  Loki::SingleThreaded> Type;
48  return Type::Instance();
49  }
50 
52  {
53 
54  }
55 
57  {
58 
59  }
60 
61  // --------------
62  // IMEXOrder1
63  // --------------
66  "IMEXOrder1", TimeIntegrationIMEXOrder1::create);
68  {
71  m_intSteps = 1;
72  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
74  }
75 
76  // --------------
77  // IMEXOrder2
78  // --------------
81  "IMEXOrder2", TimeIntegrationIMEXOrder2::create);
83  {
87  m_intSteps = 2;
88  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
90  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
91  }
92 
93  // --------------
94  // IMEXOrder3
95  // --------------
98  "IMEXOrder3", TimeIntegrationIMEXOrder3::create);
100  {
105  m_intSteps = 3;
106  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
108  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
109  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
110  }
111 
112  // --------------
113  // ForwardEuler
114  // --------------
117  "ForwardEuler", TimeIntegrationForwardEuler::create);
119  {
122  m_intSteps = 1;
123  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
125  }
126 
127  // --------------
128  // BackwardEuler
129  // --------------
132  "BackwardEuler", TimeIntegrationBackwardEuler::create);
134  {
137  m_intSteps = 1;
138  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
140  }
141 
142  // --------------
143  // BDFImplicitOrder1
144  // --------------
147  "BDFImplicitOrder1", TimeIntegrationBDFImplicitOrder1::create);
149  {
152  m_intSteps = 1;
153  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
155  }
156 
157  // --------------
158  // BDFImplicitOrder2
159  // --------------
162  "BDFImplicitOrder2", TimeIntegrationBDFImplicitOrder2::create);
164  {
168  m_intSteps = 2;
169  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
171  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
172  }
173 
174  // --------------
175  // IMEXdirk_1_1_1
176  // --------------
179  "IMEXdirk_1_1_1", TimeIntegrationIMEXdirk_1_1_1::create);
181  {
184  m_intSteps = 1;
185  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
187  }
188 
189  // --------------
190  // IMEXdirk_1_2_1
191  // --------------
194  "IMEXdirk_1_2_1", TimeIntegrationIMEXdirk_1_2_1::create);
196  {
199  m_intSteps = 1;
200  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
202  }
203 
204  // --------------
205  // IMEXdirk_1_2_2
206  // --------------
209  "IMEXdirk_1_2_2", TimeIntegrationIMEXdirk_1_2_2::create);
211  {
214  m_intSteps = 1;
215  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
217  }
218 
219  // --------------
220  // IMEXdirk_4_4_3
221  // --------------
224  "IMEXdirk_4_4_3", TimeIntegrationIMEXdirk_4_4_3::create);
226  {
229  m_intSteps = 1;
230  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
232  }
233 
234  // --------------
235  // IMEXdirk_2_2_2
236  // --------------
239  "IMEXdirk_2_2_2", TimeIntegrationIMEXdirk_2_2_2::create);
241  {
244  m_intSteps = 1;
245  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
247  }
248 
249  // --------------
250  // IMEXdirk_2_3_3
251  // --------------
254  "IMEXdirk_2_3_3", TimeIntegrationIMEXdirk_2_3_3::create);
256  {
259  m_intSteps = 1;
260  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
262  }
263 
264  // --------------
265  // IMEXdirk_2_3_2
266  // --------------
269  "IMEXdirk_2_3_2", TimeIntegrationIMEXdirk_2_3_2::create);
271  {
274  m_intSteps = 1;
275  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
277  }
278 
279  // --------------
280  // IMEXdirk_3_4_3
281  // --------------
284  "IMEXdirk_3_4_3", TimeIntegrationIMEXdirk_3_4_3::create);
286  {
289  m_intSteps = 1;
290  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
292  }
293 
294  // --------------
295  // DIRKOrder2
296  // --------------
299  "DIRKOrder2", TimeIntegrationDIRKOrder2::create);
301  {
304  m_intSteps = 1;
305  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
307  }
308 
309  // --------------
310  // DIRKOrder3
311  // --------------
314  "DIRKOrder3", TimeIntegrationDIRKOrder3::create);
316  {
319  m_intSteps = 1;
320  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
322  }
323 
324  // --------------
325  // Midpoint
326  // --------------
329  "Midpoint", TimeIntegrationMidpoint::create);
331  {
334  m_intSteps = 1;
335  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
337  }
338 
339  // --------------
340  // RungeKutta2
341  // --------------
344  "RungeKutta2", TimeIntegrationRungeKutta2::create);
346  {
349  m_intSteps = 1;
350  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
352  }
353 
354  // --------------
355  // RungeKutta2_ImprovedEuler
356  // --------------
359  "RungeKutta2_ImprovedEuler",
362  {
365  m_intSteps = 1;
366  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
368  }
369 
370  // --------------
371  // RungeKutta2_SSP
372  // --------------
375  "RungeKutta2_SSP", TimeIntegrationRungeKutta2_SSP::create);
377  {
380  m_intSteps = 1;
381  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
383  }
384 
385  // --------------
386  // RungeKutta3_SSP
387  // --------------
390  "RungeKutta3_SSP",
393  {
396  m_intSteps = 1;
397  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
399  }
400 
401  // --------------
402  // ClassicalRungeKutta4
403  // --------------
406  "ClassicalRungeKutta4",
409  {
412  m_intSteps = 1;
413  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
415  }
416 
417  // --------------
418  // RungeKutta4
419  // --------------
422  "RungeKutta4",
425  {
428  m_intSteps = 1;
429  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
431  }
432 
433  // --------------
434  // AdamsBashforthOrder2
435  // --------------
438  "AdamsBashforthOrder2",
441  {
445  m_intSteps = 2;
446  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
448  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
449  }
450 
451  // --------------
452  // AdamsBashforthOrder3
453  // --------------
456  "AdamsBashforthOrder3",
459  {
463  m_intSteps = 2;
464  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
466  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
467  }
468 
469  // --------------
470  // AdamsMoultonOrder2
471  // --------------
474  "AdamsMoultonOrder2",
477  {
481  m_intSteps = 2;
482  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
484  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
485  }
486 
487  // --------------
488  // IMEXGear
489  // --------------
492  "IMEXGear", TimeIntegrationIMEXGear::create);
494  {
498  m_intSteps = 2;
499  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
501  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
502  }
503 
504  // --------------
505  // CNAB
506  // --------------
511  {
515  m_method = eCNAB;
516  m_intSteps = 3;
517  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
519  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
520  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
521  }
522 
523  // --------------
524  // MCNAB
525  // --------------
530  {
534  m_method = eMCNAB;
535  m_intSteps = 3;
536  m_intScheme = vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
538  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
539  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
540  }
541 }
542 }
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
BDF multi-step scheme of order 1 (implicit)
Adams-Bashforth Forward multi-step scheme of order 2.
Runge-Kutta multi-stage scheme 4th order explicit (old name)
static std::string className
Name of class.
Implicit-Explicit Midpoint IMEX DIRK(1,2,2)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Classical RungeKutta4 method (new name for eClassicalRungeKutta4)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
L-stable, four stage, third order IMEX DIRK(4,4,3)
Forward-Backward Euler IMEX DIRK(1,2,1)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Nonlinear SSP RungeKutta3 explicit.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
TimeIntegrationSchemeManagerT & TimeIntegrationSchemeManager(void)
Adams-Moulton Forward multi-step scheme of order 2.
Adams-Bashforth Forward multi-step scheme of order 3.
Crank-Nicolson/Adams-Bashforth Order 2 (CNAB)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
IMEX 2nd order scheme using Backward Different Formula & Extrapolation.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Classical RungeKutta2 method (new name for eMidpoint)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static std::string className
Name of class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
L-stable, three stage, third order IMEX DIRK(3,4,3)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Nonlinear SSP RungeKutta2 explicit (surrogate for eRungeKutta2_ImprovedEuler)
Improved RungeKutta2 explicit (old name meaning Heun's method)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Forward-Backward Euler IMEX DIRK(1,1,1)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
NekFactory< std::string, TimeIntegrationWrapper > TimeIntegrationWrapperFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class...
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
TimeIntegrationWrapperFactory & GetTimeIntegrationWrapperFactory()
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
std::vector< TimeIntegrationSchemeSharedPtr > m_intScheme
BDF multi-step scheme of order 2 (implicit)
L-stable, two stage, second order IMEX DIRK(2,2,2)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Diagonally Implicit Runge Kutta scheme of order 3.
IMEX 3rd order scheme using Backward Different Formula & Extrapolation.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
L-stable, three stage, third order IMEX DIRK(3,4,3)
Diagonally Implicit Runge Kutta scheme of order 3.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
L-stable, two stage, third order IMEX DIRK(2,3,3)
Modified Crank-Nicolson/Adams-Bashforth Order 2 (MCNAB)
IMEX 1st order scheme using Euler Backwards/Euler Forwards.
midpoint method (old name)
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Provides a generic Factory class.
Definition: NekFactory.hpp:116
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215