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 -------------------------------------------------------------------------------
11 License
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 
33 template<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 
50 template<class CloudType>
52 (
54 )
55 :
57  thermo_(sfm.thermo_),
58  TFilmPatch_(sfm.TFilmPatch_),
59  CpFilmPatch_(sfm.CpFilmPatch_)
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64 
65 template<class CloudType>
67 (
68  parcelType& p,
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 
204 template<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 
227 template<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 
248 template<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 
263 template<class CloudType>
265 {
267 }
268 
269 
270 // ************************************************************************* //
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel::Ts
virtual const volScalarField & Ts() const =0
Return the film surface temperature [K].
Foam::ThermoSurfaceFilm::cacheFilmFields
virtual void cacheFilmFields(const label primaryPatchi, const areaFilm &)
Cache the film fields in preparation for injection.
Definition: ThermoSurfaceFilm.C:229
Foam::regionModels::areaSurfaceFilmModels::liquidFilmBase
Definition: liquidFilmBase.H:60
p
volScalarField & p
Definition: createFieldRefs.H:8
ThermoSurfaceFilm.H
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFieldRefs.H:4
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel::Cp
virtual const volScalarField & Cp() const =0
Return the film specific heat capacity [J/kg/K].
Foam::ThermoSurfaceFilm::ThermoSurfaceFilm
ThermoSurfaceFilm(const dictionary &dict, CloudType &owner)
Construct from components.
Definition: ThermoSurfaceFilm.C:35
Foam::ThermoSurfaceFilm::TFilmPatch_
scalarField TFilmPatch_
Film temperature / patch face.
Definition: ThermoSurfaceFilm.H:81
Foam::regionModels::regionFaModel::vsm
const volSurfaceMapping & vsm() const
Return mapping between surface and volume fields.
Definition: regionFaModel.C:110
Foam::volSurfaceMapping::mapToField
void mapToField(const GeometricField< Type, faPatchField, areaMesh > &af, Field< Type > &f) const
Map surface field to field.
Definition: volSurfaceMapping.C:180
Foam::regionModels::regionModel::toPrimary
void toPrimary(const label regionPatchi, List< Type > &regionField) const
Convert a local region field to the primary region.
Definition: regionModelTemplates.C:147
Foam::ThermoSurfaceFilm
Thermo parcel surface film model.
Definition: ThermoSurfaceFilm.H:57
Foam::liquidProperties
The thermophysical properties of a liquid.
Definition: liquidProperties.H:51
Foam::ThermoSurfaceFilm::CpFilmPatch_
scalarField CpFilmPatch_
Film specific heat capacity / patch face.
Definition: ThermoSurfaceFilm.H:84
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel
Base class for surface film models.
Definition: surfaceFilmRegionModel.H:55
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::KinematicSurfaceFilm::parcelType
CloudType::parcelType parcelType
Convenience typedef to the cloud's parcel type.
Definition: KinematicSurfaceFilm.H:112
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::regionModels::areaSurfaceFilmModels::liquidFilmBase::region
const regionFaModel & region() const
Access to this region.
Definition: liquidFilmBase.C:543
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::KinematicSurfaceFilm
Kinematic parcel surface film model.
Definition: KinematicSurfaceFilm.H:78
Foam::liquidProperties::mu
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
Foam::ThermoSurfaceFilm::info
virtual void info(Ostream &os)
Write surface film info to stream.
Definition: ThermoSurfaceFilm.C:264
Foam::liquidProperties::sigma
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::ThermoSurfaceFilm::thermo_
const SLGThermo & thermo_
Reference to the cloud thermo package.
Definition: ThermoSurfaceFilm.H:75
Foam::polyPatch::whichFace
label whichFace(const label l) const
Return label of face in patch from global face label.
Definition: polyPatch.H:448
Foam::ThermoSurfaceFilm::setParcelProperties
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
Definition: ThermoSurfaceFilm.C:250
Foam::volSurfaceMapping
Volume to surface and surface to volume mapping.
Definition: volSurfaceMapping.H:57
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
sigma
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Foam::ThermoSurfaceFilm::transferParcel
virtual bool transferParcel(parcelType &p, const polyPatch &pp, bool &keepParticle)
Transfer parcel from cloud to surface film.
Definition: ThermoSurfaceFilm.C:67
Foam::regionModels::areaSurfaceFilmModels::liquidFilmBase::Cp
virtual const areaScalarField & Cp() const =0
Access const reference Cp.
Foam::regionModels::areaSurfaceFilmModels::liquidFilmBase::Tf
virtual const areaScalarField & Tf() const =0
Access const reference Tf.
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62