SurfaceFilmModel.H
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) 2020-2025 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 Class
28  Foam::SurfaceFilmModel
29 
30 Group
31  grpLagrangianIntermediateSurfaceFilmSubModels
32 
33 Description
34  Templated wall surface film model class.
35 
36 SourceFiles
37  SurfaceFilmModel.C
38  SurfaceFilmModelNew.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_SurfaceFilmModel_H
43 #define Foam_SurfaceFilmModel_H
44 
45 #include "IOdictionary.H"
46 #include "autoPtr.H"
47 #include "UPtrList.H"
48 #include "faMesh.H"
49 #include "polyMesh.H"
50 #include "runTimeSelectionTables.H"
51 #include "CloudSubModelBase.H"
52 
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // Forward Declarations
60 namespace regionModels
61 {
62  namespace surfaceFilmModels
63  {
64  class surfaceFilmRegionModel;
65  }
66  namespace areaSurfaceFilmModels
67  {
68  class liquidFilmBase;
69  }
70 }
71 
72 
73 /*---------------------------------------------------------------------------*\
74  Class SurfaceFilmModel Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 template<class CloudType>
78 class SurfaceFilmModel
79 :
80  public CloudSubModelBase<CloudType>
81 {
82 protected:
83 
84  // Data Types
85 
86  //- Convenience typedef to the cloud's parcel type
87  typedef typename CloudType::parcelType parcelType;
88 
89  typedef typename
91  areaFilm;
92 
93  typedef typename
95  regionFilm;
96 
97 
98  // Protected Data
99 
100  //- Gravitational acceleration constant
101  const dimensionedVector& g_;
102 
103  //- Ejected parcel type label - id assigned to identify parcel for
104  //- post-processing. If not specified, defaults to originating cloud
105  //- type
106  label ejectedParcelType_;
108  //- Injection offset position
109  scalar injectionOffset_;
110 
111  //- Minimum diameter particle injection
112  scalar minDiameter_;
113 
114 
115  // Injector fields transferred from film patch
116 
117  //- Parcel mass / patch face
119 
120  //- Parcel diameter / patch face
122 
123  //- Film velocity / patch face
126  //- Film density / patch face
128 
129  //- Film height of all film patches / patch face
131 
132 
133  // Counters
134 
135  //- Number of parcels transferred to the film model
136  label nParcelsTransferred_;
137 
138  //- Number of parcels injected from the film model
139  label nParcelsInjected_;
141 
142  // Total mass info
143 
144  //- Total mass transferred to the film
146 
147 
148  // Protected Functions
149 
150  //- Cache the film fields in preparation for injection
151  virtual void cacheFilmFields
152  (
153  const label filmPatchi,
154  const label primaryPatchi,
155  const regionFilm&
156  );
157 
158  //- Cache the finite area film fields in preparation for injection
159  virtual void cacheFilmFields(const areaFilm& film);
160 
161  //- Inject particles in cloud
162  template<class TrackCloudType>
163  void injectParticles
164  (
165  const label primaryPatchi,
166  const labelUList& injectorCells, // patch-based
167  TrackCloudType& cloud
168  );
169 
170  //- Inject particles in cloud
171  template<class TrackCloudType>
172  void injectParticles
173  (
174  const UList<labelPair>& patchFaces,
175  TrackCloudType& cloud
176  );
177 
178  //- Set the individual parcel properties
179  virtual void setParcelProperties
180  (
181  parcelType& p,
182  const label filmFacei
183  ) const;
184 
185 
186 public:
187 
188  //- Runtime type information
189  TypeName("surfaceFilmModel");
190 
191  //- Declare runtime constructor selection table
193  (
194  autoPtr,
196  dictionary,
197  (
198  const dictionary& dict,
200  ),
201  (dict, owner)
202  );
203 
204 
205  // Constructors
206 
207  //- Construct null from owner
209 
210  //- Construct from components
212  (
213  const dictionary& dict,
214  CloudType& owner,
215  const word& type
216  );
217 
218  //- Construct copy
220 
221  //- Construct and return a clone
222  virtual autoPtr<SurfaceFilmModel<CloudType>> clone() const = 0;
223 
224 
225  //- Destructor
226  virtual ~SurfaceFilmModel() = default;
227 
228 
229  //- Selector
231  (
232  const dictionary& dict,
234  );
235 
236 
237  // Member Functions
238 
239  // Access
240 
241  //- Return gravitational acceleration constant
242  inline const dimensionedVector& g() const noexcept;
243 
244  //- The number of parcels transferred to the film model
245  inline label nParcelsTransferred() const noexcept;
246 
247  //- Non-const access to number of parcels transferred to the film model
248  inline label& nParcelsTransferred() noexcept;
249 
250  //- The number of parcels injected from the film model
251  inline label nParcelsInjected() const noexcept;
252 
253  //- Non-const access to number of parcels injected from the film model
254  inline label& nParcelsInjected() noexcept;
255 
256  //- The total mass transferred
257  inline scalar totalMassTransferred() const noexcept;
258 
259  //- Non-const access to the total mass transferred
260  inline scalar& totalMassTransferred() noexcept;
261 
262 
263  //- Registry
264 
265  //- Return a sorted list of area-film objects that are
266  //- registered on the faMeshesRegistry
267  static UPtrList<const areaFilm> csorted_areaFilms(const polyMesh&);
268 
269  //- Return a sorted list of area-film objects that are
270  //- registered on the faMeshesRegistry
271  static UPtrList<areaFilm> sorted_areaFilms(const polyMesh&);
272 
273 
274  // Member Functions
275 
276  //- Transfer parcel from cloud to surface film
277  // Returns true if parcel is to be transferred
278  virtual bool transferParcel
279  (
280  parcelType& p,
281  const polyPatch& pp,
282  bool& keepParticle
283  ) = 0;
284 
285  //- Inject parcels into the cloud
286  template<class TrackCloudType>
287  void inject(TrackCloudType& cloud);
288 
289 
290  // I-O
291 
292  //- Write surface film info
293  virtual void info();
294 };
295 
296 
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
298 
299 } // End namespace Foam
300 
301 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
302 
303 #define makeSurfaceFilmModel(CloudType) \
304  \
305  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
306  defineNamedTemplateTypeNameAndDebug \
307  ( \
308  Foam::SurfaceFilmModel<kinematicCloudType>, \
309  0 \
310  ); \
311  namespace Foam \
312  { \
313  defineTemplateRunTimeSelectionTable \
314  ( \
315  SurfaceFilmModel<kinematicCloudType>, \
316  dictionary \
317  ); \
318  }
319 
320 
321 #define makeSurfaceFilmModelType(SS, CloudType) \
322  \
323  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
324  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
325  \
326  Foam::SurfaceFilmModel<kinematicCloudType>:: \
327  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
328  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
329 
330 
331 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332 
333 #include "SurfaceFilmModelI.H"
334 
335 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
336 
337 #ifdef NoRepository
338  #include "SurfaceFilmModel.C"
339 #endif
340 
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342 
343 #endif
344 
345 // ************************************************************************* //
const dimensionedVector & g() const noexcept
Return gravitational acceleration constant.
TypeName("surfaceFilmModel")
Runtime type information.
void injectParticles(const label primaryPatchi, const labelUList &injectorCells, TrackCloudType &cloud)
Inject particles in cloud.
scalarField rhoFilmPatch_
Film density / patch face.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
scalar minDiameter_
Minimum diameter particle injection.
scalarField massParcelPatch_
Parcel mass / patch face.
Field< scalarField > deltaFilmPatch_
Film height of all film patches / patch face.
label nParcelsInjected_
Number of parcels injected from the film model.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
const CloudType & owner() const
Return const access to the owner cloud.
static autoPtr< SurfaceFilmModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:801
virtual autoPtr< SurfaceFilmModel< CloudType > > clone() const =0
Construct and return a clone.
A class for handling words, derived from Foam::string.
Definition: word.H:63
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:53
label nParcelsTransferred() const noexcept
The number of parcels transferred to the film model.
void inject(TrackCloudType &cloud)
Inject parcels into the cloud.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const direction noexcept
Definition: scalarImpl.H:265
virtual void info()
Write surface film info.
scalarField diameterParcelPatch_
Parcel diameter / patch face.
Field< vector > UFilmPatch_
Film velocity / patch face.
Templated wall surface film model class.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
static UPtrList< const areaFilm > csorted_areaFilms(const polyMesh &)
Registry.
regionModels::areaSurfaceFilmModels::liquidFilmBase areaFilm
static UPtrList< areaFilm > sorted_areaFilms(const polyMesh &)
Return a sorted list of area-film objects that are registered on the faMeshesRegistry.
virtual void cacheFilmFields(const label filmPatchi, const label primaryPatchi, const regionFilm &)
Cache the film fields in preparation for injection.
CloudType::parcelType parcelType
Convenience typedef to the cloud&#39;s parcel type.
virtual bool transferParcel(parcelType &p, const polyPatch &pp, bool &keepParticle)=0
Transfer parcel from cloud to surface film.
label nParcelsTransferred_
Number of parcels transferred to the film model.
SurfaceFilmModel(CloudType &owner)
Construct null from owner.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Macros to ease declaration of run-time selection tables.
regionModels::surfaceFilmModels::surfaceFilmRegionModel regionFilm
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
virtual ~SurfaceFilmModel()=default
Destructor.
scalar totalMassTransferred_
Total mass transferred to the film.
scalar totalMassTransferred() const noexcept
The total mass transferred.
label ejectedParcelType_
Ejected parcel type label - id assigned to identify parcel for post-processing. If not specified...
const dimensionedVector & g_
Gravitational acceleration constant.
declareRunTimeSelectionTable(autoPtr, SurfaceFilmModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.
scalar injectionOffset_
Injection offset position.
label nParcelsInjected() const noexcept
The number of parcels injected from the film model.