FreeFOAM The Cross-Platform CFD Toolkit
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) 2008-2010 OpenCFD Ltd.
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  NewPatchInteractionModel.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef PatchInteractionModel_H
37 #define PatchInteractionModel_H
38 
39 #include <OpenFOAM/IOdictionary.H>
40 #include <OpenFOAM/autoPtr.H>
42 #include <OpenFOAM/polyPatch.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class PatchInteractionModel Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class CloudType>
55 {
56 public:
57 
58  // Public enumerations
59 
60  // Interaction types
62  {
67  };
68 
70 
71 
72 private:
73 
74  // Private data
75 
76  //- The cloud dictionary
77  const dictionary& dict_;
78 
79  //- Reference to the owner cloud class
80  CloudType& owner_;
81 
82  //- The coefficients dictionary
83  const dictionary coeffDict_;
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,
99  CloudType& owner
100  ),
101  (dict, owner)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const dictionary& dict,
111  CloudType& owner,
112  const word& type
113  );
114 
115 
116  //- Destructor
117  virtual ~PatchInteractionModel();
118 
119 
120  //- Selector
122  (
123  const dictionary& dict,
124  CloudType& owner
125  );
126 
127 
128  // Access
129 
130  //- Return the owner cloud object
131  const CloudType& owner() const;
132 
133  //- Return the dictionary
134  const dictionary& dict() const;
135 
136  //- Return the coefficients dictionary
137  const dictionary& coeffDict() const;
138 
139 
140  // Member Functions
141 
142  //- Convert interaction result to word
143  static word interactionTypeToWord(const interactionType& itEnum);
144 
145  //- Convert word to interaction result
146  static interactionType wordToInteractionType(const word& itWord);
147 
148  //- Flag to indicate whether model activates patch interaction model
149  virtual bool active() const = 0;
150 
151  //- Apply velocity correction
152  // Returns true if particle remains in same cell
153  virtual bool correct
154  (
155  const polyPatch& pp,
156  const label faceId,
157  bool& keepParticle,
158  bool& active,
159  vector& U
160  ) const = 0;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #define makePatchInteractionModel(CloudType) \
171  \
172  defineNamedTemplateTypeNameAndDebug(PatchInteractionModel<CloudType>, 0); \
173  \
174  defineTemplateRunTimeSelectionTable \
175  ( \
176  PatchInteractionModel<CloudType>, \
177  dictionary \
178  );
179 
180 
181 #define makePatchInteractionModelType(SS, CloudType, ParcelType) \
182  \
183  defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
184  \
185  PatchInteractionModel<CloudType<ParcelType> >:: \
186  adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
187  add##SS##CloudType##ParcelType##ConstructorToTable_;
188 
189 
190 #define makePatchInteractionModelThermoType(SS, CloudType, ParcelType, ThermoType)\
191  \
192  defineNamedTemplateTypeNameAndDebug \
193  ( \
194  SS<CloudType<ParcelType<ThermoType> > >, \
195  0 \
196  ); \
197  \
198  PatchInteractionModel<CloudType<ParcelType<ThermoType> > >:: \
199  adddictionaryConstructorToTable \
200  <SS<CloudType<ParcelType<ThermoType> > > > \
201  add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
207 # include "PatchInteractionModel.C"
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************ vim: set sw=4 sts=4 et: ************************ //