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-2022 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>
55 :
56  public CloudSubModelBase<CloudType>
57 {
58 protected:
59 
60  //- Main collision routine
61  virtual void collide(typename CloudType::parcelType::trackingData& td) = 0;
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
87 
88  //- Construct from dictionary
90  (
91  const dictionary& dict,
93  const word& type
94  );
95 
96  //- Construct copy
98 
99  //- Construct and return a clone
101 
102 
103  //- Destructor
104  virtual ~StochasticCollisionModel();
105 
106 
107  //- Selector
109  (
110  const dictionary& dict,
112  );
113 
114 
115  // Member Functions
116 
117  //- Update the model
118  void update(typename CloudType::parcelType::trackingData& td);
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #define makeStochasticCollisionModel(CloudType) \
129  \
130  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
131  defineNamedTemplateTypeNameAndDebug \
132  ( \
133  Foam::StochasticCollisionModel<momentumCloudType>, \
134  0 \
135  ); \
136  namespace Foam \
137  { \
138  defineTemplateRunTimeSelectionTable \
139  ( \
140  StochasticCollisionModel<momentumCloudType>, \
141  dictionary \
142  ); \
143  }
144 
145 
146 #define makeStochasticCollisionModelType(SS, CloudType) \
147  \
148  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
149  defineNamedTemplateTypeNameAndDebug(Foam::SS<momentumCloudType>, 0); \
150  \
151  Foam::StochasticCollisionModel<momentumCloudType>:: \
152  adddictionaryConstructorToTable<Foam::SS<momentumCloudType>> \
153  add##SS##CloudType##momentumCloudType##ConstructorToTable_;
154 
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "StochasticCollisionModel.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
Templated stochastic collision model class.
StochasticCollisionModel(CloudType &owner)
Construct null from owner.
void update(typename CloudType::parcelType::trackingData &td)
Update the model.
declareRunTimeSelectionTable(autoPtr, StochasticCollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual ~StochasticCollisionModel()
Destructor.
virtual autoPtr< StochasticCollisionModel< CloudType > > clone() const =0
Construct and return a clone.
static autoPtr< StochasticCollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
TypeName("collisionModel")
Runtime type information.
virtual void collide(typename CloudType::parcelType::trackingData &td)=0
Main collision routine.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Macros to ease declaration of run-time selection tables.