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