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-2016 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 scalarField& dydx0,
91  const scalar dx,
92  scalarField& y
93  ) const;
94 
95  //- Solve the ODE system and the update the state
96  virtual void solve
97  (
98  scalar& x,
99  scalarField& y,
100  scalar& dxTry
101  ) const;
102 };
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace Foam
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #endif
112 
113 // ************************************************************************* //
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: ODESolver.C:116
dictionary dict
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
virtual 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:68
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 y
virtual ~Trapezoid()
Destructor.
Definition: Trapezoid.H:72
TypeName("Trapezoid")
Runtime type information.
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 ODESystem.
Definition: Trapezoid.C:40
virtual bool resize()
Resize the ODE solver.
Definition: Trapezoid.C:50
Namespace for OpenFOAM.