PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
timeintegration.h
Go to the documentation of this file.
1
8#pragma once
9
10// STL
11#include <memory>
12#include <string>
13
14// PETSc headers
15#include <petscsys.h>
16
17// YAML CPP
18#include <yaml-cpp/yaml.h>
19
20// headers from PetIBM
21#include <petibm/type.h>
22
34namespace petibm
35{
36namespace timeintegration
37{
45{
46public:
48 const std::string name;
49
51 const std::string scheme;
52
54 const PetscReal implicitCoeff;
55
57 const PetscInt nExplicit;
58
61
63 TimeIntegrationBase() : TimeIntegrationBase("none", "none", 0.0, 0, {}){};
64
74 TimeIntegrationBase(const std::string &inName, const std::string &inScheme,
75 const PetscReal &inImplicitCoeff,
76 const PetscInt &inNEcplicit,
77 const type::RealVec1D &inExplicitCoeffs)
78 : name(inName),
79 scheme(inScheme),
80 implicitCoeff(inImplicitCoeff),
81 nExplicit(inNEcplicit),
82 explicitCoeffs(inExplicitCoeffs){};
83
85 virtual ~TimeIntegrationBase() = default;
86
91 PetscErrorCode printInfo() const;
92
93}; // TimeIntegrationBase
94
101{
102public:
107 Euler_Explicit(const std::string &name)
108 : TimeIntegrationBase(name, "1st order explicit Euler", 0.0, 1,
109 {1.0}){};
110
112 virtual ~Euler_Explicit() = default;
113}; // Euler_Explicit
114
121{
122public:
127 Euler_Implicit(const std::string &name)
128 : TimeIntegrationBase(name, "1st order implicit Euler", 1.0, 0, {}){};
129
131 virtual ~Euler_Implicit() = default;
132}; // Euler_Implicit
133
139{
140public:
145 Adams_Bashforth_2(const std::string &name)
146 : TimeIntegrationBase(name, "2nd order Adams-Bashforth", 0.0, 2,
147 {1.5, -0.5}){};
148
150 virtual ~Adams_Bashforth_2() = default;
151}; // Adams_Bashforth_2
152
159{
160public:
165 Crank_Nicolson(const std::string &name)
166 : TimeIntegrationBase(name, "2nd order Crank-Nicolson", 0.5, 1,
167 {0.5}){};
168
170 virtual ~Crank_Nicolson() = default;
171}; // Crank_Nicolson
172
173} // end of namespace timeintegration
174
175namespace type
176{
182typedef std::shared_ptr<timeintegration::TimeIntegrationBase> TimeIntegration;
183} // end of namespace type
184
185namespace timeintegration
186{
196PetscErrorCode createTimeIntegration(const std::string &name,
197 const YAML::Node &node,
198 type::TimeIntegration &integration);
199} // end of namespace timeintegration
200
201} // end of namespace petibm
An implementation of TimeIntegrationBase for 2nd order Adams-Bashforth.
Adams_Bashforth_2(const std::string &name)
Constructor.
virtual ~Adams_Bashforth_2()=default
Destructor.
An implementation of TimeIntegrationBase for 2nd order Crank-Nicolson.
virtual ~Crank_Nicolson()=default
Destructor.
Crank_Nicolson(const std::string &name)
Constructor.
An implementation of TimeIntegrationBase for 1st order explicit Euler.
Euler_Explicit(const std::string &name)
Constructor.
virtual ~Euler_Explicit()=default
Destructor.
An implementation of TimeIntegrationBase for 1st order implicit Euler.
virtual ~Euler_Implicit()=default
Destructor.
Euler_Implicit(const std::string &name)
Constructor.
Base (abstract) class that stores information of temporal integration.
const type::RealVec1D explicitCoeffs
Coefficients of explicit terms.
PetscErrorCode printInfo() const
Print information to standard output.
const std::string scheme
Name of the scheme.
virtual ~TimeIntegrationBase()=default
Destructor.
TimeIntegrationBase(const std::string &inName, const std::string &inScheme, const PetscReal &inImplicitCoeff, const PetscInt &inNEcplicit, const type::RealVec1D &inExplicitCoeffs)
Constructor (normally not being used publicly).
const PetscInt nExplicit
Number of explicit terms.
const PetscReal implicitCoeff
Coefficient of implicit term.
const std::string name
Name of current instance.
PetscErrorCode createTimeIntegration(const std::string &name, const YAML::Node &node, type::TimeIntegration &integration)
factory function for type::TimeIntegration.
std::shared_ptr< timeintegration::TimeIntegrationBase > TimeIntegration
Definition of type::TimeIntegration.
std::vector< PetscReal > RealVec1D
1D std::vector holding PetscReal.
Definition: type.h:140
A toolbox for building flow solvers.
Definition: bodypack.h:52
Definition of user-defined types for convenience.