Loading...
Searching...
No Matches
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 (
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 }
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}
144
145// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
146
147template<class Thermo, class OtherThermo>
150::Kexp(const volScalarField& T)
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
170 auto tRhov = volScalarField::New
171 (
172 "tRhov",
174 mesh,
176 );
177 auto& rhov = tRhov.ref();
178
179 auto tdeltaT = volScalarField::New
180 (
181 "tdeltaT",
183 mesh,
185 );
186 auto& deltaT = tdeltaT.ref();
187
189
190 if (sign(C_.value()) > 0)
191 {
192 rhov = this->pair().to().rho();
193 deltaT = max(T - Tactivate_, T0);
194 }
195 else
196 {
197 rhov = this->pair().from().rho();
198 deltaT = max(Tactivate_ - T, T0);
199 }
200
201 htc_ = 2*mag(C_)/(2-mag(C_))*(L()*rhov/HerztKnudsConst);
202
203 mDotc_ = htc_*deltaT*interfaceArea_;
205 return tmp<volScalarField>::New(mDotc_);
206}
207
208
209template<class Thermo, class OtherThermo>
212(
213 label variable,
214 const volScalarField& refValue
215)
216{
217 if (this->modelVariable_ == variable)
218 {
219 const volScalarField coeff(htc_*interfaceArea_);
220
221 if (sign(C_.value()) > 0)
222 {
223 return(coeff*pos(refValue - Tactivate_));
224 }
225 else
226 {
227 return(coeff*pos(Tactivate_ - refValue));
228 }
229 }
231 return nullptr;
232}
233
234
235template<class Thermo, class OtherThermo>
238(
239 label variable,
240 const volScalarField& refValue
241)
242{
243 if (this->modelVariable_ == variable)
244 {
245 const volScalarField coeff(htc_*interfaceArea_*Tactivate_);
246
247 if (sign(C_.value()) > 0)
248 {
249 return(-coeff*pos(refValue - Tactivate_));
250 }
251 else
252 {
253 return(coeff*pos(Tactivate_ - refValue));
254 }
255 }
256
257 return nullptr;
258}
259
260
261// ************************************************************************* //
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
word member() const
Return member (name without the extension).
Definition IOobjectI.H:217
Base class for interface composition models, templated on the two thermodynamic models either side of...
InterfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from components.
virtual tmp< volScalarField > L(const word &speciesName, const volScalarField &Tf) const
Latent heat (to - from)(thermo - otherThermo).
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.
static FOAM_NO_DANGLING_REFERENCE const volPointInterpolation & New(const fvMesh &mesh, Args &&... args)
Class for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with an isosurface defined ...
Definition cutCellIso.H:75
Service routines for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with a surface.
Definition cutCell.H:56
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const Type & value() const noexcept
Return const reference to value.
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
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.
const word & variable() const
Returns the variable on which the model is based.
modelVariable modelVariable_
Enumeration for the model variable.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition phasePair.H:52
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
A class for handling words, derived from Foam::string.
Definition word.H:66
const volScalarField & T
mesh interpolate(rAU)
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
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:40
const dimensionSet dimless
Dimensionless.
dimensionedScalar sign(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
const dimensionSet dimArea(sqr(dimLength))
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Definition errorManip.H:139
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimDensity
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
volScalarField & alpha
dictionary dict
scalar T0
volScalarField & e
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
const vector L(dict.get< vector >("L"))