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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::PairModel
29
30Description
31 Templated pair interaction class
32
33SourceFiles
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"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class PairModel Declaration
53\*---------------------------------------------------------------------------*/
54
55template<class CloudType>
56class 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
73protected:
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
85public:
86
87 //- Runtime type information
88 TypeName("pairModel");
89
90 //- Declare runtime constructor selection table
92 (
93 autoPtr,
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
111 (
112 const dictionary& dict,
114 const word& type
115 );
116
117
118 //- Destructor
119 virtual ~PairModel();
120
121
122 //- Selector
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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
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// ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Templated pair interaction class.
Definition: PairModel.H:56
virtual ~PairModel()
Destructor.
Definition: PairModel.C:67
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:89
static autoPtr< PairModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PairModelNew.C:36
virtual bool controlsTimestep() const =0
Whether the PairModel has a timestep limit that will.
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:82
scalar forceCoeff(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Return the force coefficient based on the forceRampTime_.
Definition: PairModel.C:97
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:75
virtual void evaluatePair(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const =0
Calculate the pair interaction between parcels.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73