adaptiveSolver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
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::adaptiveSolver
26 
27 Description
28 
29 SourceFiles
30  adaptiveSolver.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef adaptiveSolver_H
35 #define adaptiveSolver_H
36 
37 #include "ODESolver.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class adaptiveSolver Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class adaptiveSolver
49 {
50  // Private Data
51 
52  //- Step-size adjustment controls
53  scalar safeScale_, alphaInc_, alphaDec_, minScale_, maxScale_;
54 
55  //- Cache for dydx at the initial time
56  mutable scalarField dydx0_;
57 
58  //- Temporary for the test-step solution
59  mutable scalarField yTemp_;
60 
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct from ODESystem
67  adaptiveSolver(const ODESystem& ode, const dictionary& dict);
68 
69 
70  //- Destructor
71  virtual ~adaptiveSolver()
72  {}
73 
74 
75  // Member Functions
76 
77  //- Resize the ODE solver
78  bool resize(const label n);
79 
80  //- Solve a single step dx and return the error
81  virtual scalar solve
82  (
83  const scalar x0,
84  const scalarField& y0,
85  const label li,
86  const scalarField& dydx0,
87  const scalar dx,
88  scalarField& y
89  ) const = 0;
90 
91  //- Solve the ODE system and the update the state
92  void solve
93  (
94  const ODESystem& ode,
95  scalar& x,
96  scalarField& y,
97  const label li,
98  scalar& dxTry
99  ) const;
100 };
101 
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 } // End namespace Foam
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 #endif
110 
111 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:158
virtual ~adaptiveSolver()
Destructor.
dimensionedScalar y0(const dimensionedScalar &ds)
An ODE solver for chemistry.
Definition: ode.H:50
adaptiveSolver(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
scalar y
bool resize(const label n)
Resize the ODE solver.
label n
virtual scalar solve(const scalar x0, const scalarField &y0, const label li, const scalarField &dydx0, const scalar dx, scalarField &y) const =0
Solve a single step dx and return the error.
Namespace for OpenFOAM.