PairModel.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::PairModel
26 
27 Description
28  Templated pair interaction class
29 
30 SourceFiles
31  PairModel.C
32  PairModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef PairModel_H
37 #define PairModel_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 PairModel Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class CloudType>
53 class PairModel
54 {
55  // Private Data
56 
57  //- The CollisionModel 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("pairModel");
71 
72  //- Declare runtime constructor selection table
74  (
75  autoPtr,
76  PairModel,
77  dictionary,
78  (
79  const dictionary& dict,
81  ),
82  (dict, owner)
83  );
84 
85 
86  // Constructors
87 
88  //- Construct from components
89  PairModel
90  (
91  const dictionary& dict,
93  const word& type
94  );
95 
96 
97  //- Destructor
98  virtual ~PairModel();
99 
100 
101  //- Selector
103  (
104  const dictionary& dict,
106  );
107 
108 
109  // Access
110 
111  //- Return the owner cloud object
112  const CloudType& owner() const;
113 
114  //- Return the dictionary
115  const dictionary& dict() const;
116 
117  //- Return the coefficients dictionary
118  const dictionary& coeffDict() const;
119 
120 
121  // Member Functions
122 
123  //- Whether the PairModel has a timestep limit that will
124  // require subCycling
125  virtual bool controlsTimestep() const = 0;
126 
127  //- For PairModels that control the timestep, calculate the
128  // number of subCycles needed to satisfy the minimum
129  // allowable timestep
130  virtual label nSubCycles() const = 0;
131 
132  //- Calculate the pair interaction between parcels
133  virtual void evaluatePair
134  (
135  typename CloudType::parcelType& pA,
136  typename CloudType::parcelType& pB
137  ) const = 0;
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #define makePairModel(CloudType) \
148  \
149  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
150  \
151  defineNamedTemplateTypeNameAndDebug \
152  ( \
153  Foam::PairModel<collidingCloudType>, \
154  0 \
155  ); \
156  \
157  namespace Foam \
158  { \
159  defineTemplateRunTimeSelectionTable \
160  ( \
161  PairModel<collidingCloudType>, \
162  dictionary \
163  ); \
164  }
165 
166 
167 #define makePairModelType(SS, CloudType) \
168  \
169  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
170  \
171  defineNamedTemplateTypeNameAndDebug(Foam::SS<collidingCloudType>, 0); \
172  \
173  Foam::PairModel<collidingCloudType>:: \
174  adddictionaryConstructorToTable<Foam::SS<collidingCloudType>> \
175  add##SS##CloudType##ConstructorToTable_;
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #ifdef NoRepository
181  #include "PairModel.C"
182 #endif
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
Templated pair interaction class.
Definition: PairModel.H:53
virtual ~PairModel()
Destructor.
Definition: PairModel.C:47
PairModel(const dictionary &dict, CloudType &owner, const word &type)
Construct from components.
Definition: PairModel.C:32
TypeName("pairModel")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, PairModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual label nSubCycles() const =0
For PairModels that control the timestep, calculate the.
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: PairModel.C:70
static autoPtr< PairModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PairModelNew.C:33
virtual bool controlsTimestep() const =0
Whether the PairModel has a timestep limit that will.
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:62
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:55
virtual void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const =0
Calculate the pair interaction between parcels.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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.