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 | Copyright (C) 2011-2015 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::PatchInteractionModel
26 
27 Description
28  Templated patch interaction model class
29 
30 SourceFiles
31  PatchInteractionModel.C
32  PatchInteractionModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef PatchInteractionModel_H
37 #define PatchInteractionModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "polyPatch.H"
43 #include "wallPolyPatch.H"
44 #include "tetIndices.H"
45 #include "CloudSubModelBase.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class PatchInteractionModel Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class CloudType>
57 class PatchInteractionModel
58 :
59  public CloudSubModelBase<CloudType>
60 {
61 public:
62 
63  // Public enumerations
64 
65  // Interaction types
66  enum interactionType
67  {
71  itOther
72  };
73 
75 
76 
77 protected:
78 
79  // Private data
80 
81  //- Name of velocity field - default = "U"
82  const word UName_;
83 
84 
85  // Counters
86 
87  //- Number of parcels escaped
89 
90  //- Mass of parcels escaped
91  scalar escapedMass_;
92 
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("patchInteractionModel");
99 
100  //- Declare runtime constructor selection table
102  (
103  autoPtr,
105  dictionary,
106  (
107  const dictionary& dict,
108  CloudType& owner
109  ),
110  (dict, owner)
111  );
112 
113 
114  // Constructors
115 
116  //- Construct null from owner
118 
119  //- Construct from components
121  (
122  const dictionary& dict,
123  CloudType& owner,
124  const word& type
125  );
126 
127  //- Construct copy
129 
130  //- Construct and return a clone
131  virtual autoPtr<PatchInteractionModel<CloudType> > clone() const = 0;
132 
133 
134  //- Destructor
135  virtual ~PatchInteractionModel();
136 
137 
138  //- Selector
140  (
141  const dictionary& dict,
142  CloudType& owner
143  );
144 
145 
146  // Access
147 
148  //- Return name of velocity field
149  const word& UName() const;
150 
151 
152  // Member Functions
153 
154  //- Convert interaction result to word
155  static word interactionTypeToWord(const interactionType& itEnum);
156 
157  //- Convert word to interaction result
158  static interactionType wordToInteractionType(const word& itWord);
159 
160  //- Apply velocity correction
161  // Returns true if particle remains in same cell
162  virtual bool correct
163  (
164  typename CloudType::parcelType& p,
165  const polyPatch& pp,
166  bool& keepParticle,
167  const scalar trackFraction,
168  const tetIndices& tetIs
169  ) = 0;
170 
171  //- Add to escaped parcels
172  void addToEscapedParcels(const scalar mass);
173 
174 
175  // I-O
176 
177  //- Write patch interaction info to stream
178  virtual void info(Ostream& os);
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #define makePatchInteractionModel(CloudType) \
189  \
190  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
191  defineNamedTemplateTypeNameAndDebug \
192  ( \
193  Foam::PatchInteractionModel<kinematicCloudType>, \
194  0 \
195  ); \
196  \
197  namespace Foam \
198  { \
199  defineTemplateRunTimeSelectionTable \
200  ( \
201  PatchInteractionModel<kinematicCloudType>, \
202  dictionary \
203  ); \
204  }
205 
206 
207 #define makePatchInteractionModelType(SS, CloudType) \
208  \
209  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
210  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
211  \
212  Foam::PatchInteractionModel<kinematicCloudType>:: \
213  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType> > \
214  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #ifdef NoRepository
220 # include "PatchInteractionModel.C"
221 #endif
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
Foam::PatchInteractionModel::itOther
@ itOther
Definition: PatchInteractionModel.H:70
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PatchInteractionModel::correct
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle, const scalar trackFraction, const tetIndices &tetIs)=0
Apply velocity correction.
Foam::PatchInteractionModel::escapedParcels_
label escapedParcels_
Number of parcels escaped.
Definition: PatchInteractionModel.H:87
Foam::PatchInteractionModel::addToEscapedParcels
void addToEscapedParcels(const scalar mass)
Add to escaped parcels.
Definition: PatchInteractionModel.C:163
polyPatch.H
Foam::PatchInteractionModel::~PatchInteractionModel
virtual ~PatchInteractionModel()
Destructor.
Definition: PatchInteractionModel.C:148
wallPolyPatch.H
Foam::PatchInteractionModel::interactionTypeNames_
static wordList interactionTypeNames_
Definition: PatchInteractionModel.H:73
Foam::PatchInteractionModel::UName_
const word UName_
Name of velocity field - default = "U".
Definition: PatchInteractionModel.H:81
Foam::PatchInteractionModel::TypeName
TypeName("patchInteractionModel")
Runtime type information.
Foam::PatchInteractionModel::UName
const word & UName() const
Return name of velocity field.
Definition: PatchInteractionModel.C:155
Foam::PatchInteractionModel::New
static autoPtr< PatchInteractionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PatchInteractionModelNew.C:33
Foam::PatchInteractionModel
Templated patch interaction model class.
Definition: KinematicCloud.H:82
Foam::PatchInteractionModel::clone
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const =0
Construct and return a clone.
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:59
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:68
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PatchInteractionModel::itEscape
@ itEscape
Definition: PatchInteractionModel.H:69
Foam::PatchInteractionModel::itStick
@ itStick
Definition: PatchInteractionModel.H:68
Foam::PatchInteractionModel::PatchInteractionModel
PatchInteractionModel(CloudType &owner)
Construct null from owner.
Definition: PatchInteractionModel.C:108
IOdictionary.H
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
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
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PatchInteractionModel::wordToInteractionType
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
Definition: PatchInteractionModel.C:81
Foam::PatchInteractionModel::info
virtual void info(Ostream &os)
Write patch interaction info to stream.
Definition: PatchInteractionModel.C:173
Foam::PatchInteractionModel::itRebound
@ itRebound
Definition: PatchInteractionModel.H:67
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::PatchInteractionModel::escapedMass_
scalar escapedMass_
Mass of parcels escaped.
Definition: PatchInteractionModel.H:90
Foam::PatchInteractionModel< Foam::DSMCCloud >::interactionType
interactionType
Definition: PatchInteractionModel.H:65
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::PatchInteractionModel::interactionTypeToWord
static word interactionTypeToWord(const interactionType &itEnum)
Convert interaction result to word.
Definition: PatchInteractionModel.C:46
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
tetIndices.H
PatchInteractionModel.C
autoPtr.H