liquidProperties.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::liquidProperties
29 
30 Description
31  The thermophysical properties of a liquid
32 
33 SourceFiles
34  liquidProperties.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef liquidProperties_H
39 #define liquidProperties_H
40 
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class liquidProperties Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class liquidProperties
53 :
55 {
56  // Private data
57 
58  //- Critical temperature [K]
59  scalar Tc_;
60 
61  //- Critical pressure [Pa]
62  scalar Pc_;
63 
64  //- Critical volume [m^3/kmol]
65  scalar Vc_;
66 
67  //- Critical compressibility factor []
68  scalar Zc_;
69 
70  //- Triple point temperature [K]
71  scalar Tt_;
72 
73  //- Triple point pressure [Pa]
74  scalar Pt_;
75 
76  //- Normal boiling temperature [K]
77  scalar Tb_;
78 
79  //- Dipole moment []
80  scalar dipm_;
81 
82  //- Pitzer's accentric factor []
83  scalar omega_;
84 
85  //- Solubility parameter [(J/m^3)^0.5]
86  scalar delta_;
87 
88 
89 public:
90 
91  TypeName("liquid");
92 
93 
94  // Declare run-time constructor selection tables
95 
97  (
98  autoPtr,
100  ,
101  (),
102  ()
103  );
104 
106  (
107  autoPtr,
109  dictionary,
110  (const dictionary& dict),
111  (dict)
112  );
113 
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  scalar W,
121  scalar Tc,
122  scalar Pc,
123  scalar Vc,
124  scalar Zc,
125  scalar Tt,
126  scalar Pt,
127  scalar Tb,
128  scalar dipm,
129  scalar omega,
130  scalar delta
131  );
132 
133  //- Construct from dictionary
135 
136  //- Construct and return clone
137  virtual autoPtr<liquidProperties> clone() const = 0;
138 
139 
140  // Selectors
141 
142  //- Return a pointer to a new liquidProperties created from name
143  static autoPtr<liquidProperties> New(const word& name);
144 
145  //- Return a pointer to a new liquidProperties created from dictionary
147 
148 
149  //- Destructor
150  virtual ~liquidProperties() = default;
151 
152 
153  // Static data
154 
155  //- Is the equation of state is incompressible i.e. rho != f(p)
156  static const bool incompressible = true;
157 
158  //- Is the equation of state is isochoric i.e. rho = const
159  static const bool isochoric = false;
160 
161 
162  // Member Functions
163 
164  // Physical constants which define the specie
165 
166  //- No of moles of this species in mixture
167  // Note Mixing of liquidProperties is not currently supported
168  // so Y = 1
169  inline scalar Y() const;
170 
171  //- Critical temperature [K]
172  inline scalar Tc() const;
173 
174  //- Critical pressure [Pa]
175  inline scalar Pc() const;
176 
177  //- Critical volume [m^3/kmol]
178  inline scalar Vc() const;
179 
180  //- Critical compressibility factor
181  inline scalar Zc() const;
182 
183  //- Triple point temperature [K]
184  inline scalar Tt() const;
185 
186  //- Triple point pressure [Pa]
187  inline scalar Pt() const;
188 
189  //- Normal boiling temperature [K]
190  inline scalar Tb() const;
191 
192  //- Dipole moment []
193  inline scalar dipm() const;
194 
195  //- Pitzer's acentric factor []
196  inline scalar omega() const;
197 
198  //- Solubility parameter [(J/m^3)^(1/2)]
199  inline scalar delta() const;
200 
201  //- Limit temperature to be within the range
202  inline scalar limit(const scalar T) const;
203 
204 
205  // Fundamental equation of state properties
206 
207  //- Liquid compressibility rho/p [s^2/m^2]
208  // Note: currently it is assumed the liquid is incompressible
209  inline scalar psi(scalar p, scalar T) const;
210 
211  //- Return (Cp - Cv) [J/(kg K]
212  // Note: currently it is assumed the liquid is incompressible
213  // so CpMCv = 0
214  inline scalar CpMCv(scalar p, scalar T) const;
215 
216 
217  // Fundamental thermodynamic properties
218 
219  //- Absolute Enthalpy [J/kg]
220  inline scalar Ha(const scalar p, const scalar T) const;
221 
222  //- Sensible enthalpy [J/kg]
223  inline scalar Hs(const scalar p, const scalar T) const;
224 
225  //- Chemical enthalpy [J/kg]
226  inline scalar Hc() const;
227 
228  // Entropy [J/(kg K)]
229  scalar S(const scalar p, const scalar T) const;
230 
231 
232  // Physical properties
233 
234  //- Vapour pressure [Pa]
235  virtual scalar pv(scalar p, scalar T) const = 0;
236 
237  //- Heat of vapourisation [J/kg]
238  virtual scalar hl(scalar p, scalar T) const = 0;
239 
240  //- Liquid enthalpy [J/kg] - reference to 298.15 K
241  virtual scalar h(scalar p, scalar T) const = 0;
242 
243  //- Vapour heat capacity [J/(kg K)]
244  virtual scalar Cpg(scalar p, scalar T) const = 0;
245 
246  //- Liquid viscosity [Pa s]
247  virtual scalar mu(scalar p, scalar T) const = 0;
248 
249  //- Vapour viscosity [Pa s]
250  virtual scalar mug(scalar p, scalar T) const = 0;
251 
252  //- Liquid thermal conductivity [W/(m K)]
253  virtual scalar kappa(scalar p, scalar T) const = 0;
254 
255  //- Liquid thermal diffusivity of enthalpy [kg/ms]
256  inline scalar alphah(const scalar p, const scalar T) const;
257 
258  //- Vapour thermal conductivity [W/(m K)]
259  virtual scalar kappag(scalar p, scalar T) const = 0;
260 
261  //- Surface tension [N/m]
262  virtual scalar sigma(scalar p, scalar T) const = 0;
263 
264  //- Vapour diffusivity [m2/s]
265  virtual scalar D(scalar p, scalar T) const = 0;
266 
267  //- Vapour diffusivity [m2/s] with specified binary pair
268  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
269 
270  //- Invert the vapour pressure relationship to retrieve the
271  // boiling temperature as a function of pressure
272  virtual scalar pvInvert(scalar p) const;
273 
274 
275  // I-O
276 
277  //- Read and set the properties present it the given dictionary
278  void readIfPresent(const dictionary& dict);
279 
280  //- Read and set the function coefficients
281  // if present it the given dictionary
282  template<class Func>
283  inline void readIfPresent
284  (
285  Func& f,
286  const word& name,
287  const dictionary& dict
288  );
289 
290  //- Read and set the function coefficients
291  // if present it the given dictionary
292  template<class Liquid>
293  inline void readIfPresent(Liquid& l, const dictionary& dict);
294 
295  //- Write the function coefficients
296  virtual void writeData(Ostream& os) const = 0;
297 
298  //- Write the data for each of the property functions
299  template<class Liquid>
300  inline void writeData(const Liquid& l, Ostream& os) const;
301 
302  //- Ostream Operator
303  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
304 };
305 
306 
308 
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 } // End namespace Foam
313 
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
315 
316 #include "liquidPropertiesI.H"
317 
318 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
319 
320 #endif
321 
322 // ************************************************************************* //
Foam::liquidProperties::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: liquidPropertiesI.H:106
Foam::liquidProperties::operator<<
friend Ostream & operator<<(Ostream &os, const liquidProperties &l)
Ostream Operator.
Foam::liquidProperties::kappag
virtual scalar kappag(scalar p, scalar T) const =0
Vapour thermal conductivity [W/(m K)].
p
volScalarField & p
Definition: createFieldRefs.H:8
thermophysicalProperties.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::liquidProperties::clone
virtual autoPtr< liquidProperties > clone() const =0
Construct and return clone.
Foam::liquidProperties::New
static autoPtr< liquidProperties > New(const word &name)
Return a pointer to a new liquidProperties created from name.
Definition: liquidProperties.C:91
Foam::liquidProperties::pv
virtual scalar pv(scalar p, scalar T) const =0
Vapour pressure [Pa].
Foam::liquidProperties::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: liquidPropertiesI.H:112
Foam::liquidProperties::writeData
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
Definition: liquidProperties.C:240
Foam::liquidProperties::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, liquidProperties,,(),())
Foam::liquidProperties::Zc
scalar Zc() const
Critical compressibility factor.
Definition: liquidPropertiesI.H:58
Foam::liquidProperties::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: liquidProperties.H:155
Foam::thermophysicalProperties::W
scalar W() const
Molecular weight [kg/kmol].
Definition: thermophysicalPropertiesI.H:36
Foam::liquidProperties::alphah
scalar alphah(const scalar p, const scalar T) const
Liquid thermal diffusivity of enthalpy [kg/ms].
Definition: liquidPropertiesI.H:130
Foam::liquidProperties::~liquidProperties
virtual ~liquidProperties()=default
Destructor.
Foam::liquidProperties::Hs
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: liquidPropertiesI.H:118
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::thermophysicalProperties
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
Definition: thermophysicalProperties.H:55
Foam::liquidProperties
The thermophysical properties of a liquid.
Definition: liquidProperties.H:51
Foam::liquidProperties::liquidProperties
liquidProperties(scalar W, scalar Tc, scalar Pc, scalar Vc, scalar Zc, scalar Tt, scalar Pt, scalar Tb, scalar dipm, scalar omega, scalar delta)
Construct from components.
Definition: liquidProperties.C:44
Foam::liquidProperties::Tb
scalar Tb() const
Normal boiling temperature [K].
Definition: liquidPropertiesI.H:76
Foam::liquidProperties::Tt
scalar Tt() const
Triple point temperature [K].
Definition: liquidPropertiesI.H:64
Foam::liquidProperties::Y
scalar Y() const
No of moles of this species in mixture.
Definition: liquidPropertiesI.H:34
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::liquidProperties::S
scalar S(const scalar p, const scalar T) const
Definition: liquidProperties.C:174
Foam::liquidProperties::pvInvert
virtual scalar pvInvert(scalar p) const
Invert the vapour pressure relationship to retrieve the.
Definition: liquidProperties.C:181
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::liquidProperties::dipm
scalar dipm() const
Dipole moment [].
Definition: liquidPropertiesI.H:82
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::liquidProperties::Vc
scalar Vc() const
Critical volume [m^3/kmol].
Definition: liquidPropertiesI.H:52
liquidPropertiesI.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam::liquidProperties::kappa
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/(m K)].
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::liquidProperties::D
virtual scalar D(scalar p, scalar T) const =0
Vapour diffusivity [m2/s].
Foam::liquidProperties::mu
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
Foam::liquidProperties::Pt
scalar Pt() const
Triple point pressure [Pa].
Definition: liquidPropertiesI.H:70
Foam::liquidProperties::h
virtual scalar h(scalar p, scalar T) const =0
Liquid enthalpy [J/kg] - reference to 298.15 K.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::liquidProperties::sigma
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
Foam::liquidProperties::readIfPresent
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
Definition: liquidProperties.C:224
Foam::liquidProperties::delta
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
Definition: liquidPropertiesI.H:94
Foam::liquidProperties::omega
scalar omega() const
Pitzer's acentric factor [].
Definition: liquidPropertiesI.H:88
f
labelList f(nPoints)
Foam::liquidProperties::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: liquidPropertiesI.H:124
Foam::liquidProperties::Tc
scalar Tc() const
Critical temperature [K].
Definition: liquidPropertiesI.H:40
Foam::liquidProperties::Cpg
virtual scalar Cpg(scalar p, scalar T) const =0
Vapour heat capacity [J/(kg K)].
Foam::liquidProperties::limit
scalar limit(const scalar T) const
Limit temperature to be within the range.
Definition: liquidPropertiesI.H:28
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::liquidProperties::TypeName
TypeName("liquid")
Foam::liquidProperties::hl
virtual scalar hl(scalar p, scalar T) const =0
Heat of vapourisation [J/kg].
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::liquidProperties::psi
scalar psi(scalar p, scalar T) const
Liquid compressibility rho/p [s^2/m^2].
Definition: liquidPropertiesI.H:100
Foam::liquidProperties::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: liquidProperties.H:158
Foam::liquidProperties::Pc
scalar Pc() const
Critical pressure [Pa].
Definition: liquidPropertiesI.H:46
Foam::liquidProperties::mug
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].