Trapezoid.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::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 ODESystem
69  Trapezoid(const ODESystem& ode, const dictionary& dict);
70 
71 
72  //- Destructor
73  virtual ~Trapezoid()
74  {}
75 
76 
77  // Member Functions
78 
79  //- Inherit solve from ODESolver
80  using ODESolver::solve;
81 
82  //- Resize the ODE solver
83  virtual bool resize();
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 label li,
91  const scalarField& dydx0,
92  const scalar dx,
93  scalarField& y
94  ) const;
95 
96  //- Solve the ODE system and the update the state
97  virtual void solve
98  (
99  scalar& x,
100  scalarField& y,
101  const label li,
102  scalar& dxTry
103  ) const;
104 };
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************************************************************* //
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
dimensionedScalar y0(const dimensionedScalar &ds)
An ODE solver for chemistry.
Definition: ode.H:50
scalar y
virtual scalar solve(const scalar x0, const scalarField &y0, const label li, const scalarField &dydx0, const scalar dx, scalarField &y) const
Solve a single step dx and return the error.
Definition: Trapezoid.C:68
virtual ~Trapezoid()
Destructor.
Definition: Trapezoid.H:72
TypeName("Trapezoid")
Runtime type information.
Trapezoidal ODE solver of order (1)2.
Definition: Trapezoid.H:49
virtual void solve(scalar &x, scalarField &y, const label li, scalar &dxTry) const
Solve the ODE system from the current state xStart, y.
Definition: ODESolver.C:116
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Trapezoid(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
Definition: Trapezoid.C:40
virtual bool resize()
Resize the ODE solver.
Definition: Trapezoid.C:50
Namespace for OpenFOAM.