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 | Copyright (C) 2013 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
54 
55  //- Cache for dydx at the initial time
56  mutable scalarField dydx0_;
57 
58  //- Temprorary 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  //- Solve a single step dx and return the error
78  virtual scalar solve
79  (
80  const scalar x0,
81  const scalarField& y0,
82  const scalarField& dydx0,
83  const scalar dx,
84  scalarField& y
85  ) const = 0;
86 
87  //- Solve the ODE system and the update the state
88  void solve
89  (
90  const ODESystem& ode,
91  scalar& x,
92  scalarField& y,
93  scalar& dxTry
94  ) const;
95 };
96 
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 } // End namespace Foam
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 #endif
105 
106 // ************************************************************************* //
Foam::adaptiveSolver::minScale_
scalar minScale_
Definition: adaptiveSolver.H:52
Foam::adaptiveSolver::alphaInc_
scalar alphaInc_
Definition: adaptiveSolver.H:52
Foam::adaptiveSolver::safeScale_
scalar safeScale_
Step-size adjustment controls.
Definition: adaptiveSolver.H:52
Foam::adaptiveSolver::maxScale_
scalar maxScale_
Definition: adaptiveSolver.H:52
Foam::adaptiveSolver::solve
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.
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:50
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
ODESolver.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::adaptiveSolver::alphaDec_
scalar alphaDec_
Definition: adaptiveSolver.H:52
Foam::adaptiveSolver::~adaptiveSolver
virtual ~adaptiveSolver()
Destructor.
Definition: adaptiveSolver.H:70
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
Foam::adaptiveSolver::dydx0_
scalarField dydx0_
Cache for dydx at the initial time.
Definition: adaptiveSolver.H:55
Foam::adaptiveSolver::yTemp_
scalarField yTemp_
Temprorary for the test-step solution.
Definition: adaptiveSolver.H:58
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::adaptiveSolver::adaptiveSolver
adaptiveSolver(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
Definition: adaptiveSolver.C:32
Foam::adaptiveSolver
Definition: adaptiveSolver.H:47
y
scalar y
Definition: LISASMDCalcMethod1.H:14