StochasticCollisionModel.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::StochasticCollisionModel
28 
29 Group
30  grpLagrangianIntermediateCollisionSubModels
31 
32 Description
33  Templated stochastic collision model class
34 
35 SourceFiles
36  StochasticCollisionModel.C
37  StochasticCollisionModelNew.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef StochasticCollisionModel_H
42 #define StochasticCollisionModel_H
43 
44 #include "IOdictionary.H"
45 #include "autoPtr.H"
46 #include "runTimeSelectionTables.H"
47 #include "CloudSubModelBase.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class StochasticCollisionModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class CloudType>
59 class StochasticCollisionModel
60 :
61  public CloudSubModelBase<CloudType>
62 {
63 protected:
64 
65  //- Main collision routine
66  virtual void collide
67  (
68  typename CloudType::parcelType::trackingData& td,
69  const scalar dt
70  ) = 0;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("collisionModel");
77 
78  //- Declare runtime constructor selection table
80  (
81  autoPtr,
83  dictionary,
84  (
85  const dictionary& dict,
86  CloudType& owner
87  ),
88  (dict, owner)
89  );
90 
91 
92  // Constructors
93 
94  //- Construct null from owner
96 
97  //- Construct from dictionary
99  (
100  const dictionary& dict,
101  CloudType& owner,
102  const word& type
103  );
104 
105  //- Construct copy
106  StochasticCollisionModel(const StochasticCollisionModel<CloudType>& cm);
107 
108  //- Construct and return a clone
109  virtual autoPtr<StochasticCollisionModel<CloudType>> clone() const = 0;
110 
111 
112  //- Destructor
113  virtual ~StochasticCollisionModel();
114 
115 
116  //- Selector
117  static autoPtr<StochasticCollisionModel<CloudType>> New
118  (
119  const dictionary& dict,
120  CloudType& owner
121  );
122 
123 
124  // Member Functions
125 
126  //- Update the model
127  void update
128  (
129  typename CloudType::parcelType::trackingData& td,
130  const scalar dt
131  );
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #define makeStochasticCollisionModel(CloudType) \
142  \
143  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
144  defineNamedTemplateTypeNameAndDebug \
145  ( \
146  Foam::StochasticCollisionModel<kinematicCloudType>, \
147  0 \
148  ); \
149  namespace Foam \
150  { \
151  defineTemplateRunTimeSelectionTable \
152  ( \
153  StochasticCollisionModel<kinematicCloudType>, \
154  dictionary \
155  ); \
156  }
157 
158 
159 #define makeStochasticCollisionModelType(SS, CloudType) \
160  \
161  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
162  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
163  \
164  Foam::StochasticCollisionModel<kinematicCloudType>:: \
165  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
166  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
167 
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173  #include "StochasticCollisionModel.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::StochasticCollisionModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, StochasticCollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
Foam::StochasticCollisionModel::clone
virtual autoPtr< StochasticCollisionModel< CloudType > > clone() const =0
Construct and return a clone.
Foam::StochasticCollisionModel::~StochasticCollisionModel
virtual ~StochasticCollisionModel()
Destructor.
Definition: StochasticCollisionModel.C:67
Foam::StochasticCollisionModel::StochasticCollisionModel
StochasticCollisionModel(CloudType &owner)
Construct null from owner.
Definition: StochasticCollisionModel.C:34
Foam::StochasticCollisionModel::collide
virtual void collide(typename CloudType::parcelType::trackingData &td, const scalar dt)=0
Main collision routine.
CloudSubModelBase.H
Foam::CloudType
DSMCCloud< dsmcParcel > CloudType
Definition: makeDSMCParcelBinaryCollisionModels.C:38
dict
dictionary dict
Definition: searchingEngine.H:14
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
IOdictionary.H
StochasticCollisionModel.C
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::StochasticCollisionModel::New
static autoPtr< StochasticCollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: StochasticCollisionModelNew.C:36
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::StochasticCollisionModel::update
void update(typename CloudType::parcelType::trackingData &td, const scalar dt)
Update the model.
Definition: StochasticCollisionModel.C:75
Foam::StochasticCollisionModel::TypeName
TypeName("collisionModel")
Runtime type information.
autoPtr.H