1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Incompressible, polynomial form of equation of state, using a polynomial
35 \*---------------------------------------------------------------------------*/
37 #ifndef icoPolynomial_H
38 #define icoPolynomial_H
42 #include "Polynomial.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>
101 //- Density polynomial coefficients
102 // Note: input in [kg/m3], but internally uses [kg/m3/kmol]
103 Polynomial<PolySize> rhoCoeffs_;
110 //- Construct from components
114 const Polynomial<PolySize>& rhoPoly
117 //- Construct from Istream
118 icoPolynomial(Istream&);
120 //- Construct from dictionary
121 icoPolynomial(const dictionary& dict);
123 //- Construct as copy
124 inline icoPolynomial(const icoPolynomial&);
126 //- Construct as named copy
127 inline icoPolynomial(const word& name, const icoPolynomial&);
129 //- Construct and return a clone
130 inline autoPtr<icoPolynomial> clone() const;
132 // Selector from Istream
133 inline static autoPtr<icoPolynomial> New(Istream& is);
135 // Selector from dictionary
136 inline static autoPtr<icoPolynomial> New(const dictionary& dict);
141 // Fundamental properties
143 //- Return density [kg/m^3]
144 inline scalar rho(scalar p, scalar T) const;
146 //- Return compressibility rho/p [s^2/m^2]
147 inline scalar psi(scalar p, scalar T) const;
149 //- Return compression factor []
150 inline scalar Z(scalar p, scalar T) const;
156 void write(Ostream& os) const;
161 inline icoPolynomial& operator=(const icoPolynomial&);
162 inline void operator+=(const icoPolynomial&);
163 inline void operator-=(const icoPolynomial&);
165 inline void operator*=(const scalar);
170 friend icoPolynomial operator+ <PolySize>
172 const icoPolynomial&,
176 friend icoPolynomial operator- <PolySize>
178 const icoPolynomial&,
182 friend icoPolynomial operator* <PolySize>
188 friend icoPolynomial operator== <PolySize>
190 const icoPolynomial&,
197 friend Ostream& operator<< <PolySize>(Ostream&, const icoPolynomial&);
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace Foam
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #define makeIcoPolynomial(PolySize) \
209 defineTemplateTypeNameAndDebugWithName \
211 icoPolynomial<PolySize>, \
212 "icoPolynomial<"#PolySize">", \
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 #include "icoPolynomialI.H"
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 # include "icoPolynomial.C"
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 // ************************************************************************* //