StochasticCollisionModel.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::StochasticCollisionModel
26 
27 Description
28  Templated stochastic collision model class
29 
30 SourceFiles
31  StochasticCollisionModel.C
32  StochasticCollisionModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef StochasticCollisionModel_H
37 #define StochasticCollisionModel_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 StochasticCollisionModel Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class CloudType>
54 class StochasticCollisionModel
55 :
56  public CloudSubModelBase<CloudType>
57 {
58 protected:
59 
60  //- Main collision routine
61  virtual void collide
62  (
63  typename CloudType::parcelType::trackingData& td,
64  const scalar dt
65  ) = 0;
66 
67 
68 public:
69 
70  //- Runtime type information
71  TypeName("collisionModel");
72 
73  //- Declare runtime constructor selection table
75  (
76  autoPtr,
78  dictionary,
79  (
80  const dictionary& dict,
82  ),
83  (dict, owner)
84  );
85 
86 
87  // Constructors
88 
89  //- Construct null from owner
91 
92  //- Construct from dictionary
94  (
95  const dictionary& dict,
96  CloudType& owner,
97  const word& type
98  );
99 
100  //- Construct copy
101  StochasticCollisionModel(const StochasticCollisionModel<CloudType>& cm);
102 
103  //- Construct and return a clone
104  virtual autoPtr<StochasticCollisionModel<CloudType>> clone() const = 0;
105 
106 
107  //- Destructor
108  virtual ~StochasticCollisionModel();
109 
110 
111  //- Selector
112  static autoPtr<StochasticCollisionModel<CloudType>> New
113  (
114  const dictionary& dict,
115  CloudType& owner
116  );
117 
118 
119  // Member Functions
120 
121  //- Update the model
122  void update
123  (
124  typename CloudType::parcelType::trackingData& td,
125  const scalar dt
126  );
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 #define makeStochasticCollisionModel(CloudType) \
137  \
138  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
139  defineNamedTemplateTypeNameAndDebug \
140  ( \
141  Foam::StochasticCollisionModel<kinematicCloudType>, \
142  0 \
143  ); \
144  namespace Foam \
145  { \
146  defineTemplateRunTimeSelectionTable \
147  ( \
148  StochasticCollisionModel<kinematicCloudType>, \
149  dictionary \
150  ); \
151  }
152 
154 #define makeStochasticCollisionModelType(SS, CloudType) \
155  \
156  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
157  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
158  \
159  Foam::StochasticCollisionModel<kinematicCloudType>:: \
160  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
161  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
162 
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168  #include "StochasticCollisionModel.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
StochasticCollisionModel(CloudType &owner)
Construct null from owner.
DSMCCloud< dsmcParcel > CloudType
virtual autoPtr< StochasticCollisionModel< CloudType > > clone() const =0
Construct and return a clone.
virtual void collide(typename CloudType::parcelType::trackingData &td, const scalar dt)=0
Main collision routine.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
declareRunTimeSelectionTable(autoPtr, StochasticCollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
const CloudType & owner() const
Return const access to the owner cloud.
virtual ~StochasticCollisionModel()
Destructor.
TypeName("collisionModel")
Runtime type information.
static autoPtr< StochasticCollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
void update(typename CloudType::parcelType::trackingData &td, const scalar dt)
Update the model.
Macros to ease declaration of run-time selection tables.
Namespace for OpenFOAM.