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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Time integration scheme wrappers; one class per time integration
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
37 
38 namespace Nektar {
39 namespace LibUtilities {
40 
42  {
43  static TimeIntegrationWrapperFactory instance;
44  return instance;
45  }
46 
48  {
49 
50  }
51 
53  {
54 
55  }
56 
57  // --------------
58  // IMEXOrder1
59  // --------------
62  "IMEXOrder1", TimeIntegrationIMEXOrder1::create);
64  {
67  m_intSteps = 1;
68  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
70  }
71 
72  // --------------
73  // IMEXOrder2
74  // --------------
77  "IMEXOrder2", TimeIntegrationIMEXOrder2::create);
79  {
83  m_intSteps = 2;
84  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
86  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
87  }
88 
89  // --------------
90  // IMEXOrder3
91  // --------------
94  "IMEXOrder3", TimeIntegrationIMEXOrder3::create);
96  {
101  m_intSteps = 3;
102  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
104  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
105  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
106  }
107 
108  // --------------
109  // IMEXOrder4
110  // --------------
113  "IMEXOrder4", TimeIntegrationIMEXOrder4::create);
115  {
121  m_intSteps = 4;
122  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
124  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
125  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
126  m_intScheme[3] = TimeIntegrationSchemeManager()[IntKey3];
127  }
128 
129  // --------------
130  // ForwardEuler
131  // --------------
134  "ForwardEuler", TimeIntegrationForwardEuler::create);
136  {
139  m_intSteps = 1;
140  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
142  }
143 
144  // --------------
145  // BackwardEuler
146  // --------------
149  "BackwardEuler", TimeIntegrationBackwardEuler::create);
151  {
154  m_intSteps = 1;
155  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
157  }
158 
159  // --------------
160  // BDFImplicitOrder1
161  // --------------
164  "BDFImplicitOrder1", TimeIntegrationBDFImplicitOrder1::create);
166  {
169  m_intSteps = 1;
170  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
172  }
173 
174  // --------------
175  // BDFImplicitOrder2
176  // --------------
179  "BDFImplicitOrder2", TimeIntegrationBDFImplicitOrder2::create);
181  {
185  m_intSteps = 2;
186  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
188  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
189  }
190 
191  // --------------
192  // IMEXdirk_1_1_1
193  // --------------
196  "IMEXdirk_1_1_1", TimeIntegrationIMEXdirk_1_1_1::create);
198  {
201  m_intSteps = 1;
202  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
204  }
205 
206  // --------------
207  // IMEXdirk_1_2_1
208  // --------------
211  "IMEXdirk_1_2_1", TimeIntegrationIMEXdirk_1_2_1::create);
213  {
216  m_intSteps = 1;
217  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
219  }
220 
221  // --------------
222  // IMEXdirk_1_2_2
223  // --------------
226  "IMEXdirk_1_2_2", TimeIntegrationIMEXdirk_1_2_2::create);
228  {
231  m_intSteps = 1;
232  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
234  }
235 
236  // --------------
237  // IMEXdirk_4_4_3
238  // --------------
241  "IMEXdirk_4_4_3", TimeIntegrationIMEXdirk_4_4_3::create);
243  {
246  m_intSteps = 1;
247  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
249  }
250 
251  // --------------
252  // IMEXdirk_2_2_2
253  // --------------
256  "IMEXdirk_2_2_2", TimeIntegrationIMEXdirk_2_2_2::create);
258  {
261  m_intSteps = 1;
262  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
264  }
265 
266  // --------------
267  // IMEXdirk_2_3_3
268  // --------------
271  "IMEXdirk_2_3_3", TimeIntegrationIMEXdirk_2_3_3::create);
273  {
276  m_intSteps = 1;
277  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
279  }
280 
281  // --------------
282  // IMEXdirk_2_3_2
283  // --------------
286  "IMEXdirk_2_3_2", TimeIntegrationIMEXdirk_2_3_2::create);
288  {
291  m_intSteps = 1;
292  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
294  }
295 
296  // --------------
297  // IMEXdirk_3_4_3
298  // --------------
301  "IMEXdirk_3_4_3", TimeIntegrationIMEXdirk_3_4_3::create);
303  {
306  m_intSteps = 1;
307  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
309  }
310 
311  // --------------
312  // DIRKOrder2
313  // --------------
316  "DIRKOrder2", TimeIntegrationDIRKOrder2::create);
318  {
321  m_intSteps = 1;
322  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
324  }
325 
326  // --------------
327  // DIRKOrder3
328  // --------------
331  "DIRKOrder3", TimeIntegrationDIRKOrder3::create);
333  {
336  m_intSteps = 1;
337  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
339  }
340 
341  // --------------
342  // Midpoint
343  // --------------
346  "Midpoint", TimeIntegrationMidpoint::create);
348  {
351  m_intSteps = 1;
352  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
354  }
355 
356  // --------------
357  // RungeKutta2
358  // --------------
361  "RungeKutta2", TimeIntegrationRungeKutta2::create);
363  {
366  m_intSteps = 1;
367  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
369  }
370 
371  // --------------
372  // RungeKutta2_ImprovedEuler
373  // --------------
376  "RungeKutta2_ImprovedEuler",
379  {
382  m_intSteps = 1;
383  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
385  }
386 
387  // --------------
388  // RungeKutta2_SSP
389  // --------------
392  "RungeKutta2_SSP", TimeIntegrationRungeKutta2_SSP::create);
394  {
397  m_intSteps = 1;
398  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
400  }
401 
402  // --------------
403  // RungeKutta3_SSP
404  // --------------
407  "RungeKutta3_SSP",
410  {
413  m_intSteps = 1;
414  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
416  }
417 
418  // --------------
419  // ClassicalRungeKutta4
420  // --------------
423  "ClassicalRungeKutta4",
426  {
429  m_intSteps = 1;
430  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
432  }
433 
434  // --------------
435  // RungeKutta4
436  // --------------
439  "RungeKutta4",
442  {
445  m_intSteps = 1;
446  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
448  }
449 
450  // --------------
451  // RungeKutta5
452  // --------------
455  "RungeKutta5",
458  {
461  m_intSteps = 1;
462  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
464  }
465 
466  // --------------
467  // AdamsBashforthOrder2
468  // --------------
471  "AdamsBashforthOrder2",
474  {
478  m_intSteps = 2;
479  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
481  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
482  }
483 
484  // --------------
485  // AdamsBashforthOrder3
486  // --------------
489  "AdamsBashforthOrder3",
492  {
497  m_intSteps = 3;
498  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
500  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
501  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
502  }
503 
504  // --------------
505  // AdamsBashforthOrder4
506  // --------------
509  "AdamsBashforthOrder4",
512  {
518  m_intSteps = 4;
519  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
521  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
522  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
523  m_intScheme[3] = TimeIntegrationSchemeManager()[IntKey3];
524  }
525 
526  // --------------
527  // AdamsMoultonOrder2
528  // --------------
531  "AdamsMoultonOrder2",
534  {
538  m_intSteps = 2;
539  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
541  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
542  }
543 
544  // --------------
545  // IMEXGear
546  // --------------
549  "IMEXGear", TimeIntegrationIMEXGear::create);
551  {
555  m_intSteps = 2;
556  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
558  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
559  }
560 
561  // --------------
562  // CNAB
563  // --------------
564  std::string TimeIntegrationCNAB::className =
568  {
571  m_method = eCNAB;
572  m_intSteps = 2;
573  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
575  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
576  }
577 
578  // --------------
579  // MCNAB
580  // --------------
581  std::string TimeIntegrationMCNAB::className =
585  {
589  m_method = eMCNAB;
590  m_intSteps = 3;
591  m_intScheme = std::vector<TimeIntegrationSchemeSharedPtr>(m_intSteps);
593  m_intScheme[1] = TimeIntegrationSchemeManager()[IntKey1];
594  m_intScheme[2] = TimeIntegrationSchemeManager()[IntKey2];
595  }
596 }
597 }
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.
BDF multi-step scheme of order 1 (implicit)
Adams-Bashforth Forward multi-step scheme of order 2.
static std::string className
Name of class.
Runge-Kutta multi-stage scheme 4th order explicit (old name)
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.
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 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&#39;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.
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 2.
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)
IMEX 4th order scheme using Backward Different Formula & Extrapolation.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:199
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.
Adams-Bashforth Forward multi-step scheme of order 4.
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.
Provides a generic Factory class.
Definition: NekFactory.hpp:103
static TimeIntegrationWrapperSharedPtr create()
Creates an instance of this class.