FaceInteraction.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) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::FaceInteraction
28 
29 Group
30  grpLagrangianIntermediateFunctionObjects
31 
32 Description
33  Face zone-based particle interactions.
34 
35  \verbatim
36  faceInteraction1
37  {
38  type faceInteraction;
39 
40  // List of (faceZone interactionType)
41  faceZones
42  (
43  (faceZone1 stick)
44  (faceZone2 escape)
45  (faceZone3 rebound)
46  );
47 
48  // Optional limiting to diameter range
49  dMin 0;
50  dMax 1;
51 
52  writeToFile yes; // default = yes
53  }
54  \endverbatim
55 
56  File written per faceZone as:
57 
58  postProcessing/lagrangian/cloudName/modelName/time/modelName_faceZone.dat
59 
60 SourceFiles
61  FaceInteraction.C
62 
63 \*---------------------------------------------------------------------------*/
64 
65 #ifndef FaceInteraction_H
66 #define FaceInteraction_H
67 
68 #include "CloudFunctionObject.H"
69 #include "Enum.H"
70 #include "boundBox.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 
77 /*---------------------------------------------------------------------------*\
78  Class FaceInteraction Declaration
79 \*---------------------------------------------------------------------------*/
80 
81 template<class CloudType>
82 class FaceInteraction
83 :
84  public CloudFunctionObject<CloudType>,
86 {
87 public:
88 
89  // Public Data Types
90 
91  //- Convenience typedef for parcel type
92  typedef typename CloudType::parcelType parcelType;
93 
94  //- Enumeration defining the interaction types
95  enum class interactionType
96  {
97  ESCAPE,
98  STICK,
99  REBOUND
100  };
101 
102  //- Names for the interaction types
105 
106 private:
107 
108  // Private Data
109 
110  //- Face zone IDs
111  labelList faceZoneIDs_;
112 
113  //- Face zone bounding boxes
114  List<boundBox> faceZoneBBs_;
115 
116  //- Face zone particle interaction type
117  List<interactionType> faceZoneInteraction_;
118 
119  //- File per zone
120  PtrList<OFstream> filePtrs_;
121 
122  //- Number of escape particles per zone
123  labelList nEscapeParticles_;
124 
125  //- Number of stick particles per zone
126  labelList nStickParticles_;
127 
128  //- Number of rebound particles per zone
129  labelList nReboundParticles_;
130 
131  //- Minimum diameter threshold
132  scalar dMin_;
133 
134  //- Maximum diameter threshold
135  scalar dMax_;
136 
137 
138 protected:
139 
140  // Protected Member Functions
141 
142  //- Return true if this particle will be assessed
143  bool processParticle(const parcelType& p, const label localZonei);
144 
145  //- Write post-processing info
146  void write();
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("faceInteraction");
153 
154 
155  // Constructors
156 
157  //- Construct from dictionary
159  (
160  const dictionary& dict,
161  CloudType& owner,
162  const word& modelName
163  );
164 
165  //- Construct copy
167 
168  //- Construct and return a clone
170  {
172  (
173  new FaceInteraction<CloudType>(*this)
174  );
175  }
176 
177 
178  //- Destructor
179  virtual ~FaceInteraction() = default;
180 
181 
182  // Member Functions
183 
184  //- Post-face hook
185  virtual bool postFace
186  (
187  const parcelType& p,
188  const typename parcelType::trackingData& td
189  );
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
200  #include "FaceInteraction.C"
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Face zone-based particle interactions.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
particles stick to the faceZone faces
virtual ~FaceInteraction()=default
Destructor.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:98
bool processParticle(const parcelType &p, const label localZonei)
Return true if this particle will be assessed.
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.
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("faceInteraction")
Runtime type information.
CloudType::parcelType parcelType
Convenience typedef for parcel type.
virtual bool postFace(const parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
particles rebound from the faceZone faces
void write()
Write post-processing info.
interactionType
Enumeration defining the interaction types.
FaceInteraction(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
volScalarField & p
Base class for writing single files from the function objects.
Definition: writeFile.H:112
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Templated cloud function object base class.
Namespace for OpenFOAM.
static const Enum< interactionType > interactionTypeNames_
Names for the interaction types.