EulerSI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::EulerSI
29
30Group
31 grpODESolvers
32
33Description
34 Semi-implicit Euler ODE solver of order (0)1.
35
36 The method calculates the new state from:
37 \f[
38 y_{n+1} = y_n
39 + \delta_x\left[I - \delta_x\frac{\partial f}{\partial y}\right]^{-1}
40 \cdot \left[f(y_n) + \delta_x\frac{\partial f}{\partial x}\right]
41 \f]
42 The error is estimated directly from the change in the solution,
43 i.e. the difference between the 0th and 1st order solutions:
44 \f[
45 err_{n+1} = y_{n+1} - y_n
46 \f]
47
48SourceFiles
49 EulerSI.C
50
51\*---------------------------------------------------------------------------*/
52
53#ifndef EulerSI_H
54#define EulerSI_H
55
56#include "ODESolver.H"
57#include "adaptiveSolver.H"
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61namespace Foam
62{
63
64/*---------------------------------------------------------------------------*\
65 Class EulerSI Declaration
66\*---------------------------------------------------------------------------*/
68class EulerSI
69:
70 public ODESolver,
71 public adaptiveSolver
72{
73 // Private data
74
75 mutable scalarField err_;
76 mutable scalarField dydx_;
77 mutable scalarField dfdx_;
78 mutable scalarSquareMatrix dfdy_;
79 mutable scalarSquareMatrix a_;
80 mutable labelList pivotIndices_;
81
82
83public:
84
85 //- Runtime type information
86 TypeName("EulerSI");
87
88
89 // Constructors
90
91 //- Construct from ODESystem
92 EulerSI(const ODESystem& ode, const dictionary& dict);
93
94
95 //- Destructor
96 virtual ~EulerSI() = default;
97
98
99 // Member Functions
100
101 //- Inherit solve from ODESolver
102 using ODESolver::solve;
103
104 //- Resize the ODE solver
105 virtual bool resize();
106
107 //- Solve a single step dx and return the error
108 virtual scalar solve
109 (
110 const scalar x0,
111 const scalarField& y0,
112 const scalarField& dydx0,
113 const scalar dx,
115 ) const;
116
117 //- Solve the ODE system and the update the state
118 virtual void solve
119 (
120 scalar& x,
121 scalarField& y,
122 scalar& dxTry
123 ) const;
124};
125
126
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129} // End namespace Foam
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133#endif
134
135// ************************************************************************* //
scalar y
Semi-implicit Euler ODE solver of order (0)1.
Definition: EulerSI.H:71
virtual ~EulerSI()=default
Destructor.
virtual bool resize()
Resize the ODE solver.
Definition: EulerSI.C:58
TypeName("EulerSI")
Runtime type information.
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:57
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:50
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An ODE solver for chemistry.
Definition: ode.H:55
Namespace for OpenFOAM.
dimensionedScalar y0(const dimensionedScalar &ds)
dictionary dict
CEqn solve()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73