FreeFOAM The Cross-Platform CFD Toolkit
perfectGasI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include <specie/perfectGas.H>
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 // Construct from components
37 (
38  const specie& sp
39 )
40 :
41  specie(sp)
42 {}
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
47 // Construct as named copy
48 inline perfectGas::perfectGas(const word& name, const perfectGas& pg)
49 :
50  specie(name, pg)
51 {}
52 
53 
54 // Construct and return a clone
56 {
57  return autoPtr<perfectGas>(new perfectGas(*this));
58 }
59 
60 
61 // Selector from Istream
63 {
64  return autoPtr<perfectGas>(new perfectGas(is));
65 }
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
70 //- Return density [kg/m^3]
71 inline scalar perfectGas::rho(scalar p, scalar T) const
72 {
73  return p/(R()*T);
74 }
75 
76 //- Return compressibility rho/p [s^2/m^2]
77 inline scalar perfectGas::psi(scalar, scalar T) const
78 {
79  return 1.0/(R()*T);
80 }
81 
82 //- Return compression factor []
83 inline scalar perfectGas::Z(scalar, scalar) const
84 {
85  return 1.0;
86 }
87 
88 
89 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
90 
91 inline void perfectGas::operator+=(const perfectGas& pg)
92 {
94 }
95 
96 inline void perfectGas::operator-=(const perfectGas& pg)
97 {
99 }
100 
101 inline void perfectGas::operator*=(const scalar s)
102 {
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
108 
109 inline perfectGas operator+
110 (
111  const perfectGas& pg1,
112  const perfectGas& pg2
113 )
114 {
115  return perfectGas
116  (
117  static_cast<const specie&>(pg1)
118  + static_cast<const specie&>(pg2)
119  );
120 }
121 
122 
123 inline perfectGas operator-
124 (
125  const perfectGas& pg1,
126  const perfectGas& pg2
127 )
128 {
129  return perfectGas
130  (
131  static_cast<const specie&>(pg1)
132  - static_cast<const specie&>(pg2)
133  );
134 }
135 
136 
137 inline perfectGas operator*
138 (
139  const scalar s,
140  const perfectGas& pg
141 )
142 {
143  return perfectGas(s*static_cast<const specie&>(pg));
144 }
145 
146 
147 inline perfectGas operator==
148 (
149  const perfectGas& pg1,
150  const perfectGas& pg2
151 )
152 {
153  return pg2 - pg1;
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // ************************ vim: set sw=4 sts=4 et: ************************ //