CollisionModel.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::CollisionModel
26 
27 Description
28  Templated collision model class.
29 
30 SourceFiles
31  CollisionModel.C
32  CollisionModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef CollisionModel_H
37 #define CollisionModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "CloudSubModelBase.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class CollisionModel Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class CloudType>
54 class CollisionModel
55 :
56  public CloudSubModelBase<CloudType>
57 {
58  // Protected data
59 
60  //- Convenience typedef for parcel type
61  typedef typename CloudType::parcelType parcelType;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("collisionModel");
68 
69  //- Declare runtime constructor selection table
71  (
72  autoPtr,
74  dictionary,
75  (
76  const dictionary& dict,
78  ),
79  (dict, owner)
80  );
81 
82 
83  // Constructors
84 
85  //- Construct null from owner
86  CollisionModel(CloudType& owner);
87 
88  //- Construct from components
90  (
91  const dictionary& dict,
92  CloudType& owner,
93  const word& type
94  );
95 
96  //- Construct copy
97  CollisionModel(const CollisionModel<CloudType>& cm);
98 
99  //- Construct and return a clone
100  virtual autoPtr<CollisionModel<CloudType>> clone() const = 0;
101 
102 
103  //- Destructor
104  virtual ~CollisionModel();
105 
106 
107  //- Selector
108  static autoPtr<CollisionModel<CloudType>> New
109  (
110  const dictionary& dict,
111  CloudType& owner
112  );
113 
114 
115  // Member Functions
116 
117  //- Return the number of times to subcycle the current
118  // timestep to meet the criteria of the collision model
119  virtual label nSubCycles() const = 0;
120 
121  //- Indicates whether model determines wall collisions or not,
122  // used to determine what value to use for wallImpactDistance
123  virtual bool controlsWallInteraction() const = 0;
124 
125  // Collision function
126  virtual void collide() = 0;
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 #define makeCollisionModel(CloudType) \
137  \
138  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
139  defineNamedTemplateTypeNameAndDebug \
140  ( \
141  Foam::CollisionModel<collidingCloudType>, \
142  0 \
143  ); \
144  namespace Foam \
145  { \
146  defineTemplateRunTimeSelectionTable \
147  ( \
148  CollisionModel<collidingCloudType>, \
149  dictionary \
150  ); \
151  }
152 
154 #define makeCollisionModelType(SS, CloudType) \
155  \
156  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
157  defineNamedTemplateTypeNameAndDebug(Foam::SS<collidingCloudType>, 0); \
158  \
159  Foam::CollisionModel<collidingCloudType>:: \
160  adddictionaryConstructorToTable<Foam::SS<collidingCloudType>> \
161  add##SS##CloudType##collidingCloudType##ConstructorToTable_;
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #ifdef NoRepository
167  #include "CollisionModel.C"
168 #endif
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
virtual ~CollisionModel()
Destructor.
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
DSMCCloud< dsmcParcel > CloudType
virtual autoPtr< CollisionModel< CloudType > > clone() const =0
Construct and return a clone.
TypeName("collisionModel")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, CollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
static autoPtr< CollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:485
virtual bool controlsWallInteraction() const =0
Indicates whether model determines wall collisions or not,.
virtual label nSubCycles() const =0
Return the number of times to subcycle the current.
virtual void collide()=0
Macros to ease declaration of run-time selection tables.
CollisionModel(CloudType &owner)
Construct null from owner.
Namespace for OpenFOAM.