Trapezoid.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 -------------------------------------------------------------------------------
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::Trapezoid
26 
27 Description
28  Trapezoidal ODE solver of order (1)2.
29 
30 SourceFiles
31  Trapezoid.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef Trapezoid_H
36 #define Trapezoid_H
37 
38 #include "ODESolver.H"
39 #include "adaptiveSolver.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class Trapezoid Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class Trapezoid
51 :
52  public ODESolver,
53  public adaptiveSolver
54 {
55  // Private data
56 
57  mutable scalarField err_;
58 
59 
60 public:
61 
62  //- Runtime type information
63  TypeName("Trapezoid");
64 
65 
66  // Constructors
67 
68  //- Construct from ODE
69  Trapezoid(const ODESystem& ode, const dictionary& dict);
70 
71 
72  // Member Functions
73 
74  //- Inherit solve from ODESolver
75  using ODESolver::solve;
76 
77  //- Solve a single step dx and return the error
78  scalar solve
79  (
80  const scalar x0,
81  const scalarField& y0,
82  const scalarField& dydx0,
83  const scalar dx,
84  scalarField& y
85  ) const;
86 
87  //- Solve the ODE system and the update the state
88  void solve
89  (
90  scalar& x,
91  scalarField& y,
92  scalar& dxTry
93  ) const;
94 };
95 
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 } // End namespace Foam
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 #endif
104 
105 // ************************************************************************* //
dictionary dict
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
dimensionedScalar y0(const dimensionedScalar &ds)
An ODE solver for chemistry.
Definition: ode.H:50
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: Trapezoid.C:51
scalar y
TypeName("Trapezoid")
Runtime type information.
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: ODESolver.H:178
Trapezoidal ODE solver of order (1)2.
Definition: Trapezoid.H:49
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Trapezoid(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: Trapezoid.C:40
Namespace for OpenFOAM.