All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2019 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,
92  CloudType& owner,
93  const word& type
94  );
95 
96 
97  //- Destructor
98  virtual ~PairModel();
99 
100 
101  //- Selector
102  static autoPtr<PairModel<CloudType>> New
103  (
104  const dictionary& dict,
105  CloudType& owner
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 #define makePairModel(CloudType) \
148  \
149  defineNamedTemplateTypeNameAndDebug(Foam::PairModel<Foam::CloudType>, 0); \
150  \
151  namespace Foam \
152  { \
153  defineTemplateRunTimeSelectionTable \
154  ( \
155  PairModel<Foam::CloudType>, \
156  dictionary \
157  ); \
158  }
159 
161 #define makePairModelType(SS, CloudType) \
162  \
163  defineNamedTemplateTypeNameAndDebug(Foam::SS<Foam::CloudType>, 0); \
164  \
165  Foam::PairModel<Foam::CloudType>:: \
166  adddictionaryConstructorToTable<Foam::SS<Foam::CloudType>> \
167  add##SS##CloudType##ConstructorToTable_;
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173  #include "PairModel.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
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
DSMCCloud< dsmcParcel > CloudType
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:62
static autoPtr< PairModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PairModelNew.C:33
virtual void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const =0
Calculate the pair interaction between parcels.
virtual bool controlsTimestep() const =0
Whether the PairModel has a timestep limit that will.
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:55
TypeName("pairModel")
Runtime type information.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: PairModel.C:70
declareRunTimeSelectionTable(autoPtr, PairModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual ~PairModel()
Destructor.
Definition: PairModel.C:47
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
PairModel(const dictionary &dict, CloudType &owner, const word &type)
Construct from components.
Definition: PairModel.C:32
Macros to ease declaration of run-time selection tables.
virtual label nSubCycles() const =0
For PairModels that control the timestep, calculate the.
Namespace for OpenFOAM.