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
97  label escapedParcels_;
98 
99  //- Mass of parcels escaped
100  scalar escapedMass_;
101 
102  //- Maximum relative U with patch for particle to be removed
103  scalar Urmax_;
104 
105 
106  // Protected Member Functions
107 
108  //- Output file header information
109  virtual void writeFileHeader(Ostream& os);
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("patchInteractionModel");
116 
117  //- Declare runtime constructor selection table
119  (
120  autoPtr,
122  dictionary,
123  (
124  const dictionary& dict,
125  CloudType& owner
126  ),
127  (dict, owner)
128  );
129 
130 
131  // Constructors
132 
133  //- Construct null from owner
135 
136  //- Construct from components
138  (
139  const dictionary& dict,
140  CloudType& owner,
141  const word& type
142  );
143 
144  //- Construct copy
146 
147  //- Construct and return a clone
148  virtual autoPtr<PatchInteractionModel<CloudType>> clone() const = 0;
149 
150 
151  //- Destructor
152  virtual ~PatchInteractionModel() = default;
153 
154 
155  //- Selector
157  (
158  const dictionary& dict,
159  CloudType& owner
160  );
161 
162 
163  // Access
164 
165  //- Return name of velocity field
166  const word& UName() const;
167 
168  //- Return Urmax
169  const scalar& Urmax() const;
170 
171  // Member Functions
172 
173  //- Convert interaction result to word
174  static word interactionTypeToWord(const interactionType& itEnum);
175 
176  //- Convert word to interaction result
177  static interactionType wordToInteractionType(const word& itWord);
178 
179  //- Apply velocity correction
180  // Returns true if particle remains in same cell
181  virtual bool correct
182  (
183  typename CloudType::parcelType& p,
184  const polyPatch& pp,
185  bool& keepParticle
186  ) = 0;
187 
188  //- Add to escaped parcels
189  virtual void addToEscapedParcels(const scalar mass);
190 
191  //- Post-evolve hook
192  virtual void postEvolve();
193 
194  //- Write patch interaction info to stream
195  virtual void info(Ostream& os);
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #define makePatchInteractionModel(CloudType) \
206  \
207  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
208  defineNamedTemplateTypeNameAndDebug \
209  ( \
210  Foam::PatchInteractionModel<kinematicCloudType>, \
211  0 \
212  ); \
213  \
214  namespace Foam \
215  { \
216  defineTemplateRunTimeSelectionTable \
217  ( \
218  PatchInteractionModel<kinematicCloudType>, \
219  dictionary \
220  ); \
221  }
222 
223 
224 #define makePatchInteractionModelType(SS, CloudType) \
225  \
226  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
227  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
228  \
229  Foam::PatchInteractionModel<kinematicCloudType>:: \
230  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
231  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #ifdef NoRepository
237  #include "PatchInteractionModel.C"
238 #endif
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
243 
244 // ************************************************************************* //
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:65
Foam::PatchInteractionModel::escapedParcels_
label escapedParcels_
Number of parcels escaped.
Definition: PatchInteractionModel.H:96
Foam::PatchInteractionModel::addToEscapedParcels
virtual void addToEscapedParcels(const scalar mass)
Add to escaped parcels.
Definition: PatchInteractionModel.C:202
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:187
Foam::PatchInteractionModel::Urmax
const scalar & Urmax() const
Return Urmax.
Definition: PatchInteractionModel.C:194
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
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::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::PatchInteractionModel::postEvolve
virtual void postEvolve()
Post-evolve hook.
Definition: PatchInteractionModel.C:212
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
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:217
Foam::PatchInteractionModel::Urmax_
scalar Urmax_
Maximum relative U with patch for particle to be removed.
Definition: PatchInteractionModel.H:102
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