PairModel.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  Copyright (C) 2018-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::PairModel
29 
30 Description
31  Templated pair interaction class
32 
33 SourceFiles
34  PairModel.C
35  PairModelNew.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef PairModel_H
40 #define PairModel_H
41 
42 #include "IOdictionary.H"
43 #include "autoPtr.H"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class PairModel Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class CloudType>
56 class PairModel
57 {
58  // Private data
59 
60  //- The CollisionModel dictionary
61  const dictionary& dict_;
62 
63  //- Reference to the owner cloud class
64  CloudType& owner_;
65 
66  //- The coefficients dictionary
67  const dictionary coeffDict_;
68 
69  //- Time to bleed-in collision forces; default = 0 (no delay)
70  scalar forceRampTime_;
71 
72 
73 protected:
74 
75  // Protected Member Functions
76 
77  //- Return the force coefficient based on the forceRampTime_
78  scalar forceCoeff
79  (
80  typename CloudType::parcelType& pA,
81  typename CloudType::parcelType& pB
82  ) const;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("pairModel");
89 
90  //- Declare runtime constructor selection table
92  (
93  autoPtr,
94  PairModel,
95  dictionary,
96  (
97  const dictionary& dict,
99  ),
100  (dict, owner)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct null from cloud owner
108 
109  //- Construct from components
110  PairModel
111  (
112  const dictionary& dict,
113  CloudType& owner,
114  const word& type
115  );
116 
117 
118  //- Destructor
119  virtual ~PairModel();
120 
121 
122  //- Selector
123  static autoPtr<PairModel<CloudType>> New
124  (
125  const dictionary& dict,
127  );
128 
129 
130  // Access
131 
132  //- Return the owner cloud object
133  const CloudType& owner() const;
134 
135  //- Return the dictionary
136  const dictionary& dict() const;
137 
138  //- Return the coefficients dictionary
139  const dictionary& coeffDict() const;
140 
141 
142  // Member Functions
143 
144  //- Whether the PairModel has a timestep limit that will
145  // require subCycling
146  virtual bool controlsTimestep() const = 0;
147 
148  //- For PairModels that control the timestep, calculate the
149  // number of subCycles needed to satisfy the minimum
150  // allowable timestep
151  virtual label nSubCycles() const = 0;
152 
153  //- Calculate the pair interaction between parcels
154  virtual void evaluatePair
155  (
156  typename CloudType::parcelType& pA,
157  typename CloudType::parcelType& pB
158  ) const = 0;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #define makePairModel(CloudType) \
169  \
170  defineNamedTemplateTypeNameAndDebug(Foam::PairModel<Foam::CloudType>, 0); \
171  \
172  namespace Foam \
173  { \
174  defineTemplateRunTimeSelectionTable \
175  ( \
176  PairModel<Foam::CloudType>, \
177  dictionary \
178  ); \
179  }
180 
181 
182 #define makePairModelType(SS, CloudType) \
183  \
184  defineNamedTemplateTypeNameAndDebug(Foam::SS<Foam::CloudType>, 0); \
185  \
186  Foam::PairModel<Foam::CloudType>:: \
187  adddictionaryConstructorToTable<Foam::SS<Foam::CloudType>> \
188  add##SS##CloudType##ConstructorToTable_;
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #ifdef NoRepository
194  #include "PairModel.C"
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
DSMCCloud< dsmcParcel > CloudType
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:75
static autoPtr< PairModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PairModelNew.C:29
PairModel(CloudType &owner)
Construct null from cloud owner.
Definition: PairModel.C:28
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.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:68
TypeName("pairModel")
Runtime type information.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: PairModel.C:82
declareRunTimeSelectionTable(autoPtr, PairModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual ~PairModel()
Destructor.
Definition: PairModel.C:60
scalar forceCoeff(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Return the force coefficient based on the forceRampTime_.
Definition: PairModel.C:90
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.