OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "perfectGas.H"
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00035 
00036 // Construct from components
00037 inline perfectGas::perfectGas
00038 (
00039     const specie& sp
00040 )
00041 :
00042     specie(sp)
00043 {}
00044 
00045 
00046 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00047 
00048 // Construct as named copy
00049 inline perfectGas::perfectGas(const word& name, const perfectGas& pg)
00050 :
00051     specie(name, pg)
00052 {}
00053 
00054 
00055 // Construct and return a clone
00056 inline autoPtr<perfectGas> perfectGas::clone() const
00057 {
00058     return autoPtr<perfectGas>(new perfectGas(*this));
00059 }
00060 
00061 
00062 // Selector from Istream
00063 inline autoPtr<perfectGas> perfectGas::New(Istream& is)
00064 {
00065     return autoPtr<perfectGas>(new perfectGas(is));
00066 }
00067 
00068 
00069 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00070 
00071 //- Return density [kg/m^3]
00072 inline scalar perfectGas::rho(scalar p, scalar T) const
00073 {
00074     return p/(R()*T);
00075 }
00076 
00077 //- Return compressibility rho/p [s^2/m^2]
00078 inline scalar perfectGas::psi(scalar, scalar T) const
00079 {
00080     return 1.0/(R()*T);
00081 }
00082 
00083 //- Return compression factor []
00084 inline scalar perfectGas::Z(scalar, scalar) const
00085 {
00086     return 1.0;
00087 }
00088 
00089 
00090 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00091 
00092 inline void perfectGas::operator+=(const perfectGas& pg)
00093 {
00094     specie::operator+=(pg);
00095 }
00096 
00097 inline void perfectGas::operator-=(const perfectGas& pg)
00098 {
00099     specie::operator-=(pg);
00100 }
00101 
00102 inline void perfectGas::operator*=(const scalar s)
00103 {
00104     specie::operator*=(s);
00105 }
00106 
00107 
00108 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00109 
00110 inline perfectGas operator+
00111 (
00112     const perfectGas& pg1,
00113     const perfectGas& pg2
00114 )
00115 {
00116     return perfectGas
00117     (
00118         static_cast<const specie&>(pg1)
00119       + static_cast<const specie&>(pg2)
00120     );
00121 }
00122 
00123 
00124 inline perfectGas operator-
00125 (
00126     const perfectGas& pg1,
00127     const perfectGas& pg2
00128 )
00129 {
00130     return perfectGas
00131     (
00132         static_cast<const specie&>(pg1)
00133       - static_cast<const specie&>(pg2)
00134     );
00135 }
00136 
00137 
00138 inline perfectGas operator*
00139 (
00140     const scalar s,
00141     const perfectGas& pg
00142 )
00143 {
00144     return perfectGas(s*static_cast<const specie&>(pg));
00145 }
00146 
00147 
00148 inline perfectGas operator==
00149 (
00150     const perfectGas& pg1,
00151     const perfectGas& pg2
00152 )
00153 {
00154     return pg2 - pg1;
00155 }
00156 
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 } // End namespace Foam
00161 
00162 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd