Euler.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::Euler
29
30Group
31 grpODESolvers
32
33Description
34 Euler ODE solver of order (0)1.
35
36 The method calculates the new state from:
37 \f[
38 y_{n+1} = y_n + \delta_x f
39 \f]
40 The error is estimated directly from the change in the solution,
41 i.e. the difference between the 0th and 1st order solutions:
42 \f[
43 err_{n+1} = y_{n+1} - y_n
44 \f]
45
46SourceFiles
47 Euler.C
48
49\*---------------------------------------------------------------------------*/
50
51#ifndef Euler_H
52#define Euler_H
53
54#include "ODESolver.H"
55#include "adaptiveSolver.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class Euler Declaration
64\*---------------------------------------------------------------------------*/
66class Euler
67:
68 public ODESolver,
69 public adaptiveSolver
70{
71 // Private data
72
73 mutable scalarField err_;
74
75
76public:
77
78 //- Runtime type information
79 TypeName("Euler");
80
81
82 // Constructors
83
84 //- Construct from ODESystem
85 Euler(const ODESystem& ode, const dictionary& dict);
86
87
88 //- Destructor
89 virtual ~Euler() = default;
90
91
92 // Member Functions
93
94 //- Inherit solve from ODESolver
95 using ODESolver::solve;
96
97 //- Resize the ODE solver
98 virtual bool resize();
99
100 //- Solve a single step dx and return the error
101 virtual scalar solve
102 (
103 const scalar x0,
104 const scalarField& y0,
105 const scalarField& dydx0,
106 const scalar dx,
108 ) const;
109
110 //- Solve the ODE system and the update the state
111 virtual void solve
112 (
113 scalar& x,
114 scalarField& y,
115 scalar& dxTry
116 ) const;
117};
118
119
120// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121
122} // End namespace Foam
123
124// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125
126#endif
127
128// ************************************************************************* //
scalar y
Euler-implicit integration scheme.
Definition: Euler.H:69
virtual ~Euler()=default
Destructor.
virtual bool resize()
Resize the ODE solver.
Definition: Euler.C:53
TypeName("Euler")
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