SurfaceFilmModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::SurfaceFilmModel
26 
27 Description
28  Templated wall surface film model class.
29 
30 SourceFiles
31  SurfaceFilmModel.C
32  SurfaceFilmModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef SurfaceFilmModel_H
37 #define SurfaceFilmModel_H
38 
39 #include "CloudSubModelBase.H"
40 #include "dimensionedTypes.H"
41 #include "polyPatch.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SurfaceFilmModel Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class CloudType>
54 class SurfaceFilmModel
55 :
56  public CloudSubModelBase<CloudType>
57 {
58 protected:
59 
60  // Protected data
61 
62  //- Convenience typedef to the cloud's parcel type
63  typedef typename CloudType::parcelType parcelType;
64 
65  //- Gravitational acceleration constant
66  const dimensionedVector& g_;
67 
68  //- Ejected parcel type label - id assigned to identify parcel for
69  // post-processing. If not specified, defaults to originating cloud
70  // type
72 
73 
74  // Cached injector fields per film patch
75 
76  //- Parcel mass / patch face
78 
79  //- Parcel diameter / patch face
81 
82  //- Film height of all film patches / patch face
84 
85 
86  // Counters
87 
88  //- Number of parcels transferred to the film model
90 
91  //- Number of parcels injected from the film model
93 
94 
95  // Protected functions
96 
97  //- Return list of film patches
98  virtual const labelList& filmPatches() const = 0;
99 
100  //- Cache the film fields in preparation for injection
101  virtual void cacheFilmFields(const label filmi) = 0;
102 
103  //- Set the individual parcel properties
104  virtual void setParcelProperties
105  (
106  parcelType& p,
107  const label filmFacei
108  ) const = 0;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("surfaceFilm");
115 
116  //- Declare runtime constructor selection table
118  (
119  autoPtr,
121  dictionary,
122  (
123  const dictionary& dict,
125  ),
126  (dict, owner)
127  );
128 
129 
130  // Constructors
131 
132  //- Construct null from owner
134 
135  //- Construct from components
137  (
138  const dictionary& dict,
139  CloudType& owner,
140  const word& type
141  );
142 
143  //- Construct copy
145 
146  //- Construct and return a clone
147  virtual autoPtr<SurfaceFilmModel<CloudType>> clone() const = 0;
148 
149 
150  //- Destructor
151  virtual ~SurfaceFilmModel();
152 
153 
154  //- Selector
156  (
157  const dictionary& dict,
159  );
160 
161 
162  // Member Functions
163 
164  // Access
165 
166  //- Return gravitational acceleration constant
167  inline const dimensionedVector& g() const;
168 
169  //- Return const access to the number of parcels transferred to the
170  // film model
171  inline label nParcelsTransferred() const;
172 
173  //- Return non-const access to the number of parcels transferred to
174  // the film model
175  inline label& nParcelsTransferred();
176 
177  //- Return const access to the number of parcels injected from the
178  // film model
179  inline label nParcelsInjected() const;
180 
181  //- Return non-const access to the number of parcels injected from
182  // the film model
183  inline label& nParcelsInjected();
184 
185 
186  // Member Functions
187 
188  //- Transfer parcel from cloud to surface film
189  // Returns true if parcel is to be transferred
190  virtual bool transferParcel
191  (
192  parcelType& p,
193  const polyPatch& pp,
194  bool& keepParticle
195  ) = 0;
196 
197  //- Inject parcels into the cloud
198  template<class TrackCloudType>
199  void inject(TrackCloudType& cloud);
200 
201 
202  // I-O
203 
204  //- Write surface film info to stream
205  virtual void info(Ostream& os);
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #define makeSurfaceFilmModel(CloudType) \
216  \
217  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
218  defineNamedTemplateTypeNameAndDebug \
219  ( \
220  Foam::SurfaceFilmModel<momentumCloudType>, \
221  0 \
222  ); \
223  namespace Foam \
224  { \
225  defineTemplateRunTimeSelectionTable \
226  ( \
227  SurfaceFilmModel<momentumCloudType>, \
228  dictionary \
229  ); \
230  }
231 
232 
233 #define makeSurfaceFilmModelType(SS, CloudType) \
234  \
235  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
236  defineNamedTemplateTypeNameAndDebug(Foam::SS<momentumCloudType>, 0); \
237  \
238  Foam::SurfaceFilmModel<momentumCloudType>:: \
239  adddictionaryConstructorToTable<Foam::SS<momentumCloudType>> \
240  add##SS##CloudType##momentumCloudType##ConstructorToTable_;
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #include "SurfaceFilmModelI.H"
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #ifdef NoRepository
250  #include "SurfaceFilmModel.C"
251 #endif
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Templated wall surface film model class.
virtual void cacheFilmFields(const label filmi)=0
Cache the film fields in preparation for injection.
virtual bool transferParcel(parcelType &p, const polyPatch &pp, bool &keepParticle)=0
Transfer parcel from cloud to surface film.
scalarField massParcelPatch_
Parcel mass / patch face.
void inject(TrackCloudType &cloud)
Inject parcels into the cloud.
declareRunTimeSelectionTable(autoPtr, SurfaceFilmModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual void info(Ostream &os)
Write surface film info to stream.
label nParcelsInjected_
Number of parcels injected from the film model.
virtual void setParcelProperties(parcelType &p, const label filmFacei) const =0
Set the individual parcel properties.
static autoPtr< SurfaceFilmModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
const dimensionedVector & g_
Gravitational acceleration constant.
virtual const labelList & filmPatches() const =0
Return list of film patches.
virtual ~SurfaceFilmModel()
Destructor.
label ejectedParcelType_
Ejected parcel type label - id assigned to identify parcel for.
scalarField diameterParcelPatch_
Parcel diameter / patch face.
label nParcelsTransferred() const
Return const access to the number of parcels transferred to the.
virtual autoPtr< SurfaceFilmModel< CloudType > > clone() const =0
Construct and return a clone.
scalarField deltaFilmPatch_
Film height of all film patches / patch face.
TypeName("surfaceFilm")
Runtime type information.
const dimensionedVector & g() const
Return gravitational acceleration constant.
label nParcelsTransferred_
Number of parcels transferred to the film model.
SurfaceFilmModel(CloudType &owner)
Construct null from owner.
CloudType::parcelType parcelType
Convenience typedef to the cloud's parcel type.
label nParcelsInjected() const
Return const access to the number of parcels injected from the.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Macros to ease declaration of run-time selection tables.
volScalarField & p