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-2022 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 "runTimeSelectionTables.H"
48 #include "CloudSubModelBase.H"
49 
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward Declarations
57 namespace regionModels
58 {
59  namespace surfaceFilmModels
60  {
61  class surfaceFilmRegionModel;
62  }
63  namespace areaSurfaceFilmModels
64  {
65  class liquidFilmBase;
66  }
67 }
68 
69 
70 /*---------------------------------------------------------------------------*\
71  Class SurfaceFilmModel Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 template<class CloudType>
75 class SurfaceFilmModel
76 :
77  public CloudSubModelBase<CloudType>
78 {
79 protected:
80 
81  // Data Types
82 
83  //- Convenience typedef to the cloud's parcel type
84  typedef typename CloudType::parcelType parcelType;
85 
86  typedef typename
88  areaFilm;
89 
90  typedef typename
92  regionFilm;
93 
94 
95  // Protected Data
96 
97  //- Gravitational acceleration constant
98  const dimensionedVector& g_;
99 
100  //- Ejected parcel type label - id assigned to identify parcel for
101  //- post-processing. If not specified, defaults to originating cloud
102  //- type
103  label ejectedParcelType_;
105  //- Injection offset position
106  scalar injectionOffset_;
107 
108  //- Minimum diameter particle injection
109  scalar minDiameter_;
110 
111 
112  // Injector fields transferred from film patch
113 
114  //- Parcel mass / patch face
116 
117  //- Parcel diameter / patch face
119 
120  //- Film velocity / patch face
123  //- Film density / patch face
125 
126  //- Film height of all film patches / patch face
128 
129 
130  // Counters
131 
132  //- Number of parcels transferred to the film model
133  label nParcelsTransferred_;
134 
135  //- Number of parcels injected from the film model
136  label nParcelsInjected_;
138 
139  // Total mass info
140 
141  //- Total mass transferred to the film
143 
144 
145  // Protected Functions
146 
147  //- Cache the film fields in preparation for injection
148  virtual void cacheFilmFields
149  (
150  const label filmPatchi,
151  const label primaryPatchi,
152  const regionFilm&
153  );
154 
155  //- Cache the finite area film fields in preparation for injection
156  virtual void cacheFilmFields(const areaFilm& film);
157 
158  //- Inject particles in cloud
159  template<class TrackCloudType>
160  void injectParticles
161  (
162  const label primaryPatchi,
163  const labelUList& injectorCells, // patch-based
164  TrackCloudType& cloud
165  );
166 
167  //- Inject particles in cloud
168  template<class TrackCloudType>
169  void injectParticles
170  (
171  const UList<labelPair>& patchFaces,
172  TrackCloudType& cloud
173  );
174 
175  //- Set the individual parcel properties
176  virtual void setParcelProperties
177  (
178  parcelType& p,
179  const label filmFacei
180  ) const;
181 
182 
183 public:
184 
185  //- Runtime type information
186  TypeName("surfaceFilmModel");
187 
188  //- Declare runtime constructor selection table
190  (
191  autoPtr,
193  dictionary,
194  (
195  const dictionary& dict,
197  ),
198  (dict, owner)
199  );
200 
201 
202  // Constructors
203 
204  //- Construct null from owner
206 
207  //- Construct from components
209  (
210  const dictionary& dict,
211  CloudType& owner,
212  const word& type
213  );
214 
215  //- Construct copy
217 
218  //- Construct and return a clone
219  virtual autoPtr<SurfaceFilmModel<CloudType>> clone() const = 0;
220 
221 
222  //- Destructor
223  virtual ~SurfaceFilmModel() = default;
224 
225 
226  //- Selector
228  (
229  const dictionary& dict,
231  );
232 
233 
234  // Member Functions
235 
236  // Access
237 
238  //- Return gravitational acceleration constant
239  inline const dimensionedVector& g() const noexcept;
240 
241  //- The number of parcels transferred to the film model
242  inline label nParcelsTransferred() const noexcept;
243 
244  //- Non-const access to number of parcels transferred to the film model
245  inline label& nParcelsTransferred() noexcept;
246 
247  //- The number of parcels injected from the film model
248  inline label nParcelsInjected() const noexcept;
249 
250  //- Non-const access to number of parcels injected from the film model
251  inline label& nParcelsInjected() noexcept;
252 
253  //- The total mass transferred
254  inline scalar totalMassTransferred() const noexcept;
255 
256  //- Non-const access to the total mass transferred
257  inline scalar& totalMassTransferred() noexcept;
258 
259 
260  // Member Functions
261 
262  //- Transfer parcel from cloud to surface film
263  // Returns true if parcel is to be transferred
264  virtual bool transferParcel
265  (
266  parcelType& p,
267  const polyPatch& pp,
268  bool& keepParticle
269  ) = 0;
270 
271  //- Inject parcels into the cloud
272  template<class TrackCloudType>
273  void inject(TrackCloudType& cloud);
274 
275 
276  // I-O
277 
278  //- Write surface film info
279  virtual void info();
280 };
281 
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 } // End namespace Foam
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #define makeSurfaceFilmModel(CloudType) \
290  \
291  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
292  defineNamedTemplateTypeNameAndDebug \
293  ( \
294  Foam::SurfaceFilmModel<kinematicCloudType>, \
295  0 \
296  ); \
297  namespace Foam \
298  { \
299  defineTemplateRunTimeSelectionTable \
300  ( \
301  SurfaceFilmModel<kinematicCloudType>, \
302  dictionary \
303  ); \
304  }
305 
306 
307 #define makeSurfaceFilmModelType(SS, CloudType) \
308  \
309  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
310  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
311  \
312  Foam::SurfaceFilmModel<kinematicCloudType>:: \
313  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
314  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
315 
316 
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 
319 #include "SurfaceFilmModelI.H"
320 
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 
323 #ifdef NoRepository
324  #include "SurfaceFilmModel.C"
325 #endif
326 
327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328 
329 #endif
330 
331 // ************************************************************************* //
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:129
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:799
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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const direction noexcept
Definition: Scalar.H:258
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.
regionModels::areaSurfaceFilmModels::liquidFilmBase areaFilm
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
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.