liquidProperties.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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::liquidProperties
26 
27 Description
28  The thermophysical properties of a liquid
29 
30 SourceFiles
31  liquidProperties.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef liquidProperties_H
36 #define liquidProperties_H
37 
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of friend functions and operators
46 class liquidProperties;
47 Ostream& operator<<(Ostream& os, const liquidProperties& l);
48 
49 /*---------------------------------------------------------------------------*\
50  Class liquidProperties Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class liquidProperties
54 :
56 {
57  // Private Data
58 
59  //- Critical temperature [K]
60  scalar Tc_;
61 
62  //- Critical pressure [Pa]
63  scalar Pc_;
64 
65  //- Critical volume [m^3/kmol]
66  scalar Vc_;
67 
68  //- Critical compressibility factor []
69  scalar Zc_;
70 
71  //- Triple point temperature [K]
72  scalar Tt_;
73 
74  //- Triple point pressure [Pa]
75  scalar Pt_;
76 
77  //- Normal boiling temperature [K]
78  scalar Tb_;
79 
80  //- Dipole moment []
81  scalar dipm_;
82 
83  //- Pitzer's accentric factor []
84  scalar omega_;
85 
86  //- Solubility parameter [(J/m^3)^0.5]
87  scalar delta_;
88 
89 
90 public:
91 
92  TypeName("liquid");
93 
94 
95  // Declare run-time constructor selection tables
96 
98  (
99  autoPtr,
101  ,
102  (),
103  ()
104  );
105 
107  (
108  autoPtr,
110  dictionary,
111  (const dictionary& dict),
112  (dict)
113  );
114 
115 
116  // Constructors
117 
118  //- Construct from components
120  (
121  scalar W,
122  scalar Tc,
123  scalar Pc,
124  scalar Vc,
125  scalar Zc,
126  scalar Tt,
127  scalar Pt,
128  scalar Tb,
129  scalar dipm,
130  scalar omega,
131  scalar delta
132  );
133 
134  //- Construct from dictionary
135  liquidProperties(const dictionary& dict);
136 
137  //- Construct and return clone
138  virtual autoPtr<liquidProperties> clone() const = 0;
139 
140 
141  // Selectors
142 
143  //- Return a pointer to a new liquidProperties created from name
144  static autoPtr<liquidProperties> New(const word& name);
145 
146  //- Return a pointer to a new liquidProperties created from dictionary
147  static autoPtr<liquidProperties> New(const dictionary& dict);
148 
149 
150  //- Destructor
151  virtual ~liquidProperties()
152  {}
153 
154 
155  // Static data
156 
157  //- Is the equation of state is incompressible i.e. rho != f(p)
158  static const bool incompressible = true;
159 
160  //- Is the equation of state is isochoric i.e. rho = const
161  static const bool isochoric = false;
162 
163 
164  // Member Functions
165 
166  // Physical constants which define the specie
167 
168  //- Mass fraction of this specie in mixture
169  // Note Mixing of liquidProperties is not currently supported
170  // so Y = 1
171  inline scalar Y() const;
172 
173  //- Critical temperature [K]
174  inline scalar Tc() const;
175 
176  //- Critical pressure [Pa]
177  inline scalar Pc() const;
178 
179  //- Critical volume [m^3/kmol]
180  inline scalar Vc() const;
181 
182  //- Critical compressibility factor
183  inline scalar Zc() const;
184 
185  //- Triple point temperature [K]
186  inline scalar Tt() const;
187 
188  //- Triple point pressure [Pa]
189  inline scalar Pt() const;
190 
191  //- Normal boiling temperature [K]
192  inline scalar Tb() const;
193 
194  //- Dipole moment []
195  inline scalar dipm() const;
196 
197  //- Pitzer's acentric factor []
198  inline scalar omega() const;
199 
200  //- Solubility parameter [(J/m^3)^(1/2)]
201  inline scalar delta() const;
202 
203  //- Limit the temperature to be in the range Tlow_ to Thigh_
204  inline scalar limit(const scalar T) const;
205 
206 
207  // Fundamental equation of state properties
208 
209  //- Liquid compressibility [s^2/m^2]
210  // Note: currently it is assumed the liquid is incompressible
211  inline scalar psi(scalar p, scalar T) const;
212 
213  //- Return (Cp - Cv) [J/(kg K]
214  // Note: currently it is assumed the liquid is incompressible
215  // so CpMCv = 0
216  inline scalar CpMCv(scalar p, scalar T) const;
217 
218 
219  // Fundamental thermodynamic properties
220 
221  //- Sensible enthalpy [J/kg]
222  inline scalar Hs(const scalar p, const scalar T) const;
223 
224  //- Enthalpy of formation [J/kg]
225  inline scalar Hf() const;
226 
227  //- Absolute enthalpy [J/kg]
228  inline scalar Ha(const scalar p, const scalar T) const;
229 
230  // Entropy [J/kg/K]
231  scalar S(const scalar p, const scalar T) const;
232 
233 
234  // Physical properties
235 
236  //- Vapour pressure [Pa]
237  virtual scalar pv(scalar p, scalar T) const = 0;
238 
239  //- Heat of vapourisation [J/kg]
240  virtual scalar hl(scalar p, scalar T) const = 0;
241 
242  //- Liquid enthalpy [J/kg] - reference to 298.15 K
243  virtual scalar h(scalar p, scalar T) const = 0;
244 
245  //- Vapour heat capacity [J/kg/K]
246  virtual scalar Cpg(scalar p, scalar T) const = 0;
247 
248  //- Liquid viscosity [Pa s]
249  virtual scalar mu(scalar p, scalar T) const = 0;
250 
251  //- Vapour viscosity [Pa s]
252  virtual scalar mug(scalar p, scalar T) const = 0;
253 
254  //- Liquid thermal conductivity [W/m/K]
255  virtual scalar kappa(scalar p, scalar T) const = 0;
256 
257  //- Liquid thermal diffusivity of enthalpy [kg/m/s]
258  inline scalar alphah(const scalar p, const scalar T) const;
259 
260  //- Vapour thermal conductivity [W/m/K]
261  virtual scalar kappag(scalar p, scalar T) const = 0;
262 
263  //- Surface tension [N/m]
264  virtual scalar sigma(scalar p, scalar T) const = 0;
265 
266  //- Vapour diffusivity [m^2/s]
267  virtual scalar D(scalar p, scalar T) const = 0;
268 
269  //- Vapour diffusivity [m^2/s] with specified binary pair
270  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
271 
272  //- Invert the vapour pressure relationship to retrieve the
273  // boiling temperature as a function of pressure
274  virtual scalar pvInvert(scalar p) const;
275 
276 
277  // I-O
278 
279  //- Read and set the properties present it the given dictionary
280  void readIfPresent(const dictionary& dict);
281 
282  //- Read and set the function coefficients
283  // if present it the given dictionary
284  template<class Func>
285  inline void readIfPresent
286  (
287  Func& f,
288  const word& name,
289  const dictionary& dict
290  );
291 
292  //- Read and set the function coefficients
293  // if present it the given dictionary
294  template<class Liquid>
295  inline void readIfPresent(Liquid& l, const dictionary& dict);
296 
297  //- Write the function coefficients
298  virtual void write(Ostream& os) const = 0;
299 
300  //- Write the data for each of the property functions
301  template<class Liquid>
302  inline void write(const Liquid& l, Ostream& os) const;
303 
304  //- Ostream Operator
305  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
306 };
307 
308 
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 
311 } // End namespace Foam
312 
313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314 
315 #include "liquidPropertiesI.H"
316 
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 
319 #endif
320 
321 // ************************************************************************* //
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 any number of values (e...
Definition: dictionary.H:158
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.
virtual ~liquidProperties()
Destructor.
scalar Y() const
Mass fraction of this specie 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 the temperature to be in the range Tlow_ to Thigh_.
scalar Tc() const
Critical temperature [K].
scalar Zc() const
Critical compressibility factor.
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
scalar Hf() const
Enthalpy of formation [J/kg].
scalar psi(scalar p, scalar T) const
Liquid compressibility [s^2/m^2].
A class for handling words, derived from string.
Definition: word.H:59
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:54
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
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)
virtual scalar D(scalar p, scalar T) const =0
Vapour diffusivity [m^2/s].
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
scalar omega() const
Pitzer&#39;s acentric factor [].
scalar Pc() const
Critical pressure [Pa].
Ostream & operator<<(Ostream &, const ensightPart &)
scalar S(const scalar p, const scalar T) const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
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/m/s].
virtual void write(Ostream &os) const =0
Write the function coefficients.
scalar Tb() const
Normal boiling temperature [K].
Namespace for OpenFOAM.
scalar Tt() const
Triple point temperature [K].