PatchInteractionModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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  ) = 0;
159 
160 
161  // I-O
162 
163  //- Write patch interaction info to stream
164  virtual void info(Ostream& os);
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 #define makePatchInteractionModel(CloudType) \
175  \
176  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
177  defineNamedTemplateTypeNameAndDebug \
178  ( \
179  Foam::PatchInteractionModel<kinematicCloudType>, \
180  0 \
181  ); \
182  \
183  namespace Foam \
184  { \
185  defineTemplateRunTimeSelectionTable \
186  ( \
187  PatchInteractionModel<kinematicCloudType>, \
188  dictionary \
189  ); \
190  }
191 
193 #define makePatchInteractionModelType(SS, CloudType) \
194  \
195  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
196  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
197  \
198  Foam::PatchInteractionModel<kinematicCloudType>:: \
199  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
200  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #ifdef NoRepository
206  #include "PatchInteractionModel.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
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.
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:481
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)=0
Apply velocity correction.
virtual void info(Ostream &os)
Write patch interaction info to stream.
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.