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 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 entropy [J/(kmol K)]
177  inline scalar s(const scalar p, const scalar T) const;
178 
179  //- Return compressibility rho/p [s^2/m^2]
180  inline scalar psi(scalar p, scalar T) const;
181 
182  //- Return compression factor []
183  inline scalar Z(scalar p, scalar T) const;
184 
185  //- Return (cp - cv) [J/(kmol K]
186  inline scalar cpMcv(scalar p, scalar T) const;
187 
188 
189  // IO
190 
191  //- Write to Ostream
192  void write(Ostream& os) const;
193 
194 
195  // Member operators
196 
197  inline Boussinesq& operator=
198  (
199  const Boussinesq&
200  );
201  inline void operator+=(const Boussinesq&);
202  inline void operator-=(const Boussinesq&);
203 
204  inline void operator*=(const scalar);
205 
206 
207  // Friend operators
208 
209  friend Boussinesq operator+ <Specie>
210  (
211  const Boussinesq&,
212  const Boussinesq&
213  );
214 
215  friend Boussinesq operator- <Specie>
216  (
217  const Boussinesq&,
218  const Boussinesq&
219  );
220 
221  friend Boussinesq operator* <Specie>
222  (
223  const scalar s,
224  const Boussinesq&
225  );
226 
227  friend Boussinesq operator== <Specie>
228  (
229  const Boussinesq&,
230  const Boussinesq&
231  );
232 
233 
234  // Ostream Operator
235 
236  friend Ostream& operator<< <Specie>
237  (
238  Ostream&,
239  const Boussinesq&
240  );
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #include "BoussinesqI.H"
251 
252 #ifdef NoRepository
253 # include "Boussinesq.C"
254 #endif
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
beta
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
Foam::Boussinesq::s
scalar s(const scalar p, const scalar T) const
Return entropy [J/(kmol K)].
Definition: BoussinesqI.H:125
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::Boussinesq::write
void write(Ostream &os) const
Write to Ostream.
Definition: Boussinesq.C:63
Foam::Boussinesq::clone
autoPtr< Boussinesq > clone() const
Construct and return a clone.
Definition: BoussinesqI.H:73
Foam::Boussinesq::typeName
static word typeName()
Return the instantiated type name.
Definition: Boussinesq.H:156
Foam::Boussinesq::operator-=
void operator-=(const Boussinesq &)
Definition: BoussinesqI.H:204
Foam::Boussinesq::Boussinesq
Boussinesq(const Specie &sp, const scalar rho0, const scalar T0, const scalar beta)
Construct from components.
Definition: BoussinesqI.H:33
Foam::Boussinesq::T0_
scalar T0_
Reference temperature.
Definition: Boussinesq.H:105
Foam::Boussinesq::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: BoussinesqI.H:136
Foam::Boussinesq::cpMcv
scalar cpMcv(scalar p, scalar T) const
Return (cp - cv) [J/(kmol K].
Definition: BoussinesqI.H:158
Foam::Boussinesq::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: BoussinesqI.H:147
Foam::Boussinesq::operator*=
void operator*=(const scalar)
Definition: BoussinesqI.H:216
Foam::Boussinesq
Incompressible gas equation of state using the Boussinesq approximation for the density as a function...
Definition: Boussinesq.H:52
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::Boussinesq::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: Boussinesq.H:167
Foam::Boussinesq::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: BoussinesqI.H:114
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::Boussinesq::operator+=
void operator+=(const Boussinesq &)
Definition: BoussinesqI.H:187
Foam::Boussinesq::beta_
scalar beta_
Thermal expansion coefficient.
Definition: Boussinesq.H:108
Boussinesq.C
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
rho0
scalar rho0
Definition: readInitialConditions.H:97
Foam::Boussinesq::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: Boussinesq.H:170
Foam::Boussinesq::rho0_
scalar rho0_
Reference density.
Definition: Boussinesq.H:102
BoussinesqI.H
Foam::Boussinesq::New
static autoPtr< Boussinesq > New(Istream &is)
Definition: BoussinesqI.H:85
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
autoPtr.H