hRefConstThermoI.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) 2015-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class EquationOfState>
32 (
33  const EquationOfState& st,
34  const scalar cp,
35  const scalar hf,
36  const scalar tref,
37  const scalar href
38 )
39 :
40  EquationOfState(st),
41  Cp_(cp),
42  Hf_(hf),
43  Tref_(tref),
44  Href_(href)
45 {}
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 template<class EquationOfState>
52 (
53  const word& name,
54  const hRefConstThermo& ct
55 )
56 :
57  EquationOfState(name, ct),
58  Cp_(ct.Cp_),
59  Hf_(ct.Hf_),
60  Tref_(ct.Tref_),
61  Href_(ct.Href_)
62 {}
63 
64 
65 template<class EquationOfState>
68 {
70 }
71 
72 
73 template<class EquationOfState>
76 {
78 }
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class EquationOfState>
85 (
86  const scalar T
87 ) const
88 {
89  return T;
90 }
91 
92 
93 template<class EquationOfState>
95 (
96  const scalar p,
97  const scalar T
98 ) const
99 {
100  return Cp_ + EquationOfState::Cp(p, T);
101 }
102 
103 
104 template<class EquationOfState>
106 (
107  const scalar p, const scalar T
108 ) const
109 {
110  return Hs(p, T) + Hc();
111 }
112 
113 
114 template<class EquationOfState>
116 (
117  const scalar p, const scalar T
118 ) const
119 {
120  return Cp_*(T-Tref_) + Href_ + EquationOfState::H(p, T);
121 }
122 
123 
124 template<class EquationOfState>
126 {
127  return Hf_;
128 }
129 
130 
131 template<class EquationOfState>
133 (
134  const scalar p, const scalar T
135 ) const
136 {
137  return Cp_*log(T/Tstd) + EquationOfState::S(p, T);
138 }
139 
140 
141 template<class EquationOfState>
143 (
144  const scalar p, const scalar T
145 ) const
146 {
147  return 0;
148 }
149 
150 
151 template<class EquationOfState>
153 (
154  const scalar p, const scalar T
155 ) const
156 {
157  return 0;
158 }
159 
160 
161 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
162 
163 template<class EquationOfState>
165 (
167 )
168 {
169  scalar Y1 = this->Y();
170 
171  EquationOfState::operator+=(ct);
172 
173  if (mag(this->Y()) > SMALL)
174  {
175  Y1 /= this->Y();
176  const scalar Y2 = ct.Y()/this->Y();
177 
178  Cp_ = Y1*Cp_ + Y2*ct.Cp_;
179  Hf_ = Y1*Hf_ + Y2*ct.Hf_;
180  }
181 }
182 
183 
184 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
185 
186 template<class EquationOfState>
187 inline Foam::hRefConstThermo<EquationOfState> Foam::operator+
188 (
191 )
192 {
193  EquationOfState eofs
194  (
195  static_cast<const EquationOfState&>(ct1)
196  + static_cast<const EquationOfState&>(ct2)
197  );
198 
199  if (mag(eofs.Y()) < SMALL)
200  {
202  (
203  eofs,
204  ct1.Cp_,
205  ct1.Hf_,
206  ct1.Tref_,
207  ct1.Href_
208  );
209  }
210  else
211  {
212  return hRefConstThermo<EquationOfState>
213  (
214  eofs,
215  ct1.Y()/eofs.Y()*ct1.Cp_
216  + ct2.Y()/eofs.Y()*ct2.Cp_,
217  ct1.Y()/eofs.Y()*ct1.Hf_
218  + ct2.Y()/eofs.Y()*ct2.Hf_,
219  ct1.Y()/eofs.Y()*ct1.Tref_
220  + ct2.Y()/eofs.Y()*ct2.Tref_,
221  ct1.Y()/eofs.Y()*ct1.Href_
222  + ct2.Y()/eofs.Y()*ct2.Href_
223  );
224  }
225 }
226 
227 
228 template<class EquationOfState>
229 inline Foam::hRefConstThermo<EquationOfState> Foam::operator*
230 (
231  const scalar s,
232  const hRefConstThermo<EquationOfState>& ct
233 )
234 {
235  return hRefConstThermo<EquationOfState>
236  (
237  s*static_cast<const EquationOfState&>(ct),
238  ct.Cp_,
239  ct.Hf_,
240  ct.Tref_,
241  ct.Href_
242  );
243 }
244 
245 
246 template<class EquationOfState>
247 inline Foam::hRefConstThermo<EquationOfState> Foam::operator==
248 (
249  const hRefConstThermo<EquationOfState>& ct1,
250  const hRefConstThermo<EquationOfState>& ct2
251 )
252 {
253  EquationOfState eofs
254  (
255  static_cast<const EquationOfState&>(ct1)
256  == static_cast<const EquationOfState&>(ct2)
257  );
258 
259  return hRefConstThermo<EquationOfState>
260  (
261  eofs,
262  ct2.Y()/eofs.Y()*ct2.Cp_
263  - ct1.Y()/eofs.Y()*ct1.Cp_,
264  ct2.Y()/eofs.Y()*ct2.Hf_
265  - ct1.Y()/eofs.Y()*ct1.Hf_
266  );
267 }
268 
269 
270 // ************************************************************************* //
Foam::hRefConstThermo::Ha
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
Definition: hRefConstThermoI.H:106
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
cp
const volScalarField & cp
Definition: setRegionSolidFields.H:8
Hs
scalar Hs(const scalar p, const scalar T) const
Definition: EtoHthermo.H:17
Foam::hRefConstThermo::dCpdT
scalar dCpdT(const scalar p, const scalar T) const
Temperature derivative of heat capacity at constant pressure.
Definition: hRefConstThermoI.H:153
H
volScalarField H(IOobject("H", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimLength, Zero))
Foam::hRefConstThermo::clone
autoPtr< hRefConstThermo > clone() const
Construct and return a clone.
Definition: hRefConstThermoI.H:67
Foam::hRefConstThermo::S
scalar S(const scalar p, const scalar T) const
Entropy [J/(kg K)].
Definition: hRefConstThermoI.H:133
Foam::constant::standard::Tstd
const dimensionedScalar Tstd
Standard temperature.
Definition: thermodynamicConstants.C:49
Foam::hRefConstThermo::Cp
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/(kg K)].
Definition: hRefConstThermoI.H:95
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::hRefConstThermo::Hc
scalar Hc() const
Chemical enthalpy [J/kg].
Definition: hRefConstThermoI.H:125
Foam::hRefConstThermo::Hs
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Definition: hRefConstThermoI.H:116
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::hRefConstThermo::dGdT
scalar dGdT(const scalar p, const scalar T) const
Derivative of Gibbs free energy w.r.t. temperature.
Definition: hRefConstThermoI.H:143
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:262
Foam::hRefConstThermo::New
static autoPtr< hRefConstThermo > New(const dictionary &dict)
Selector from dictionary.
Definition: hRefConstThermoI.H:75
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::hRefConstThermo::limit
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
Definition: hRefConstThermoI.H:85
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Cp
const volScalarField & Cp
Definition: EEqn.H:7
Foam::hRefConstThermo
Constant properties thermodynamics package templated into the EquationOfState.
Definition: hRefConstThermo.H:51