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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::Trapezoid
29 
30 Group
31  grpODESolvers
32 
33 Description
34  Trapezoidal ODE solver of order (1)2.
35 
36 SourceFiles
37  Trapezoid.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Trapezoid_H
42 #define Trapezoid_H
43 
44 #include "ODESolver.H"
45 #include "adaptiveSolver.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class Trapezoid Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class Trapezoid
57 :
58  public ODESolver,
59  public adaptiveSolver
60 {
61  // Private data
62 
63  mutable scalarField err_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("Trapezoid");
70 
71 
72  // Constructors
73 
74  //- Construct from ODESystem
75  Trapezoid(const ODESystem& ode, const dictionary& dict);
76 
77 
78  //- Destructor
79  virtual ~Trapezoid() = default;
80 
81 
82  // Member Functions
83 
84  //- Inherit solve from ODESolver
85  using ODESolver::solve;
86 
87  //- Resize the ODE solver
88  virtual bool resize();
89 
90  //- Solve a single step dx and return the error
91  virtual scalar solve
92  (
93  const scalar x0,
94  const scalarField& y0,
95  const scalarField& dydx0,
96  const scalar dx,
97  scalarField& y
98  ) const;
99 
100  //- Solve the ODE system and the update the state
101  virtual void solve
102  (
103  scalar& x,
104  scalarField& y,
105  scalar& dxTry
106  ) const;
107 };
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
Foam::Trapezoid::Trapezoid
Trapezoid(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
Definition: Trapezoid.C:43
Foam::ODESolver
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:56
Foam::Trapezoid::resize
virtual bool resize()
Resize the ODE solver.
Definition: Trapezoid.C:53
adaptiveSolver.H
Foam::Trapezoid
Trapezoidal ODE solver of order (1)2.
Definition: Trapezoid.H:55
Foam::Field< scalar >
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:281
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:52
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
ODESolver.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Trapezoid::~Trapezoid
virtual ~Trapezoid()=default
Destructor.
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:49
Foam::ODESolver::solve
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible up to dxTry.
Definition: ODESolver.C:117
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::Trapezoid::solve
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:69
Foam::Trapezoid::TypeName
TypeName("Trapezoid")
Runtime type information.
Foam::adaptiveSolver
Definition: adaptiveSolver.H:53
y
scalar y
Definition: LISASMDCalcMethod1.H:14