All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ODESystem.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) 2011-2021 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::ODESystem
26 
27 Description
28  Abstract base class for the systems of ordinary differential equations.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef ODESystem_H
33 #define ODESystem_H
34 
35 #include "scalarField.H"
36 #include "scalarMatrices.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class ODESystem Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 class ODESystem
48 {
49 protected:
50 
51  // Protected Member Functions
52 
53  //- Print correspondence between derivatives and Jacobian methods
54  void check
55  (
56  const scalar x,
57  const scalarField& y,
58  const scalarField& dy,
59  const label li
60  ) const;
61 
62 
63 public:
64 
65  // Constructors
66 
67  //- Construct null
68  ODESystem();
69 
70 
71  //- Destructor
72  virtual ~ODESystem();
73 
74 
75  // Member Functions
76 
77  //- Return the number of equations in the system
78  virtual label nEqns() const = 0;
79 
80  //- Calculate the derivatives in dydx
81  // for the current state x and y
82  // and optional index into the list of systems to solve li
83  virtual void derivatives
84  (
85  const scalar x,
86  const scalarField& y,
87  const label li,
88  scalarField& dydx
89  ) const = 0;
90 
91  //- Calculate the Jacobian of the system
92  // for the current state x and y
93  // and optional index into the list of systems to solve li.
94  // Need by stiff-system solvers
95  virtual void jacobian
96  (
97  const scalar x,
98  const scalarField& y,
99  const label li,
100  scalarField& dfdx,
101  scalarSquareMatrix& dfdy
102  ) const = 0;
103 };
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 } // End namespace Foam
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #endif
113 
114 // ************************************************************************* //
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
virtual void derivatives(const scalar x, const scalarField &y, const label li, scalarField &dydx) const =0
Calculate the derivatives in dydx.
void check(const scalar x, const scalarField &y, const scalarField &dy, const label li) const
Print correspondence between derivatives and Jacobian methods.
Definition: ODESystem.C:43
virtual ~ODESystem()
Destructor.
Definition: ODESystem.C:36
scalar y
ODESystem()
Construct null.
Definition: ODESystem.C:30
virtual void jacobian(const scalar x, const scalarField &y, const label li, scalarField &dfdx, scalarSquareMatrix &dfdy) const =0
Calculate the Jacobian of the system.
virtual label nEqns() const =0
Return the number of equations in the system.
Namespace for OpenFOAM.