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-2016 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 private:
78 
79  // Private data
80 
81  //- Name of velocity field - default = "U"
82  const word UName_;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("patchInteractionModel");
89 
90  //- Declare runtime constructor selection table
92  (
93  autoPtr,
95  dictionary,
96  (
97  const dictionary& dict,
99  ),
100  (dict, owner)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct null from owner
108 
109  //- Construct from components
111  (
112  const dictionary& dict,
113  CloudType& owner,
114  const word& type
115  );
116 
117  //- Construct copy
119 
120  //- Construct and return a clone
121  virtual autoPtr<PatchInteractionModel<CloudType>> clone() const = 0;
122 
123 
124  //- Destructor
125  virtual ~PatchInteractionModel();
126 
127 
128  //- Selector
130  (
131  const dictionary& dict,
132  CloudType& owner
133  );
134 
135 
136  // Access
137 
138  //- Return name of velocity field
139  const word& UName() const;
140 
141 
142  // Member Functions
143 
144  //- Convert interaction result to word
145  static word interactionTypeToWord(const interactionType& itEnum);
146 
147  //- Convert word to interaction result
148  static interactionType wordToInteractionType(const word& itWord);
149 
150  //- Apply velocity correction
151  // Returns true if particle remains in same cell
152  virtual bool correct
153  (
154  typename CloudType::parcelType& p,
155  const polyPatch& pp,
156  bool& keepParticle,
157  const scalar trackFraction,
158  const tetIndices& tetIs
159  ) = 0;
160 
161 
162  // I-O
163 
164  //- Write patch interaction info to stream
165  virtual void info(Ostream& os);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 #define makePatchInteractionModel(CloudType) \
176  \
177  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
178  defineNamedTemplateTypeNameAndDebug \
179  ( \
180  Foam::PatchInteractionModel<kinematicCloudType>, \
181  0 \
182  ); \
183  \
184  namespace Foam \
185  { \
186  defineTemplateRunTimeSelectionTable \
187  ( \
188  PatchInteractionModel<kinematicCloudType>, \
189  dictionary \
190  ); \
191  }
192 
194 #define makePatchInteractionModelType(SS, CloudType) \
195  \
196  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
197  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
198  \
199  Foam::PatchInteractionModel<kinematicCloudType>:: \
200  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
201  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
207  #include "PatchInteractionModel.C"
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
PatchInteractionModel(CloudType &owner)
Construct null from owner.
const word & UName() const
Return name of velocity field.
static word interactionTypeToWord(const interactionType &itEnum)
Convert interaction result to word.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual ~PatchInteractionModel()
Destructor.
Templated patch interaction model class.
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const =0
Construct and return a clone.
declareRunTimeSelectionTable(autoPtr, PatchInteractionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
A class for handling words, derived from string.
Definition: word.H:59
static autoPtr< PatchInteractionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("patchInteractionModel")
Runtime type information.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
virtual void info(Ostream &os)
Write patch interaction info to stream.
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle, const scalar trackFraction, const tetIndices &tetIs)=0
Apply velocity correction.
const CloudType & owner() const
Return const access to the owner cloud.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Macros to ease declaration of run-time selection tables.
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
Namespace for OpenFOAM.