adaptiveSolver.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::adaptiveSolver
29
30Group
31 grpODESolvers
32
33Description
34
35SourceFiles
36 adaptiveSolver.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef adaptiveSolver_H
41#define adaptiveSolver_H
42
43#include "ODESolver.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class adaptiveSolver Declaration
52\*---------------------------------------------------------------------------*/
55{
56 // Private data
57
58 //- Step-size adjustment controls
59 scalar safeScale_, alphaInc_, alphaDec_, minScale_, maxScale_;
60
61 //- Cache for dydx at the initial time
62 mutable scalarField dydx0_;
63
64 //- Temporary for the test-step solution
65 mutable scalarField yTemp_;
66
67
68public:
69
70 // Constructors
71
72 //- Construct from ODESystem
74
75
76 //- Destructor
77 virtual ~adaptiveSolver() = default;
78
79
80 // Member Functions
81
82 //- Resize the ODE solver
83 bool resize(const label n);
84
85 //- Solve a single step dx and return the error
86 virtual scalar solve
87 (
88 const scalar x0,
89 const scalarField& y0,
90 const scalarField& dydx0,
91 const scalar dx,
93 ) const = 0;
94
95 //- Solve the ODE system and the update the state
96 void solve
97 (
98 const ODESystem& ode,
99 scalar& x,
100 scalarField& y,
101 scalar& dxTry
102 ) const;
103};
104
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108} // End namespace Foam
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112#endif
113
114// ************************************************************************* //
scalar y
label n
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:50
bool resize(const label n)
Resize the ODE solver.
virtual scalar solve(const scalar x0, const scalarField &y0, const scalarField &dydx0, const scalar dx, scalarField &y) const =0
Solve a single step dx and return the error.
virtual ~adaptiveSolver()=default
Destructor.
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()