1 /*---------------------------------------------------------------------------*\
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 -------------------------------------------------------------------------------
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/>.
28 Incompressible, polynomial form of equation of state, using a polynomial
35 \*---------------------------------------------------------------------------*/
37 #ifndef icoPolynomial_H
38 #define icoPolynomial_H
42 #include "PolynomialTemplate.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of friend functions and operators
51 template<int PolySize>
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*
72 const icoPolynomial<PolySize>&
75 template<int PolySize>
76 icoPolynomial<PolySize> operator==
78 const icoPolynomial<PolySize>&,
79 const icoPolynomial<PolySize>&
82 template<int PolySize>
86 const icoPolynomial<PolySize>&
90 /*---------------------------------------------------------------------------*\
91 Class icoPolynomial Declaration
92 \*---------------------------------------------------------------------------*/
94 template<int PolySize>
102 // Note: input in [kg/m3], but internally uses [kg/m3/kmol]
103 Polynomial<PolySize> rhoPolynomial_;
110 //- Construct from components
114 const Polynomial<PolySize>& rhoPoly
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);
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;
147 inline icoPolynomial& operator=(const icoPolynomial&);
148 inline void operator+=(const icoPolynomial&);
149 inline void operator-=(const icoPolynomial&);
151 inline void operator*=(const scalar);
156 friend icoPolynomial operator+ <PolySize>
158 const icoPolynomial&,
162 friend icoPolynomial operator- <PolySize>
164 const icoPolynomial&,
168 friend icoPolynomial operator* <PolySize>
174 friend icoPolynomial operator== <PolySize>
176 const icoPolynomial&,
183 friend Ostream& operator<< <PolySize>(Ostream&, const icoPolynomial&);
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 } // End namespace Foam
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 #define makeIcoPolynomial(PolySize) \
195 defineTemplateTypeNameAndDebugWithName \
197 icoPolynomial<PolySize>, \
198 "icoPolynomial<"#PolySize">", \
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 #include "icoPolynomialI.H"
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 # include "icoPolynomial.C"
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 // ************************************************************************* //