Loading...
Searching...
No Matches
ThermoSurfaceFilm.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "ThermoSurfaceFilm.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class CloudType>
35(
36 const dictionary& dict,
38)
39:
42 (
43 owner.db().objectRegistry::template lookupObject<SLGThermo>("SLGThermo")
44 ),
47{}
48
49
50template<class CloudType>
52(
54)
55:
57 thermo_(sfm.thermo_),
58 TFilmPatch_(sfm.TFilmPatch_),
59 CpFilmPatch_(sfm.CpFilmPatch_)
60{}
61
62
63// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64
65template<class CloudType>
66template<class filmType>
68(
69 filmType& film,
70 const parcelType& p,
71 const polyPatch& pp,
72 const label facei,
73 const scalar mass,
74 bool& keepParticle
75)
76{
77 DebugInfo<< "Parcel " << p.origId() << " absorbInteraction" << endl;
78
79 // Patch face normal
80 const vector& nf = pp.faceNormals()[facei];
81
82 // Patch velocity
83 const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
84
85 // Relative parcel velocity
86 const vector Urel(p.U() - Up);
87
88 // Parcel normal velocity
89 const vector Un(nf*(Urel & nf));
90
91 // Parcel tangential velocity
92 const vector Ut(Urel - Un);
93
94 film.addSources
95 (
96 pp.index(),
97 facei,
98 mass, // mass
99 mass*Ut, // tangential momentum
100 mass*mag(Un), // impingement pressure
101 mass*p.hs() // energy
102 );
103
104 this->nParcelsTransferred()++;
105
106 this->totalMassTransferred() += mass;
107
108 keepParticle = false;
109}
110
111
112template<class CloudType>
114(
115 parcelType& p,
116 const polyPatch& pp,
117 bool& keepParticle
118)
119{
120 const label patchi = pp.index();
121 const label meshFacei = p.face();
122 const label facei = pp.whichFace(meshFacei);
123
124 this->initFilmModels();
125
126 // Check the singleLayer film models
127 if (this->filmModel_ && this->filmModel_->isRegionPatch(patchi))
128 {
129 auto& film = *(this->filmModel_);
130
131 switch (this->interactionType_)
132 {
134 {
135 this->bounceInteraction(p, pp, facei, keepParticle);
136
137 break;
138 }
139
141 {
142 const scalar m = p.nParticle()*p.mass();
143
144 this->absorbInteraction //<regionFilm>
145 (film, p, pp, facei, m, keepParticle);
146
147 break;
148 }
149
151 {
152 // Local pressure
153 const scalar pc = thermo_.thermo().p()[p.cell()];
154 const liquidProperties& liq = thermo_.liquids().properties()[0];
155 const scalar sigma = liq.sigma(pc, p.T());
156 const scalar mu = liq.mu(pc, p.T());
157
158 const bool dry
159 (
160 this->deltaFilmPatch_[patchi][facei] < this->deltaWet_
161 );
162
163 if (dry)
164 {
165 this->drySplashInteraction //<CloudType, regionFilm>
166 (film, sigma, mu, p, pp, facei, keepParticle);
167 }
168 else
169 {
170 this->wetSplashInteraction //<regionFilm>
171 (film, sigma, mu, p, pp, facei, keepParticle);
172 }
173
174 break;
175 }
176
177 default:
178 {
180 << "Unknown interaction type enumeration"
181 << abort(FatalError);
182 }
183 }
184
185 // Transfer parcel/parcel interactions complete
186 return true;
187 }
188
189
190 // Check the area film models
191 for (areaFilm& film : this->areaFilms_)
192 {
193 const label filmFacei
194 (
195 film.isRegionPatch(patchi)
196 ? film.regionMesh().whichFace(meshFacei)
197 : -1
198 );
199
200 if (filmFacei < 0)
201 {
202 // Film model does not include this patch face
203 continue;
204 }
205
206 switch (this->interactionType_)
207 {
209 {
210 this->bounceInteraction(p, pp, facei, keepParticle);
211
212 break;
213 }
214
216 {
217 const scalar m = p.nParticle()*p.mass();
218
219 this->absorbInteraction //<areaFilm>
220 (
221 film, p, pp, facei, m, keepParticle
222 );
223 break;
224 }
225
227 {
228 // Local pressure
229 const scalar pc = thermo_.thermo().p()[p.cell()];
230 const liquidProperties& liq = thermo_.liquids().properties()[0];
231 const scalar sigma = liq.sigma(pc, p.T());
232 const scalar mu = liq.mu(pc, p.T());
233
234 const bool dry
235 (
236 film.h()[filmFacei] < this->deltaWet_
237 );
238
239 if (dry)
240 {
241 this->drySplashInteraction //<areaFilm>
242 (film, sigma, mu, p, pp, facei, keepParticle);
243 }
244 else
245 {
246 this->wetSplashInteraction //<areaFilm>
247 (film, sigma, mu, p, pp, facei, keepParticle);
248 }
249
250 break;
251 }
252
253 default:
254 {
256 << "Unknown interaction type enumeration"
257 << abort(FatalError);
258 }
259 }
260
261 // Transfer parcel/parcel interactions complete
262 return true;
263 }
265 // Parcel did not interact with film
266 return false;
267}
268
269
270template<class CloudType>
272(
273 const label filmPatchi,
274 const label primaryPatchi,
276)
277{
279 (
280 filmPatchi,
281 primaryPatchi,
282 filmModel
283 );
284
285 TFilmPatch_ = filmModel.Ts().boundaryField()[filmPatchi];
286 filmModel.toPrimary(filmPatchi, TFilmPatch_);
288 CpFilmPatch_ = filmModel.Cp().boundaryField()[filmPatchi];
289 filmModel.toPrimary(filmPatchi, CpFilmPatch_);
290}
291
292
293template<class CloudType>
295(
297)
298{
300
301 // Direct copy (one-to-one mapping)
302 TFilmPatch_ = film.Tf().primitiveField();
304 // Direct copy (one-to-one mapping)
305 CpFilmPatch_ = film.Cp().primitiveField();
306}
307
308
309template<class CloudType>
311(
312 parcelType& p,
313 const label filmFacei
314) const
315{
317
318 // Set parcel properties
319 p.T() = TFilmPatch_[filmFacei];
320 p.Cp() = CpFilmPatch_[filmFacei];
321}
322
323
324template<class CloudType>
326{
328}
329
330
331// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const CloudType & owner() const
Return const access to the owner cloud.
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field).
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Kinematic parcel surface film model.
virtual void cacheFilmFields(const areaFilm &film)
Cache the film fields in preparation for injection.
void wetSplashInteraction(filmType &, const scalar sigma, const scalar mu, parcelType &p, const polyPatch &pp, const label facei, bool &keepParticle)
Parcel interaction with wetted surface.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
void drySplashInteraction(filmType &, const scalar sigma, const scalar mu, const parcelType &p, const polyPatch &pp, const label facei, bool &keepParticle)
Parcel interaction with dry surface.
KinematicSurfaceFilm(const dictionary &dict, CloudType &owner, const word &type=typeName, bool initThermo=true)
Construct from components.
void bounceInteraction(parcelType &p, const polyPatch &pp, const label facei, bool &keepParticle) const
Bounce parcel (flip parcel normal velocity).
scalar deltaWet_
Film thickness beyond which patch is assumed to be wet.
interactionType interactionType_
Interaction type enumeration.
virtual void info()
Write surface film info.
UPtrList< areaFilm > areaFilms_
UPointers to area films.
regionFilm * filmModel_
Pointer to filmModel.
void initFilmModels()
Initialise pointers of films.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition SLGThermo.H:63
label nParcelsTransferred() const noexcept
The number of parcels transferred to the film model.
scalar totalMassTransferred() const noexcept
The total mass transferred.
Field< scalarField > deltaFilmPatch_
Film height of all film patches / patch face.
Thermo parcel surface film model.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
void absorbInteraction(filmType &, const parcelType &p, const polyPatch &pp, const label facei, const scalar mass, bool &keepParticle)
Absorb parcel into film.
scalarField CpFilmPatch_
Film specific heat capacity / patch face.
regionModels::areaSurfaceFilmModels::liquidFilmBase areaFilm
virtual void cacheFilmFields(const label filmPatchi, const label primaryPatchi, const regionFilm &)
Cache the film fields in preparation for injection.
ThermoSurfaceFilm(const dictionary &dict, CloudType &owner)
Construct from components.
virtual void info()
Write surface film info.
scalarField TFilmPatch_
Film temperature / patch face.
const SLGThermo & thermo_
Reference to the cloud thermo package.
CloudType::parcelType parcelType
Convenience typedef to the cloud's parcel type.
virtual bool transferParcel(parcelType &p, const polyPatch &pp, bool &keepParticle)
Transfer parcel from cloud to surface film.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
The thermophysical properties of a liquid.
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
virtual const areaScalarField & Cp() const =0
Access const reference Cp.
virtual const areaScalarField & Tf() const =0
Access const reference Tf.
void toPrimary(const label regionPatchi, List< Type > &regionField) const
Convert a local region field to the primary region.
virtual const volScalarField & Ts() const =0
Return the film surface temperature [K].
virtual const volScalarField & Cp() const =0
Return the film specific heat capacity [J/kg/K].
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Urel
Definition pEqn.H:56
#define DebugInfo
Report an information message using Foam::Info.
DSMCCloud< dsmcParcel > CloudType
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Definition errorManip.H:139
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Vector< scalar > vector
Definition vector.H:57
dictionary dict
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)