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 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 from components
107  PairModel
108  (
109  const dictionary& dict,
110  CloudType& owner,
111  const word& type
112  );
113 
114 
115  //- Destructor
116  virtual ~PairModel();
117 
118 
119  //- Selector
120  static autoPtr<PairModel<CloudType>> New
121  (
122  const dictionary& dict,
124  );
125 
126 
127  // Access
128 
129  //- Return the owner cloud object
130  const CloudType& owner() const;
131 
132  //- Return the dictionary
133  const dictionary& dict() const;
134 
135  //- Return the coefficients dictionary
136  const dictionary& coeffDict() const;
137 
138 
139  // Member Functions
140 
141  //- Whether the PairModel has a timestep limit that will
142  // require subCycling
143  virtual bool controlsTimestep() const = 0;
144 
145  //- For PairModels that control the timestep, calculate the
146  // number of subCycles needed to satisfy the minimum
147  // allowable timestep
148  virtual label nSubCycles() const = 0;
149 
150  //- Calculate the pair interaction between parcels
151  virtual void evaluatePair
152  (
153  typename CloudType::parcelType& pA,
154  typename CloudType::parcelType& pB
155  ) const = 0;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #define makePairModel(CloudType) \
166  \
167  defineNamedTemplateTypeNameAndDebug(Foam::PairModel<Foam::CloudType>, 0); \
168  \
169  namespace Foam \
170  { \
171  defineTemplateRunTimeSelectionTable \
172  ( \
173  PairModel<Foam::CloudType>, \
174  dictionary \
175  ); \
176  }
177 
178 
179 #define makePairModelType(SS, CloudType) \
180  \
181  defineNamedTemplateTypeNameAndDebug(Foam::SS<Foam::CloudType>, 0); \
182  \
183  Foam::PairModel<Foam::CloudType>:: \
184  adddictionaryConstructorToTable<Foam::SS<Foam::CloudType>> \
185  add##SS##CloudType##ConstructorToTable_;
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #ifdef NoRepository
191  #include "PairModel.C"
192 #endif
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
Foam::PairModel::~PairModel
virtual ~PairModel()
Destructor.
Definition: PairModel.C:54
Foam::PairModel::PairModel
PairModel(const dictionary &dict, CloudType &owner, const word &type)
Construct from components.
Definition: PairModel.C:35
Foam::PairModel::evaluatePair
virtual void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const =0
Calculate the pair interaction between parcels.
Foam::PairModel::nSubCycles
virtual label nSubCycles() const =0
For PairModels that control the timestep, calculate the.
Foam::PairModel::New
static autoPtr< PairModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PairModelNew.C:36
Foam::PairModel::owner
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:62
Foam::PairModel::dict
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:69
Foam::CloudType
DSMCCloud< dsmcParcel > CloudType
Definition: makeDSMCParcelBinaryCollisionModels.C:38
PairModel.C
Foam::PairModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, PairModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
Foam::PairModel::coeffDict
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: PairModel.C:76
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PairModel::controlsTimestep
virtual bool controlsTimestep() const =0
Whether the PairModel has a timestep limit that will.
IOdictionary.H
Foam::PairModel::TypeName
TypeName("pairModel")
Runtime type information.
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::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::PairModel::forceCoeff
scalar forceCoeff(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Return the force coefficient based on the forceRampTime_.
Definition: PairModel.C:84
autoPtr.H