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