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-2024 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 Foam_liquidProperties_H
39 #define Foam_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  // Factory Methods
141 
142  //- Clone liquidProperties
143  template<class Derived>
144  static autoPtr<liquidProperties> Clone(const Derived& prop)
145  {
146  return autoPtr<liquidProperties>(new Derived(prop));
147  }
148 
149  //- Return a pointer to a new liquidProperties created from name
150  static autoPtr<liquidProperties> New(const word& name);
151 
152  //- Return a pointer to a new liquidProperties created from dictionary
154 
155 
156  //- Destructor
157  virtual ~liquidProperties() = default;
158 
159 
160  // Static data
161 
162  //- Is the equation of state is incompressible i.e. rho != f(p)
163  static const bool incompressible = true;
164 
165  //- Is the equation of state is isochoric i.e. rho = const
166  static const bool isochoric = false;
168 
169  // Member Functions
170 
171  // Physical constants which define the specie
172 
173  //- No of moles of this species in mixture
174  // Note Mixing of liquidProperties is not currently supported
175  // so Y = 1
176  inline scalar Y() const;
177 
178  //- Critical temperature [K]
179  inline scalar Tc() const;
180 
181  //- Critical pressure [Pa]
182  inline scalar Pc() const;
183 
184  //- Critical volume [m^3/kmol]
185  inline scalar Vc() const;
186 
187  //- Critical compressibility factor
188  inline scalar Zc() const;
189 
190  //- Triple point temperature [K]
191  inline scalar Tt() const;
192 
193  //- Triple point pressure [Pa]
194  inline scalar Pt() const;
195 
196  //- Normal boiling temperature [K]
197  inline scalar Tb() const;
198 
199  //- Dipole moment []
200  inline scalar dipm() const;
201 
202  //- Pitzer's acentric factor []
203  inline scalar omega() const;
204 
205  //- Solubility parameter [(J/m^3)^(1/2)]
206  inline scalar delta() const;
207 
208  //- Limit temperature to be within the range
209  inline scalar limit(const scalar T) const;
210 
211 
212  // Fundamental equation of state properties
213 
214  //- Liquid compressibility rho/p [s^2/m^2]
215  // Note: currently it is assumed the liquid is incompressible
216  inline scalar psi(scalar p, scalar T) const;
217 
218  //- Return (Cp - Cv) [J/(kg K]
219  // Note: currently it is assumed the liquid is incompressible
220  // so CpMCv = 0
221  inline scalar CpMCv(scalar p, scalar T) const;
222 
223 
224  // Fundamental thermodynamic properties
225 
226  //- Absolute Enthalpy [J/kg]
227  inline scalar Ha(const scalar p, const scalar T) const;
228 
229  //- Sensible enthalpy [J/kg]
230  inline scalar Hs(const scalar p, const scalar T) const;
231 
232  //- Chemical enthalpy [J/kg]
233  inline scalar Hc() const;
234 
235  // Entropy [J/(kg K)]
236  scalar S(const scalar p, const scalar T) const;
237 
238 
239  // Physical properties
240 
241  //- Vapour pressure [Pa]
242  virtual scalar pv(scalar p, scalar T) const = 0;
243 
244  //- Heat of vapourisation [J/kg]
245  virtual scalar hl(scalar p, scalar T) const = 0;
246 
247  //- Liquid enthalpy [J/kg] - reference to 298.15 K
248  virtual scalar h(scalar p, scalar T) const = 0;
249 
250  //- Vapour heat capacity [J/(kg K)]
251  virtual scalar Cpg(scalar p, scalar T) const = 0;
252 
253  //- Liquid viscosity [Pa s]
254  virtual scalar mu(scalar p, scalar T) const = 0;
255 
256  //- Vapour viscosity [Pa s]
257  virtual scalar mug(scalar p, scalar T) const = 0;
258 
259  //- Liquid thermal conductivity [W/(m K)]
260  virtual scalar kappa(scalar p, scalar T) const = 0;
261 
262  //- Liquid thermal diffusivity of enthalpy [kg/ms]
263  inline scalar alphah(const scalar p, const scalar T) const;
264 
265  //- Vapour thermal conductivity [W/(m K)]
266  virtual scalar kappag(scalar p, scalar T) const = 0;
267 
268  //- Surface tension [N/m]
269  virtual scalar sigma(scalar p, scalar T) const = 0;
270 
271  //- Vapour diffusivity [m2/s]
272  virtual scalar D(scalar p, scalar T) const = 0;
273 
274  //- Vapour diffusivity [m2/s] with specified binary pair
275  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
276 
277  //- Invert the vapour pressure relationship to retrieve the
278  // boiling temperature as a function of pressure
279  virtual scalar pvInvert(scalar p) const;
280 
281 
282  // I-O
283 
284  //- Read and set the properties present it the given dictionary
285  void readIfPresent(const dictionary& dict);
286 
287  //- Read and set the function coefficients
288  // if present it the given dictionary
289  template<class Func>
290  inline void readIfPresent
291  (
292  Func& f,
293  const word& name,
294  const dictionary& dict
295  );
296 
297  //- Read and set the function coefficients
298  // if present it the given dictionary
299  template<class Liquid>
300  inline void readIfPresent(Liquid& l, const dictionary& dict);
301 
302  //- Write the function coefficients
303  virtual void writeData(Ostream& os) const = 0;
304 
305  //- Write the data for each of the property functions
306  template<class Liquid>
307  inline void writeData(const Liquid& l, Ostream& os) const;
308 
309  //- Ostream Operator
310  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
311 };
312 
313 
315 
316 
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 
319 } // End namespace Foam
320 
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 
323 #include "liquidPropertiesI.H"
324 
325 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326 
327 #endif
328 
329 // ************************************************************************* //
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual scalar Cpg(scalar p, scalar T) const =0
Vapour heat capacity [J/(kg K)].
virtual scalar pvInvert(scalar p) const
Invert the vapour pressure relationship to retrieve the.
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
scalar Y() const
No of moles of this species in mixture.
virtual scalar hl(scalar p, scalar T) const =0
Heat of vapourisation [J/kg].
declareRunTimeSelectionTable(autoPtr, liquidProperties,,(),())
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
scalar Pt() const
Triple point pressure [Pa].
virtual autoPtr< liquidProperties > clone() const =0
Construct and return clone.
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.
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/(m K)].
scalar dipm() const
Dipole moment [].
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
friend Ostream & operator<<(Ostream &os, const liquidProperties &l)
Ostream Operator.
scalar limit(const scalar T) const
Limit temperature to be within the range.
scalar Tc() const
Critical temperature [K].
scalar Zc() const
Critical compressibility factor.
scalar Hc() const
Chemical enthalpy [J/kg].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
scalar psi(scalar p, scalar T) const
Liquid compressibility rho/p [s^2/m^2].
A class for handling words, derived from Foam::string.
Definition: word.H:63
scalar W() const
Molecular weight [kg/kmol].
virtual scalar h(scalar p, scalar T) const =0
Liquid enthalpy [J/kg] - reference to 298.15 K.
The thermophysical properties of a liquid.
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
virtual scalar pv(scalar p, scalar T) const =0
Vapour pressure [Pa].
scalar Vc() const
Critical volume [m^3/kmol].
virtual scalar kappag(scalar p, scalar T) const =0
Vapour thermal conductivity [W/(m K)].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].
virtual ~liquidProperties()=default
Destructor.
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
OBJstream os(runTime.globalPath()/outputName)
static autoPtr< liquidProperties > New(const word &name)
Return a pointer to a new liquidProperties created from name.
labelList f(nPoints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static autoPtr< liquidProperties > Clone(const Derived &prop)
Clone liquidProperties.
virtual scalar D(scalar p, scalar T) const =0
Vapour diffusivity [m2/s].
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
scalar omega() const
Pitzer&#39;s acentric factor [].
scalar Pc() const
Critical pressure [Pa].
scalar S(const scalar p, const scalar T) const
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
volScalarField & p
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
scalar alphah(const scalar p, const scalar T) const
Liquid thermal diffusivity of enthalpy [kg/ms].
scalar Tb() const
Normal boiling temperature [K].
Namespace for OpenFOAM.
scalar Tt() const
Triple point temperature [K].