kineticGasEvaporation.C
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) 2017-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
29#include "constants.H"
30#include "cutCellIso.H"
32#include "wallPolyPatch.H"
33#include "fvcSmooth.H"
34
35using namespace Foam::constant;
36
37
38// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
39
40template<class Thermo, class OtherThermo>
43{
44 const fvMesh& mesh = this->mesh_;
45
46 const volScalarField& alpha = this->pair().from();
47
49 (
50 volPointInterpolation::New(mesh).interpolate(alpha)
51 );
52
54
55 forAll(interfaceArea_, celli)
56 {
57 label status = cutCell.calcSubCell(celli, isoAlpha_);
58 interfaceArea_[celli] = 0;
59 if (status == 0) // cell is cut
60 {
61 interfaceArea_[celli] =
62 mag(cutCell.faceArea())/mesh.V()[celli];
63 }
64 }
65}
66
67
68// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69
70template<class Thermo, class OtherThermo>
73(
74 const dictionary& dict,
75 const phasePair& pair
76)
77:
78 InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
79 C_("C", dimless, dict),
80 Tactivate_("Tactivate", dimTemperature, dict),
81 Mv_("Mv", dimMass/dimMoles, -1, dict),
82 interfaceArea_
83 (
85 (
86 "interfaceArea",
87 this->mesh_.time().timeName(),
88 this->mesh_,
89 IOobject::NO_READ,
90 IOobject::NO_WRITE
91 ),
92 this->mesh_,
94 ),
95 htc_
96 (
98 (
99 "htc",
100 this->mesh_.time().timeName(),
101 this->mesh_,
102 IOobject::NO_READ,
103 IOobject::NO_WRITE
104 ),
105 this->mesh_,
107 ),
108 mDotc_
109 (
111 (
112 "mDotc",
113 this->mesh_.time().timeName(),
114 this->mesh_,
115 IOobject::NO_READ,
116 IOobject::AUTO_WRITE
117 ),
118 this->mesh_,
120 ),
121 isoAlpha_(dict.getOrDefault<scalar>("isoAlpha", 0.5))
122{
123 word speciesName = IOobject::member(this->transferSpecie());
124
125 // Get the "to" thermo
126 const typename OtherThermo::thermoType& toThermo =
127 this->getLocalThermo
128 (
129 speciesName,
130 this->toThermo_
131 );
132
133 // Convert from g/mol to Kg/mol
134 Mv_.value() = toThermo.W()*1e-3;
135
136 if (Mv_.value() == -1)
137 {
139 << " Please provide the molar weight (Mv) of vapour [g/mol] "
140 << abort(FatalError);
141 }
142}
143
144
145// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
146
147template<class Thermo, class OtherThermo>
151{
152
153 const fvMesh& mesh = this->mesh_;
154
155 const dimensionedScalar HerztKnudsConst
156 (
157 sqrt
158 (
160 * pow3(Tactivate_)
162 )
163 );
164
165 word speciesName = IOobject::member(this->transferSpecie());
166 tmp<volScalarField> L = mag(this->L(speciesName, T));
167
168 updateInterface(T);
169
171 (
173 (
175 (
176 "tRhov",
177 mesh.time().timeName(),
178 mesh
179 ),
180 mesh,
182 )
183 );
184 volScalarField& rhov = tRhov.ref();
185
186 tmp<volScalarField> tdeltaT
187 (
189 (
191 (
192 "tdeltaT",
193 mesh.time().timeName(),
194 mesh
195 ),
196 mesh,
198 )
199 );
200 volScalarField& deltaT = tdeltaT.ref();
201
203
204 if (sign(C_.value()) > 0)
205 {
206 rhov = this->pair().to().rho();
207 deltaT = max(T - Tactivate_, T0);
208 }
209 else
210 {
211 rhov = this->pair().from().rho();
212 deltaT = max(Tactivate_ - T, T0);
213 }
214
215 htc_ = 2*mag(C_)/(2-mag(C_))*(L()*rhov/HerztKnudsConst);
216
217 mDotc_ = htc_*deltaT*interfaceArea_;
218
219 return tmp<volScalarField>(new volScalarField(mDotc_));
220}
221
222
223template<class Thermo, class OtherThermo>
226(
227 label variable,
228 const volScalarField& refValue
229)
230{
231 if (this->modelVariable_ == variable)
232 {
233 const volScalarField coeff(htc_*interfaceArea_);
234
235 if (sign(C_.value()) > 0)
236 {
237 return(coeff*pos(refValue - Tactivate_));
238 }
239 else
240 {
241 return(coeff*pos(Tactivate_ - refValue));
242 }
243 }
244 else
245 {
246 return tmp<volScalarField> ();
247 }
248}
249
250
251template<class Thermo, class OtherThermo>
254(
255 label variable,
256 const volScalarField& refValue
257)
258{
259 if (this->modelVariable_ == variable)
260 {
261 const volScalarField coeff(htc_*interfaceArea_*Tactivate_);
262
263 if (sign(C_.value()) > 0)
264 {
265 return(-coeff*pos(refValue - Tactivate_));
266 }
267 else
268 {
269 return(coeff*pos(Tactivate_ - refValue));
270 }
271 }
272 else
273 {
274 return tmp<volScalarField> ();
275 }
276}
277
278
279// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
word member() const
Return member (name without the extension)
Definition: IOobjectI.H:77
Base class for interface composition models, templated on the two thermodynamic models either side of...
const OtherThermo & toThermo_
Other Thermo (to)
const pureMixture< ThermoType >::thermoType & getLocalThermo(const word &speciesName, const pureMixture< ThermoType > &globalThermo) const
Get a reference to the local thermo for a pure mixture.
Class for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with an isosurface defined ...
Definition: cutCellIso.H:79
Service routines for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with a surface.
Definition: cutCell.H:60
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const Type & value() const
Return const reference to value.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Considering the Hertz Knudsen formula, which gives the evaporation-condensation flux based on the kin...
virtual tmp< volScalarField > KSu(label modelVariable, const volScalarField &field)
Explicit mass transfer coefficient.
virtual tmp< volScalarField > KSp(label modelVariable, const volScalarField &field)
Implicit mass transfer coefficient.
const word transferSpecie() const
Return the transferring species name.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:56
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
A class for handling words, derived from Foam::string.
Definition: word.H:68
const volScalarField & T
mesh interpolate(rAU)
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
word timeName
Definition: getTimeIndex.H:3
constexpr scalar pi(M_PI)
const dimensionedScalar R
Universal gas constant: default SI units: [J/mol/K].
Different types of constants.
dimensionedScalar pos(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
const dimensionSet dimless
Dimensionless.
dimensionedScalar sign(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:55
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Definition: errorManip.H:144
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
error FatalError
const dimensionSet dimDensity
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
volScalarField & alpha
dictionary dict
scalar T0
Definition: createFields.H:22
volScalarField & e
Definition: createFields.H:11
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
const vector L(dict.get< vector >("L"))