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