liquidPropertiesI.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-2024 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 \*---------------------------------------------------------------------------*/
25 
26 #include "liquidProperties.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 inline Foam::scalar Foam::liquidProperties::limit(const scalar T) const
31 {
32  return T;
33 }
34 
35 
36 inline Foam::scalar Foam::liquidProperties::Y() const
37 {
38  return 1;
39 }
40 
41 
42 inline Foam::scalar Foam::liquidProperties::Tc() const
43 {
44  return Tc_;
45 }
46 
47 
48 inline Foam::scalar Foam::liquidProperties::Pc() const
49 {
50  return Pc_;
51 }
52 
53 
54 inline Foam::scalar Foam::liquidProperties::Vc() const
55 {
56  return Vc_;
57 }
58 
59 
60 inline Foam::scalar Foam::liquidProperties::Zc() const
61 {
62  return Zc_;
63 }
64 
65 
66 inline Foam::scalar Foam::liquidProperties::Tt() const
67 {
68  return Tt_;
69 }
70 
71 
72 inline Foam::scalar Foam::liquidProperties::Pt() const
73 {
74  return Pt_;
75 }
76 
77 
78 inline Foam::scalar Foam::liquidProperties::Tb() const
79 {
80  return Tb_;
81 }
82 
83 
84 inline Foam::scalar Foam::liquidProperties::dipm() const
85 {
86  return dipm_;
87 }
88 
89 
90 inline Foam::scalar Foam::liquidProperties::omega() const
91 {
92  return omega_;
93 }
94 
95 
96 inline Foam::scalar Foam::liquidProperties::delta() const
97 {
98  return delta_;
99 }
100 
101 
102 inline Foam::scalar Foam::liquidProperties::psi(scalar p, scalar T) const
103 {
104  return 0;
105 }
106 
107 
108 inline Foam::scalar Foam::liquidProperties::CpMCv(scalar p, scalar T) const
109 {
110  return 0;
111 }
112 
113 
114 inline Foam::scalar Foam::liquidProperties::es(scalar p, const scalar T) const
115 {
116  return hs(p, T);
117 }
118 
119 
120 inline Foam::scalar Foam::liquidProperties::ea(scalar p, const scalar T) const
121 {
122  return ha(p, T);
123 }
124 
125 
126 template<class Func>
128 (
129  Func& f,
130  const Function1<scalar>&,
131  const word& name,
132  const dimensionSet& dims,
133  const dictionary& dict
134 )
135 {
136  if (dict.found(name))
137  {
138  f = Func(name, {dimTemperature, dims}, dict.subDict(name));
139  }
140 }
141 
142 
143 template<class Func>
145 (
146  Func& f,
147  const Function2<scalar>&,
148  const word& name,
149  const dimensionSet& dims,
150  const dictionary& dict
151 )
152 {
153  if (dict.found(name))
154  {
155  f = Func(name, {dimTemperature, dimPressure, dims}, dict.subDict(name));
156  }
157 }
158 
159 
160 template<class Func>
162 (
163  Func& f,
164  const word& name,
165  const dimensionSet& dims,
166  const dictionary& dict
167 )
168 {
169  readIfPresent(f, f, name, dims, dict);
170 }
171 
172 
173 template<class Liquid>
175 (
176  Liquid& l,
177  const dictionary& dict
178 )
179 {
180  l.liquidProperties::readIfPresent(dict);
181  readIfPresent(l.rho_, "rho", dimDensity, dict);
182  readIfPresent(l.pv_, "pv", dimPressure, dict);
183  readIfPresent(l.hl_, "hl", dimEnergy/dimMass, dict);
184  readIfPresent(l.Cp_, "Cp", dimSpecificHeatCapacity, dict);
185  readIfPresent(l.h_, "h", dimEnergy/dimMass, dict);
186  readIfPresent(l.Cpg_, "Cpg", dimSpecificHeatCapacity, dict);
187  readIfPresent(l.B_, "B", dimVolume/dimMass, dict);
188  readIfPresent(l.mu_, "mu", dimDynamicViscosity, dict);
189  readIfPresent(l.mug_, "mug", dimDynamicViscosity, dict);
190  readIfPresent(l.kappa_, "kappa", dimThermalConductivity, dict);
191  readIfPresent(l.kappag_, "kappag", dimThermalConductivity, dict);
192  readIfPresent(l.sigma_, "sigma", dimForce/dimLength, dict);
193  readIfPresent(l.D_, "D", dimArea/dimTime, dict);
194 }
195 
196 
197 template<class Func>
199 (
200  const Func& f,
201  const Function1<scalar>&,
202  const dimensionSet& dims,
203  Ostream& os
204 ) const
205 {
206  writeEntry(os, dimTemperature, dims, f);
207 }
208 
209 
210 template<class Func>
212 (
213  const Func& f,
214  const Function2<scalar>&,
215  const dimensionSet& dims,
216  Ostream& os
217 ) const
218 {
219  writeEntry(os, dimPressure, dimTemperature, dims, f);
220 }
221 
222 
223 template<class Func>
225 (
226  const Func& f,
227  const dimensionSet& dims,
228  Ostream& os
229 ) const
230 {
231  write(f, f, dims, os);
232 }
233 
234 
235 template<class Func>
237 (
238  const autoPtr<Func>& fPtr,
239  const dimensionSet& dims,
240  Ostream& os
241 ) const
242 {
243  write(fPtr(), fPtr(), dims, os);
244 }
245 
246 
247 template<class Liquid>
249 (
250  const Liquid& l,
251  Ostream& os
252 ) const
253 {
254  l.liquidProperties::write(os);
255  write(l.rho_, dimDensity, os);
256  write(l.pv_, dimPressure, os);
257  write(l.hl_, dimEnergy/dimMass, os);
258  write(l.Cp_, dimSpecificHeatCapacity, os);
259  write(l.h_, dimEnergy/dimMass, os);
260  write(l.Cpg_, dimSpecificHeatCapacity, os);
261  write(l.B_, dimVolume/dimMass, os);
262  write(l.mu_, dimDynamicViscosity, os);
263  write(l.mug_, dimDynamicViscosity, os);
264  write(l.kappa_, dimThermalConductivity, os);
265  write(l.kappag_, dimThermalConductivity, os);
266  write(l.sigma_, dimForce/dimLength, os);
267  write(l.D_, dimArea/dimTime, os);
268 }
269 
270 
271 // ************************************************************************* //
scalar hs(const scalar p, const scalar T) const
Definition: EtoHthermo.H:11
scalar ha(const scalar p, const scalar T) const
Definition: EtoHthermo.H:20
Run-time selectable function of two variables.
Definition: Function2.H:98
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:843
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:509
Dimension set for the base types.
Definition: dimensionSet.H:125
scalar ea(scalar p, scalar T) const
Absolute internal energy [J/kg].
scalar Vc() const
Critical volume [m^3/kmol].
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar psi(scalar p, scalar T) const
Liquid compressibility [s^2/m^2].
scalar Zc() const
Critical compressibility factor.
virtual void write(Ostream &os) const =0
Write the function coefficients.
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
scalar es(scalar p, const scalar T) const
Sensible internal energy [J/kg].
scalar Tb() const
Normal boiling temperature [K].
scalar Pc() const
Critical pressure [Pa].
scalar Pt() const
Triple point pressure [Pa].
scalar omega() const
Pitzer's acentric factor [].
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
scalar Tt() const
Triple point temperature [K].
scalar dipm() const
Dipole moment [].
scalar Y() const
Mass fraction of this specie in mixture.
scalar Tc() const
Critical temperature [K].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
A class for handling words, derived from string.
Definition: word.H:62
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const dimensionSet dimDynamicViscosity
const dimensionSet dimEnergy
const dimensionSet dimPressure
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
const dimensionSet dimLength
const dimensionSet dimTemperature
const dimensionSet dimForce
const dimensionSet dimSpecificHeatCapacity
const dimensionSet dimTime
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const dimensionSet dimDensity
const dimensionSet dimVolume
const dimensionSet dimMass
const dimensionSet dimArea
const dimensionSet dimThermalConductivity
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
labelList f(nPoints)
dictionary dict
volScalarField & p