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
104 
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 void postFace(const parcelType& p, bool& keepParticle);
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
196  #include "FaceInteraction.C"
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
Foam::FaceInteraction::interactionType::ESCAPE
particles escape/are removed
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Enum< interactionType >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
CloudFunctionObject.H
Foam::FaceInteraction::interactionType::STICK
particles stick to the faceZone faces
Foam::FaceInteraction::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: FaceInteraction.H:168
Foam::FaceInteraction::parcelType
CloudType::parcelType parcelType
Convenience typedef for parcel type.
Definition: FaceInteraction.H:91
Foam::FaceInteraction::~FaceInteraction
virtual ~FaceInteraction()=default
Destructor.
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
FaceInteraction.C
Foam::FaceInteraction::FaceInteraction
FaceInteraction(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: FaceInteraction.C:136
Foam::FaceInteraction::postFace
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
Definition: FaceInteraction.C:267
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::FaceInteraction::processParticle
bool processParticle(const parcelType &p, const label localZonei)
Return true if this particle will be assessed.
Definition: FaceInteraction.C:47
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::FaceInteraction::interactionType
interactionType
Enumeration defining the interaction types.
Definition: FaceInteraction.H:94
Foam::FaceInteraction::TypeName
TypeName("faceInteraction")
Runtime type information.
Foam::FaceInteraction::interactionType::REBOUND
particles rebound from the faceZone faces
boundBox.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::FaceInteraction
Face zone-based particle interactions.
Definition: FaceInteraction.H:81
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:62
Foam::FaceInteraction::interactionTypeNames_
static const Enum< interactionType > interactionTypeNames_
Names for the interaction types.
Definition: FaceInteraction.H:102
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::FaceInteraction::write
void write()
Write post-processing info.
Definition: FaceInteraction.C:68
Enum.H