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