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-2021 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,
37 CloudType& owner
38)
39:
40 KinematicSurfaceFilm<CloudType>(dict, owner, typeName, false),
41 thermo_
42 (
43 owner.db().objectRegistry::template lookupObject<SLGThermo>("SLGThermo")
44 ),
45 TFilmPatch_(0),
46 CpFilmPatch_(0)
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>
67(
69 const polyPatch& pp,
70 bool& keepParticle
71)
72{
73 const label patchi = pp.index();
74
75 this->initFilmModels();
76
77 bool bInteraction(false);
78
79 // Check the singleLayer film models
80 if (this->filmModel_)
81 {
82 if (this->filmModel_->isRegionPatch(patchi))
83 {
84 const label facei = pp.whichFace(p.face());
85
86 switch (this->interactionType_)
87 {
89 {
90 this->bounceInteraction(p, pp, facei, keepParticle);
91
92 break;
93 }
95 {
96 const scalar m = p.nParticle()*p.mass();
97
98 this->absorbInteraction //<regionFilm>
99 (*(this->filmModel_), p, pp, facei, m, keepParticle);
100
101 break;
102 }
104 {
105 // Local pressure
106 const scalar pc = thermo_.thermo().p()[p.cell()];
107 const liquidProperties& liq = thermo_.liquids().properties()[0];
108 const scalar sigma = liq.sigma(pc, p.T());
109 const scalar mu = liq.mu(pc, p.T());
110
111 bool dry = this->deltaFilmPatch_[patchi][facei] < this->deltaWet_;
112
113 if (dry)
114 {
115 this->drySplashInteraction //<CloudType, regionFilm>
116 (*(this->filmModel_), sigma, mu, p, pp, facei, keepParticle);
117 }
118 else
119 {
120 this->wetSplashInteraction //<regionFilm>
121 (*(this->filmModel_), sigma, mu, p, pp, facei, keepParticle);
122 }
123
124 break;
125 }
126 default:
127 {
129 << "Unknown interaction type enumeration"
130 << abort(FatalError);
131 }
132 }
133
134 // Transfer parcel/parcel interactions complete
135 bInteraction = true;
136 }
137 }
138
139 for (areaFilm& film : this->areaFilms_)
140 {
141 if (patchi == film.patchID())
142 {
143 const label facei = pp.whichFace(p.face());
144
145 switch (this->interactionType_)
146 {
147 // It only supports absorp model
149 {
150 const scalar m = p.nParticle()*p.mass();
151
152 this->absorbInteraction //<areaFilm>
153 (
154 film, p, pp, facei, m, keepParticle
155 );
156 break;
157 }
159 {
160 this->bounceInteraction(p, pp, facei, keepParticle);
161
162 break;
163 }
165 {
166 // Local pressure
167 const scalar pc = thermo_.thermo().p()[p.cell()];
168 const liquidProperties& liq = thermo_.liquids().properties()[0];
169 const scalar sigma = liq.sigma(pc, p.T());
170 const scalar mu = liq.mu(pc, p.T());
171
172 bool dry = film.h()[facei] < this->deltaWet_;
173
174 if (dry)
175 {
176 this->drySplashInteraction //<areaFilm>
177 (film, sigma, mu, p, pp, facei, keepParticle);
178 }
179 else
180 {
181 this->wetSplashInteraction //<areaFilm>
182 (film, sigma, mu, p, pp, facei, keepParticle);
183 }
184
185 break;
186 }
187 default:
188 {
190 << "Unknown interaction type enumeration"
191 << abort(FatalError);
192 }
193 }
194 // Transfer parcel/parcel interactions complete
195 bInteraction = true;
196 }
197 }
198
199 // Parcel not interacting with film
200 return bInteraction;
201}
202
203
204template<class CloudType>
206(
207 const label filmPatchi,
208 const label primaryPatchi,
210)
211{
213 (
214 filmPatchi,
215 primaryPatchi,
216 filmModel
217 );
218
219 TFilmPatch_ = filmModel.Ts().boundaryField()[filmPatchi];
220 filmModel.toPrimary(filmPatchi, TFilmPatch_);
221
222 CpFilmPatch_ = filmModel.Cp().boundaryField()[filmPatchi];
223 filmModel.toPrimary(filmPatchi, CpFilmPatch_);
224}
225
226
227template<class CloudType>
229(
230 const label filmPatchi,
231 const areaFilm& filmModel
232)
233{
235 (
236 filmPatchi,
237 filmModel
238 );
239 const volSurfaceMapping& map = filmModel.region().vsm();
240
241 TFilmPatch_.setSize(filmModel.Tf().size(), Zero);
242 map.mapToField(filmModel.Tf(), TFilmPatch_);
243 CpFilmPatch_.setSize(filmModel.Tf().size(), Zero);
244 map.mapToField(filmModel.Cp(), CpFilmPatch_);
245}
246
247
248template<class CloudType>
250(
251 parcelType& p,
252 const label filmFacei
253) const
254{
256
257 // Set parcel properties
258 p.T() = TFilmPatch_[filmFacei];
259 p.Cp() = CpFilmPatch_[filmFacei];
260}
261
262
263template<class CloudType>
265{
267}
268
269
270// ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Kinematic parcel surface film model.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
virtual void cacheFilmFields(const label primaryPatchi, const areaFilm &)
Cache the film fields in preparation for injection.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:67
Thermo parcel surface film model.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
virtual void cacheFilmFields(const label primaryPatchi, const areaFilm &)
Cache the film fields in preparation for injection.
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.
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
InfoProxy< ensightCells > info() const
Return info proxy.
Definition: ensightCells.H:254
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.
label index() const noexcept
The index of this patch in the boundaryMesh.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
label whichFace(const label l) const
Return label of face in patch from global face label.
Definition: polyPatch.H:451
virtual const areaScalarField & Cp() const =0
Access const reference Cp.
const regionFaModel & region() const
Access to this region.
virtual const areaScalarField & Tf() const =0
Access const reference Tf.
const volSurfaceMapping & vsm() const
Return mapping between surface and volume fields.
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].
Volume to surface and surface to volume mapping.
void mapToField(const GeometricField< Type, faPatchField, areaMesh > &af, Field< Type > &f) const
Map surface field to field.
volScalarField & p
const volScalarField & mu
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
OBJstream os(runTime.globalPath()/outputName)
errorManip< error > abort(error &err)
Definition: errorManip.H:144
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
error FatalError
dictionary dict