OpenFOAM logo
Open Source CFD Toolkit

perfectGasI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     Perfect gas equation of state.
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "perfectGas.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00038 
00039 // Construct from components
00040 inline perfectGas::perfectGas
00041 (
00042     const specie& sp
00043 )
00044 :
00045     specie(sp)
00046 {}
00047 
00048 
00049 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00050 
00051 // Construct as named copy
00052 inline perfectGas::perfectGas(const word& name, const perfectGas& pg)
00053 :
00054     specie(name, pg)
00055 {}
00056 
00057 
00058 // Construct and return a clone
00059 inline autoPtr<perfectGas> perfectGas::clone() const
00060 {
00061     return autoPtr<perfectGas>(new perfectGas(*this));
00062 }
00063 
00064 
00065 // Selector from Istream
00066 inline autoPtr<perfectGas> perfectGas::New(Istream& is)
00067 {
00068     return autoPtr<perfectGas>(new perfectGas(is));
00069 }
00070 
00071 
00072 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00073 
00074 //- Return density [kg/m^3]
00075 inline scalar perfectGas::rho(scalar p, scalar T) const
00076 {
00077     return p/(R()*T);
00078 }
00079 
00080 //- Return compressibility rho/p [s^2/m^2]
00081 inline scalar perfectGas::psi(scalar, scalar T) const
00082 {
00083     return 1.0/(R()*T);
00084 }
00085 
00086 //- Return compression factor []
00087 inline scalar perfectGas::Z(scalar, scalar) const
00088 {
00089     return 1.0;
00090 }
00091 
00092 
00093 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00094 
00095 inline void perfectGas::operator+=(const perfectGas& pg)
00096 {
00097     specie::operator+=(pg);
00098 }
00099 
00100 inline void perfectGas::operator-=(const perfectGas& pg)
00101 {
00102     specie::operator-=(pg);
00103 }
00104 
00105 inline void perfectGas::operator*=(const scalar s)
00106 {
00107     specie::operator*=(s);
00108 }
00109 
00110 
00111 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00112 
00113 inline perfectGas operator+
00114 (
00115     const perfectGas& pg1,
00116     const perfectGas& pg2
00117 )
00118 {
00119     return perfectGas
00120     (
00121         static_cast<const specie&>(pg1)
00122       + static_cast<const specie&>(pg2)
00123     );
00124 }
00125 
00126 
00127 inline perfectGas operator-
00128 (
00129     const perfectGas& pg1,
00130     const perfectGas& pg2
00131 )
00132 {
00133     return perfectGas
00134     (
00135         static_cast<const specie&>(pg1)
00136       - static_cast<const specie&>(pg2)
00137     );
00138 }
00139 
00140 
00141 inline perfectGas operator*
00142 (
00143     const scalar s,
00144     const perfectGas& pg
00145 )
00146 {
00147     return perfectGas(s*static_cast<const specie&>(pg));
00148 }
00149 
00150 
00151 inline perfectGas operator==
00152 (
00153     const perfectGas& pg1,
00154     const perfectGas& pg2
00155 )
00156 {
00157     return pg2 - pg1;
00158 }
00159 
00160 
00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00162 
00163 } // End namespace Foam
00164 
00165 // ************************************************************************* //
For further information go to www.openfoam.org