Boussinesq.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) 2015-2016 OpenFOAM Foundation
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 Class
25  Foam::Boussinesq
26 
27 Description
28  Incompressible gas equation of state using the Boussinesq approximation for
29  the density as a function of temperature only:
30 
31  \verbatim
32  rho = rho0*(1 - beta*(T - T0))
33  \endverbatim
34 
35 SourceFiles
36  BoussinesqI.H
37  Boussinesq.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Boussinesq_H
42 #define Boussinesq_H
43 
44 #include "autoPtr.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class Specie> class Boussinesq;
54 
55 template<class Specie>
56 inline Boussinesq<Specie> operator+
57 (
58  const Boussinesq<Specie>&,
59  const Boussinesq<Specie>&
60 );
61 
62 template<class Specie>
63 inline Boussinesq<Specie> operator-
64 (
65  const Boussinesq<Specie>&,
66  const Boussinesq<Specie>&
67 );
68 
69 template<class Specie>
70 inline Boussinesq<Specie> operator*
71 (
72  const scalar,
73  const Boussinesq<Specie>&
74 );
75 
76 template<class Specie>
77 inline Boussinesq<Specie> operator==
78 (
79  const Boussinesq<Specie>&,
80  const Boussinesq<Specie>&
81 );
82 
83 template<class Specie>
84 Ostream& operator<<
85 (
86  Ostream&,
87  const Boussinesq<Specie>&
88 );
89 
90 
91 /*---------------------------------------------------------------------------*\
92  Class Boussinesq Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 template<class Specie>
96 class Boussinesq
97 :
98  public Specie
99 {
100  // Private data
101 
102  //- Reference density
103  scalar rho0_;
104 
105  //- Reference temperature
106  scalar T0_;
107 
108  //- Thermal expansion coefficient
109  scalar beta_;
110 
111 
112 public:
113 
114  // Constructors
115 
116  //- Construct from components
117  inline Boussinesq
118  (
119  const Specie& sp,
120  const scalar rho0,
121  const scalar T0,
122  const scalar beta
123  );
124 
125  //- Construct from Boussinesq
126  inline Boussinesq(const Boussinesq& sp);
127 
128  //- Construct from Istream
130 
131  //- Construct from dictionary
132  Boussinesq(const dictionary& dict);
133 
134  //- Construct as named copy
135  inline Boussinesq
136  (
137  const word& name,
138  const Boussinesq&
139  );
140 
141  //- Construct and return a clone
142  inline autoPtr<Boussinesq> clone() const;
143 
144  // Selector from Istream
145  inline static autoPtr<Boussinesq> New(Istream& is);
146 
147  // Selector from dictionary
148  inline static autoPtr<Boussinesq> New
149  (
150  const dictionary& dict
151  );
152 
153 
154  // Member functions
155 
156  //- Return the instantiated type name
157  static word typeName()
158  {
159  return
160  "Boussinesq<"
161  + word(Specie::typeName_()) + '>';
162  }
163 
164 
165  // Fundamental properties
166 
167  //- Is the equation of state is incompressible i.e. rho != f(p)
168  static const bool incompressible = true;
169 
170  //- Is the equation of state is isochoric i.e. rho = const
171  static const bool isochoric = false;
172 
173  //- Return density [kg/m^3]
174  inline scalar rho(scalar p, scalar T) const;
175 
176  //- Return enthalpy departure [J/kmol]
177  inline scalar h(const scalar p, const scalar T) const;
178 
179  //- Return cp departure [J/(kmol K]
180  inline scalar cp(scalar p, scalar T) const;
181 
182  //- Return entropy [J/(kmol K)]
183  inline scalar s(const scalar p, const scalar T) const;
184 
185  //- Return compressibility rho/p [s^2/m^2]
186  inline scalar psi(scalar p, scalar T) const;
187 
188  //- Return compression factor []
189  inline scalar Z(scalar p, scalar T) const;
190 
191  //- Return (cp - cv) [J/(kmol K]
192  inline scalar cpMcv(scalar p, scalar T) const;
193 
194 
195  // IO
196 
197  //- Write to Ostream
198  void write(Ostream& os) const;
199 
200 
201  // Member operators
202 
203  inline void operator=(const Boussinesq&);
204  inline void operator+=(const Boussinesq&);
205  inline void operator-=(const Boussinesq&);
206 
207  inline void operator*=(const scalar);
208 
209 
210  // Friend operators
211 
212  friend Boussinesq operator+ <Specie>
213  (
214  const Boussinesq&,
215  const Boussinesq&
216  );
217 
218  friend Boussinesq operator- <Specie>
219  (
220  const Boussinesq&,
221  const Boussinesq&
222  );
223 
224  friend Boussinesq operator* <Specie>
225  (
226  const scalar s,
227  const Boussinesq&
228  );
229 
230  friend Boussinesq operator== <Specie>
231  (
232  const Boussinesq&,
233  const Boussinesq&
234  );
235 
236 
237  // Ostream Operator
238 
239  friend Ostream& operator<< <Specie>
240  (
241  Ostream&,
242  const Boussinesq&
243  );
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace Foam
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #include "BoussinesqI.H"
254 
255 #ifdef NoRepository
256  #include "Boussinesq.C"
257 #endif
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #endif
262 
263 // ************************************************************************* //
autoPtr< Boussinesq > clone() const
Construct and return a clone.
Definition: BoussinesqI.H:73
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: Boussinesq.H:167
dictionary dict
scalar s(const scalar p, const scalar T) const
Return entropy [J/(kmol K)].
Definition: BoussinesqI.H:139
scalar h(const scalar p, const scalar T) const
Return enthalpy departure [J/kmol].
Definition: BoussinesqI.H:124
static autoPtr< Boussinesq > New(Istream &is)
Definition: BoussinesqI.H:85
Boussinesq(const Specie &sp, const scalar rho0, const scalar T0, const scalar beta)
Construct from components.
Definition: BoussinesqI.H:33
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void write(Ostream &os) const
Write to Ostream.
Definition: Boussinesq.C:63
scalar rho0
void operator=(const Boussinesq &)
Definition: BoussinesqI.H:185
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: BoussinesqI.H:161
void operator-=(const Boussinesq &)
Definition: BoussinesqI.H:216
A class for handling words, derived from string.
Definition: word.H:59
void operator+=(const Boussinesq &)
Definition: BoussinesqI.H:199
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: BoussinesqI.H:150
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
scalar cp(scalar p, scalar T) const
Return cp departure [J/(kmol K].
Definition: BoussinesqI.H:131
static word typeName()
Return the instantiated type name.
Definition: Boussinesq.H:156
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: Boussinesq.H:170
scalar cpMcv(scalar p, scalar T) const
Return (cp - cv) [J/(kmol K].
Definition: BoussinesqI.H:172
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: BoussinesqI.H:114
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
void operator*=(const scalar)
Definition: BoussinesqI.H:228
volScalarField & p
Incompressible gas equation of state using the Boussinesq approximation for the density as a function...
Definition: Boussinesq.H:52
Namespace for OpenFOAM.