Forward compatibility: flex
[foam-extend-3.2.git] / src / thermophysicalModels / specie / equationOfState / icoPolynomial / icoPolynomial.H
blob2387339fdbce797ad3d77c19196365da55a01f33
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::icoPolynomial
27 Description
28     Incompressible, polynomial form of equation of state, using a polynomial
29     function for density.
31 SourceFiles
32     icoPolynomialI.H
33     icoPolynomial.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef icoPolynomial_H
38 #define icoPolynomial_H
40 #include "specie.H"
41 #include "autoPtr.H"
42 #include "PolynomialTemplate.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 // Forward declaration of friend functions and operators
51 template<int PolySize>
52 class icoPolynomial;
54 template<int PolySize>
55 icoPolynomial<PolySize> operator+
57     const icoPolynomial<PolySize>&,
58     const icoPolynomial<PolySize>&
61 template<int PolySize>
62 icoPolynomial<PolySize> operator-
64     const icoPolynomial<PolySize>&,
65     const icoPolynomial<PolySize>&
68 template<int PolySize>
69 icoPolynomial<PolySize> operator*
71     const scalar,
72     const icoPolynomial<PolySize>&
75 template<int PolySize>
76 icoPolynomial<PolySize> operator==
78     const icoPolynomial<PolySize>&,
79     const icoPolynomial<PolySize>&
82 template<int PolySize>
83 Ostream& operator<<
85     Ostream&,
86     const icoPolynomial<PolySize>&
90 /*---------------------------------------------------------------------------*\
91                         Class icoPolynomial Declaration
92 \*---------------------------------------------------------------------------*/
94 template<int PolySize>
95 class icoPolynomial
97     public specie
99     // Private data
101         //- Density
102         //  Note: input in [kg/m3], but internally uses [kg/m3/kmol]
103         Polynomial<PolySize> rhoPolynomial_;
106 public:
108     // Constructors
110         //- Construct from components
111         inline icoPolynomial
112         (
113             const specie& sp,
114             const Polynomial<PolySize>& rhoPoly
115         );
117         //- Construct from Istream
118         icoPolynomial(Istream&);
120         //- Construct as copy
121         inline icoPolynomial(const icoPolynomial&);
123         //- Construct as named copy
124         inline icoPolynomial(const word& name, const icoPolynomial&);
126         //- Construct and return a clone
127         inline autoPtr<icoPolynomial> clone() const;
129         // Selector from Istream
130         inline static autoPtr<icoPolynomial> New(Istream& is);
133     // Member functions
135         //- Return density [kg/m^3]
136         inline scalar rho(scalar p, scalar T) const;
138         //- Return compressibility rho/p [s^2/m^2]
139         inline scalar psi(scalar p, scalar T) const;
141         //- Return compression factor []
142         inline scalar Z(scalar p, scalar T) const;
145     // Member operators
147         inline icoPolynomial& operator=(const icoPolynomial&);
148         inline void operator+=(const icoPolynomial&);
149         inline void operator-=(const icoPolynomial&);
151         inline void operator*=(const scalar);
154     // Friend operators
156         friend icoPolynomial operator+ <PolySize>
157         (
158             const icoPolynomial&,
159             const icoPolynomial&
160         );
162         friend icoPolynomial operator- <PolySize>
163         (
164             const icoPolynomial&,
165             const icoPolynomial&
166         );
168         friend icoPolynomial operator* <PolySize>
169         (
170             const scalar s,
171             const icoPolynomial&
172         );
174         friend icoPolynomial operator== <PolySize>
175         (
176             const icoPolynomial&,
177             const icoPolynomial&
178         );
181     // Ostream Operator
183         friend Ostream& operator<< <PolySize>(Ostream&, const icoPolynomial&);
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 } // End namespace Foam
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 #define makeIcoPolynomial(PolySize)                                          \
194                                                                              \
195 defineTemplateTypeNameAndDebugWithName                                       \
196 (                                                                            \
197     icoPolynomial<PolySize>,                                                 \
198     "icoPolynomial<"#PolySize">",                                            \
199     0                                                                        \
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 #include "icoPolynomialI.H"
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 #ifdef NoRepository
209 #   include "icoPolynomial.C"
210 #endif
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 #endif
216 // ************************************************************************* //