BinaryCollisionModel.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-2020 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::BinaryCollisionModel
26 
27 Description
28  Templated DSMC particle collision class
29 
30 SourceFiles
31  BinaryCollisionModel.C
32  BinaryCollisionModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef BinaryCollisionModel_H
37 #define BinaryCollisionModel_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class BinaryCollisionModel Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class CloudType>
54 {
55  // Private Data
56 
57  //- The cloud dictionary
58  const dictionary& dict_;
59 
60  // reference to the owner cloud class
61  CloudType& owner_;
62 
63  //- The coefficients dictionary
64  const dictionary coeffDict_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("BinaryCollisionModel");
71 
72  //- Declare runtime constructor selection table
74  (
75  autoPtr,
77  dictionary,
78  (
79  const dictionary& dict,
81  ),
82  (dict, owner)
83  );
84 
85 
86  // Constructors
87 
88  //- Construct null from owner
90 
91  //- Construct from components
93  (
94  const dictionary& dict,
96  const word& type
97  );
98 
99 
100  //- Destructor
101  virtual ~BinaryCollisionModel();
102 
103 
104  //- Selector
106  (
107  const dictionary& dict,
109  );
110 
111 
112  // Access
113 
114  //- Return the owner cloud object
115  const CloudType& owner() const;
116 
117  //- Return non-const access to the owner cloud object
118  CloudType& owner();
119 
120  //- Return the dictionary
121  const dictionary& dict() const;
122 
123  //- Return the coefficients dictionary
124  const dictionary& coeffDict() const;
125 
126 
127  // Member Functions
128 
129  //- Return the collision cross section * relative velocity product
130  virtual scalar sigmaTcR
131  (
132  const typename CloudType::parcelType& pP,
133  const typename CloudType::parcelType& pQ
134  ) const = 0;
135 
136  //- Apply collision
137  virtual void collide
138  (
139  typename CloudType::parcelType& pP,
140  typename CloudType::parcelType& pQ
141  ) = 0;
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #define makeBinaryCollisionModel(CloudType) \
152  \
153  defineNamedTemplateTypeNameAndDebug \
154  ( \
155  BinaryCollisionModel<CloudType>, \
156  0 \
157  ); \
158  \
159  defineTemplateRunTimeSelectionTable \
160  ( \
161  BinaryCollisionModel<CloudType>, \
162  dictionary \
163  );
164 
165 
166 #define makeBinaryCollisionModelType(SS, CloudType) \
167  \
168  defineNamedTemplateTypeNameAndDebug(SS<CloudType>, 0); \
169  \
170  BinaryCollisionModel<CloudType>:: \
171  adddictionaryConstructorToTable<SS<CloudType>> \
172  add##SS##CloudType##ConstructorToTable_;
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #ifdef NoRepository
178  #include "BinaryCollisionModel.C"
179 #endif
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
Templated DSMC particle collision class.
TypeName("BinaryCollisionModel")
Runtime type information.
virtual scalar sigmaTcR(const typename CloudType::parcelType &pP, const typename CloudType::parcelType &pQ) const =0
Return the collision cross section * relative velocity product.
static autoPtr< BinaryCollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
const dictionary & coeffDict() const
Return the coefficients dictionary.
virtual ~BinaryCollisionModel()
Destructor.
const dictionary & dict() const
Return the dictionary.
const CloudType & owner() const
Return the owner cloud object.
declareRunTimeSelectionTable(autoPtr, BinaryCollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
BinaryCollisionModel(CloudType &owner)
Construct null from owner.
virtual void collide(typename CloudType::parcelType &pP, typename CloudType::parcelType &pQ)=0
Apply collision.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
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
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.