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 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 SurfaceFilmModel_H
43 #define 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 declaration of classes
57 namespace regionModels
58 {
59  namespace surfaceFilmModels
60  {
61  class surfaceFilmRegionModel;
62  }
63 }
64 
65 namespace regionModels
66 {
67  namespace areaSurfaceFilmModels
68  {
69  class liquidFilmBase;
70  }
71 }
72 
73 
74 /*---------------------------------------------------------------------------*\
75  Class SurfaceFilmModel Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 template<class CloudType>
79 class SurfaceFilmModel
80 :
81  public CloudSubModelBase<CloudType>
82 {
83 protected:
84 
85  // Protected data
86 
87  //- Convenience typedef to the cloud's parcel type
88  typedef typename CloudType::parcelType parcelType;
89 
90  typedef typename
92 
93  //- Gravitational acceleration constant
94  const dimensionedVector& g_;
95 
96  //- Ejected parcel type label - id assigned to identify parcel for
97  // post-processing. If not specified, defaults to originating cloud
98  // type
99  label ejectedParcelType_;
100 
101  //- Injection offset position
102  scalar injectionOffset_;
103 
104  //- Minimum diameter particle injection
105  scalar minDiameter_;
106 
107 
108  // Cached injector fields per film patch
109 
110  //- Parcel mass / patch face
112 
113  //- Parcel diameter / patch face
115 
116  //- Film velocity / patch face
118 
119  //- Film density / patch face
121 
122  //- Film height of all film patches / patch face
124 
125 
126  // Counters
127 
128  //- Number of parcels transferred to the film model
129  label nParcelsTransferred_;
130 
131  //- Number of parcels injected from the film model
132  label nParcelsInjected_;
133 
134 
135  // Total mass info
136 
137  //- Total mass transferred to the film
138  scalar totalMassTransferred_;
139 
140 
141  // Protected functions
142 
143  //- Cache the film fields in preparation for injection
144  virtual void cacheFilmFields
145  (
146  const label filmPatchi,
147  const label primaryPatchi,
149  );
150 
151  //- Cache the finite area film fields in preparation for injection
152  virtual void cacheFilmFields
153  (
154  const label primaryPatchi,
155  const areaFilm&
156  );
157 
158  //- Inject particles in cloud
159  template<class TrackCloudType>
160  void injectParticles
161  (
162  const label primaryPatchi,
163  const labelList& injectorCellsPatch,
164  TrackCloudType& cloud
165  );
166 
167  //- Set the individual parcel properties
168  virtual void setParcelProperties
169  (
170  parcelType& p,
171  const label filmFacei
172  ) const;
173 
174 
175 public:
176 
177  //- Runtime type information
178  TypeName("surfaceFilmModel");
179 
180  //- Declare runtime constructor selection table
182  (
183  autoPtr,
185  dictionary,
186  (
187  const dictionary& dict,
188  CloudType& owner
189  ),
190  (dict, owner)
191  );
192 
193 
194  // Constructors
195 
196  //- Construct null from owner
197  SurfaceFilmModel(CloudType& owner);
198 
199  //- Construct from components
201  (
202  const dictionary& dict,
203  CloudType& owner,
204  const word& type
205  );
206 
207  //- Construct copy
209 
210  //- Construct and return a clone
211  virtual autoPtr<SurfaceFilmModel<CloudType>> clone() const = 0;
212 
213 
214  //- Destructor
215  virtual ~SurfaceFilmModel();
216 
217 
218  //- Selector
220  (
221  const dictionary& dict,
222  CloudType& owner
223  );
224 
225 
226  // Member Functions
227 
228  // Access
229 
230  //- Return gravitational acceleration constant
231  inline const dimensionedVector& g() const;
232 
233  //- Return const access to the number of parcels transferred to the
234  // film model
235  inline label nParcelsTransferred() const;
236 
237  //- Return non-const access to the number of parcels transferred to
238  // the film model
239  inline label& nParcelsTransferred();
240 
241  //- Return const access to the number of parcels injected from the
242  // film model
243  inline label nParcelsInjected() const;
244 
245  //- Return non-const access to the number of parcels injected from
246  // the film model
247  inline label& nParcelsInjected();
248 
249  //- Return non-const total mass transferred
250  inline scalar& totalMassTransferred();
251 
252  //- Return consr access to mass transferred
253  inline scalar totalMassTransferred() const;
254 
255 
256  // Member Functions
257 
258  //- Transfer parcel from cloud to surface film
259  // Returns true if parcel is to be transferred
260  virtual bool transferParcel
261  (
262  parcelType& p,
263  const polyPatch& pp,
264  bool& keepParticle
265  ) = 0;
266 
267  //- Inject parcels into the cloud
268  template<class TrackCloudType>
269  void inject(TrackCloudType& cloud);
270 
271 
272  // I-O
273 
274  //- Write surface film info to stream
275  virtual void info(Ostream& os);
276 };
277 
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 } // End namespace Foam
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #define makeSurfaceFilmModel(CloudType) \
286  \
287  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
288  defineNamedTemplateTypeNameAndDebug \
289  ( \
290  Foam::SurfaceFilmModel<kinematicCloudType>, \
291  0 \
292  ); \
293  namespace Foam \
294  { \
295  defineTemplateRunTimeSelectionTable \
296  ( \
297  SurfaceFilmModel<kinematicCloudType>, \
298  dictionary \
299  ); \
300  }
301 
302 
303 #define makeSurfaceFilmModelType(SS, CloudType) \
304  \
305  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
306  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
307  \
308  Foam::SurfaceFilmModel<kinematicCloudType>:: \
309  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
310  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
311 
312 
313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314 
315 #include "SurfaceFilmModelI.H"
316 
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 
319 #ifdef NoRepository
320  #include "SurfaceFilmModel.C"
321 #endif
322 
323 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
324 
325 #endif
326 
327 // ************************************************************************* //
Foam::SurfaceFilmModel::cacheFilmFields
virtual void cacheFilmFields(const label filmPatchi, const label primaryPatchi, const regionModels::surfaceFilmModels::surfaceFilmRegionModel &)
Cache the film fields in preparation for injection.
Definition: SurfaceFilmModel.C:267
Foam::regionModels::areaSurfaceFilmModels::liquidFilmBase
Definition: liquidFilmBase.H:60
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::SurfaceFilmModel::g_
const dimensionedVector & g_
Gravitational acceleration constant.
Definition: SurfaceFilmModel.H:93
Foam::SurfaceFilmModel::injectionOffset_
scalar injectionOffset_
Injection offset position.
Definition: SurfaceFilmModel.H:101
Foam::SurfaceFilmModel::totalMassTransferred_
scalar totalMassTransferred_
Total mass transferred to the film.
Definition: SurfaceFilmModel.H:137
SurfaceFilmModelI.H
SurfaceFilmModel.C
Foam::SurfaceFilmModel::UFilmPatch_
Field< vector > UFilmPatch_
Film velocity / patch face.
Definition: SurfaceFilmModel.H:116
Foam::SurfaceFilmModel::nParcelsTransferred_
label nParcelsTransferred_
Number of parcels transferred to the film model.
Definition: SurfaceFilmModel.H:128
Foam::SurfaceFilmModel::TypeName
TypeName("surfaceFilmModel")
Runtime type information.
Foam::SurfaceFilmModel::~SurfaceFilmModel
virtual ~SurfaceFilmModel()
Destructor.
Definition: SurfaceFilmModel.C:115
Foam::SurfaceFilmModel::nParcelsInjected_
label nParcelsInjected_
Number of parcels injected from the film model.
Definition: SurfaceFilmModel.H:131
Foam::SurfaceFilmModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, SurfaceFilmModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
Foam::SurfaceFilmModel::transferParcel
virtual bool transferParcel(parcelType &p, const polyPatch &pp, bool &keepParticle)=0
Transfer parcel from cloud to surface film.
Foam::SurfaceFilmModel::deltaFilmPatch_
Field< scalarField > deltaFilmPatch_
Film height of all film patches / patch face.
Definition: SurfaceFilmModel.H:122
Foam::SurfaceFilmModel::nParcelsInjected
label nParcelsInjected() const
Return const access to the number of parcels injected from the.
Definition: SurfaceFilmModelI.H:61
Foam::SurfaceFilmModel::parcelType
CloudType::parcelType parcelType
Convenience typedef to the cloud's parcel type.
Definition: SurfaceFilmModel.H:87
Foam::Field< scalar >
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel
Base class for surface film models.
Definition: surfaceFilmRegionModel.H:55
Foam::SurfaceFilmModel
Templated wall surface film model class.
Definition: KinematicCloud.H:92
CloudSubModelBase.H
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::SurfaceFilmModel::inject
void inject(TrackCloudType &cloud)
Inject parcels into the cloud.
Definition: SurfaceFilmModel.C:180
Foam::SurfaceFilmModel::massParcelPatch_
scalarField massParcelPatch_
Parcel mass / patch face.
Definition: SurfaceFilmModel.H:110
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
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::dimensioned< vector >
Foam::SurfaceFilmModel::areaFilm
regionModels::areaSurfaceFilmModels::liquidFilmBase areaFilm
Definition: SurfaceFilmModel.H:90
Foam::SurfaceFilmModel::rhoFilmPatch_
scalarField rhoFilmPatch_
Film density / patch face.
Definition: SurfaceFilmModel.H:119
Foam::SurfaceFilmModel::minDiameter_
scalar minDiameter_
Minimum diameter particle injection.
Definition: SurfaceFilmModel.H:104
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SurfaceFilmModel::nParcelsTransferred
label nParcelsTransferred() const
Return const access to the number of parcels transferred to the.
Definition: SurfaceFilmModelI.H:47
Foam::SurfaceFilmModel::g
const dimensionedVector & g() const
Return gravitational acceleration constant.
Definition: SurfaceFilmModelI.H:33
Foam::SurfaceFilmModel::setParcelProperties
virtual void setParcelProperties(parcelType &p, const label filmFacei) const
Set the individual parcel properties.
Definition: SurfaceFilmModel.C:327
Foam::SurfaceFilmModel::totalMassTransferred
scalar & totalMassTransferred()
Return non-const total mass transferred.
Definition: SurfaceFilmModelI.H:67
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
Foam::SurfaceFilmModel::injectParticles
void injectParticles(const label primaryPatchi, const labelList &injectorCellsPatch, TrackCloudType &cloud)
Inject particles in cloud.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List< label >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::SurfaceFilmModel::info
virtual void info(Ostream &os)
Write surface film info to stream.
Definition: SurfaceFilmModel.C:356
Foam::SurfaceFilmModel::ejectedParcelType_
label ejectedParcelType_
Ejected parcel type label - id assigned to identify parcel for.
Definition: SurfaceFilmModel.H:98
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::SurfaceFilmModel::SurfaceFilmModel
SurfaceFilmModel(CloudType &owner)
Construct null from owner.
Definition: SurfaceFilmModel.C:39
Foam::SurfaceFilmModel::diameterParcelPatch_
scalarField diameterParcelPatch_
Parcel diameter / patch face.
Definition: SurfaceFilmModel.H:113
Foam::SurfaceFilmModel::New
static autoPtr< SurfaceFilmModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: SurfaceFilmModelNew.C:36
Foam::SurfaceFilmModel::clone
virtual autoPtr< SurfaceFilmModel< CloudType > > clone() const =0
Construct and return a clone.
liquidFilmBase
Base class for thermal 2D shells.
autoPtr.H