PatchInteractionModel.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) 2019 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::PatchInteractionModel
29 
30 Group
31  grpLagrangianIntermediatePatchInteractionSubModels
32 
33 Description
34  Templated patch interaction model class
35 
36 SourceFiles
37  PatchInteractionModel.C
38  PatchInteractionModelNew.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef PatchInteractionModel_H
43 #define PatchInteractionModel_H
44 
45 #include "IOdictionary.H"
46 #include "autoPtr.H"
47 #include "runTimeSelectionTables.H"
48 #include "polyPatch.H"
49 #include "wallPolyPatch.H"
50 #include "tetIndices.H"
51 #include "CloudSubModelBase.H"
52 #include "writeFile.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class PatchInteractionModel Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
64 class PatchInteractionModel
65 :
66  public CloudSubModelBase<CloudType>,
67  public functionObjects::writeFile
68 {
69 public:
70 
71  // Public enumerations
72 
73  // Interaction types
74  enum interactionType
75  {
80  itOther
81  };
82 
84 
85 
86 protected:
87 
88  // Protected data
89 
90  //- Name of velocity field - default = "U"
91  const word UName_;
92 
93 
94  // Counters
95 
96  //- Number of parcels escaped
98 
99  //- Mass of parcels escaped
100  scalar escapedMass_;
101 
102 
103  // Protected Member Functions
104 
105  //- Output file header information
106  virtual void writeFileHeader(Ostream& os);
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName("patchInteractionModel");
113 
114  //- Declare runtime constructor selection table
116  (
117  autoPtr,
119  dictionary,
120  (
121  const dictionary& dict,
122  CloudType& owner
123  ),
124  (dict, owner)
125  );
126 
127 
128  // Constructors
129 
130  //- Construct null from owner
132 
133  //- Construct from components
135  (
136  const dictionary& dict,
137  CloudType& owner,
138  const word& type
139  );
140 
141  //- Construct copy
143 
144  //- Construct and return a clone
145  virtual autoPtr<PatchInteractionModel<CloudType>> clone() const = 0;
146 
147 
148  //- Destructor
149  virtual ~PatchInteractionModel() = default;
150 
151 
152  //- Selector
154  (
155  const dictionary& dict,
156  CloudType& owner
157  );
158 
159 
160  // Access
161 
162  //- Return name of velocity field
163  const word& UName() const;
164 
165 
166  // Member Functions
167 
168  //- Convert interaction result to word
169  static word interactionTypeToWord(const interactionType& itEnum);
170 
171  //- Convert word to interaction result
172  static interactionType wordToInteractionType(const word& itWord);
173 
174  //- Apply velocity correction
175  // Returns true if particle remains in same cell
176  virtual bool correct
177  (
178  typename CloudType::parcelType& p,
179  const polyPatch& pp,
180  bool& keepParticle
181  ) = 0;
182 
183  //- Add to escaped parcels
184  void addToEscapedParcels(const scalar mass);
185 
186 
187  //- Write patch interaction info to stream
188  virtual void info(Ostream& os);
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #define makePatchInteractionModel(CloudType) \
199  \
200  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
201  defineNamedTemplateTypeNameAndDebug \
202  ( \
203  Foam::PatchInteractionModel<kinematicCloudType>, \
204  0 \
205  ); \
206  \
207  namespace Foam \
208  { \
209  defineTemplateRunTimeSelectionTable \
210  ( \
211  PatchInteractionModel<kinematicCloudType>, \
212  dictionary \
213  ); \
214  }
215 
216 
217 #define makePatchInteractionModelType(SS, CloudType) \
218  \
219  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
220  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
221  \
222  Foam::PatchInteractionModel<kinematicCloudType>:: \
223  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
224  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
230  #include "PatchInteractionModel.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
writeFile.H
Foam::PatchInteractionModel::itOther
Definition: PatchInteractionModel.H:79
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::PatchInteractionModel::escapedParcels_
label escapedParcels_
Number of parcels escaped.
Definition: PatchInteractionModel.H:96
Foam::PatchInteractionModel::addToEscapedParcels
void addToEscapedParcels(const scalar mass)
Add to escaped parcels.
Definition: PatchInteractionModel.C:192
polyPatch.H
wallPolyPatch.H
Foam::PatchInteractionModel::interactionTypeNames_
static wordList interactionTypeNames_
Definition: PatchInteractionModel.H:82
Foam::PatchInteractionModel::UName_
const word UName_
Name of velocity field - default = "U".
Definition: PatchInteractionModel.H:90
Foam::PatchInteractionModel::TypeName
TypeName("patchInteractionModel")
Runtime type information.
Foam::PatchInteractionModel::~PatchInteractionModel
virtual ~PatchInteractionModel()=default
Destructor.
Foam::PatchInteractionModel::UName
const word & UName() const
Return name of velocity field.
Definition: PatchInteractionModel.C:184
Foam::PatchInteractionModel::New
static autoPtr< PatchInteractionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PatchInteractionModelNew.C:36
Foam::PatchInteractionModel
Templated patch interaction model class.
Definition: KinematicCloud.H:89
Foam::PatchInteractionModel::clone
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const =0
Construct and return a clone.
Foam::PatchInteractionModel::itNone
Definition: PatchInteractionModel.H:75
Foam::label
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:62
CloudSubModelBase.H
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PatchInteractionModel::itEscape
Definition: PatchInteractionModel.H:78
Foam::PatchInteractionModel::itStick
Definition: PatchInteractionModel.H:77
Foam::PatchInteractionModel::PatchInteractionModel
PatchInteractionModel(CloudType &owner)
Construct null from owner.
Definition: PatchInteractionModel.C:132
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PatchInteractionModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, PatchInteractionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List< word >
Foam::PatchInteractionModel::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: PatchInteractionModel.C:46
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::PatchInteractionModel::wordToInteractionType
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
Definition: PatchInteractionModel.C:101
Foam::PatchInteractionModel::info
virtual void info(Ostream &os)
Write patch interaction info to stream.
Definition: PatchInteractionModel.C:202
Foam::PatchInteractionModel::itRebound
Definition: PatchInteractionModel.H:76
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::PatchInteractionModel::correct
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)=0
Apply velocity correction.
Foam::PatchInteractionModel::escapedMass_
scalar escapedMass_
Mass of parcels escaped.
Definition: PatchInteractionModel.H:99
Foam::PatchInteractionModel< Foam::KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::interactionType
interactionType
Definition: PatchInteractionModel.H:73
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::PatchInteractionModel::interactionTypeToWord
static word interactionTypeToWord(const interactionType &itEnum)
Convert interaction result to word.
Definition: PatchInteractionModel.C:61
tetIndices.H
PatchInteractionModel.C
autoPtr.H