initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / specie / equationOfState / perfectGas / perfectGasI.H
blob62c6c3a667a7461fbc92948f367c28085f783902
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "perfectGas.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
34 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
36 // Construct from components
37 inline perfectGas::perfectGas
39     const specie& sp
42     specie(sp)
46 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
48 // Construct as named copy
49 inline perfectGas::perfectGas(const word& name, const perfectGas& pg)
51     specie(name, pg)
55 // Construct and return a clone
56 inline autoPtr<perfectGas> perfectGas::clone() const
58     return autoPtr<perfectGas>(new perfectGas(*this));
62 // Selector from Istream
63 inline autoPtr<perfectGas> perfectGas::New(Istream& is)
65     return autoPtr<perfectGas>(new perfectGas(is));
69 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
71 //- Return density [kg/m^3]
72 inline scalar perfectGas::rho(scalar p, scalar T) const
74     return p/(R()*T);
77 //- Return compressibility rho/p [s^2/m^2]
78 inline scalar perfectGas::psi(scalar, scalar T) const
80     return 1.0/(R()*T);
83 //- Return compression factor []
84 inline scalar perfectGas::Z(scalar, scalar) const
86     return 1.0;
90 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
92 inline void perfectGas::operator+=(const perfectGas& pg)
94     specie::operator+=(pg);
97 inline void perfectGas::operator-=(const perfectGas& pg)
99     specie::operator-=(pg);
102 inline void perfectGas::operator*=(const scalar s)
104     specie::operator*=(s);
108 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
110 inline perfectGas operator+
112     const perfectGas& pg1,
113     const perfectGas& pg2
116     return perfectGas
117     (
118         static_cast<const specie&>(pg1)
119       + static_cast<const specie&>(pg2)
120     );
124 inline perfectGas operator-
126     const perfectGas& pg1,
127     const perfectGas& pg2
130     return perfectGas
131     (
132         static_cast<const specie&>(pg1)
133       - static_cast<const specie&>(pg2)
134     );
138 inline perfectGas operator*
140     const scalar s,
141     const perfectGas& pg
144     return perfectGas(s*static_cast<const specie&>(pg));
148 inline perfectGas operator==
150     const perfectGas& pg1,
151     const perfectGas& pg2
154     return pg2 - pg1;
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // ************************************************************************* //