ParticleForce.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-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::ParticleForce
28
29Group
30 grpLagrangianIntermediateForceSubModels
31
32Description
33 Abstract base class for particle forces
34
35SourceFiles
36 ParticleForceI.H
37 ParticleForce.C
38 ParticleForceNew.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef ParticleForce_H
43#define ParticleForce_H
44
45#include "dictionary.H"
46#include "forceSuSp.H"
47#include "fvMesh.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class ParticleForce Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class CloudType>
60class ParticleForce
61{
62 // Private data
63
64 //- Reference to the owner cloud
65 CloudType& owner_;
66
67 //- Reference to the mesh database
68 const fvMesh& mesh_;
69
70 //- Force coefficients dictionary
71 const dictionary coeffs_;
72
73
74public:
75
76 //- Runtime type information
77 TypeName("particleForce");
78
79 //- Declare runtime constructor selection table
81 (
82 autoPtr,
85 (
87 const fvMesh& mesh,
88 const dictionary& dict
89 ),
90 (owner, mesh, dict)
91 );
92
93
94 //- Convenience typedef for return type
96
97
98 // Constructors
99
100 //- Construct from mesh
102 (
104 const fvMesh& mesh,
105 const dictionary& dict,
106 const word& forceType,
107 const bool readCoeffs
108 );
109
110 //- Construct copy
111 ParticleForce(const ParticleForce& pf);
112
113 //- Construct and return a clone
115 {
117 (
118 new ParticleForce<CloudType>(*this)
119 );
120 }
121
122
123 //- Destructor
124 virtual ~ParticleForce();
125
126
127 //- Selector
129 (
131 const fvMesh& mesh,
132 const dictionary& dict,
133 const word& forceType
134 );
135
136
137 // Member Functions
138
139 // Access
140
141 //- Return const access to the cloud owner
142 inline const CloudType& owner() const;
143
144 //- Return reference to the cloud owner
145 inline CloudType& owner();
146
147 //- Return the mesh database
148 inline const fvMesh& mesh() const;
149
150 //- Return the force coefficients dictionary
151 inline const dictionary& coeffs() const;
152
153
154 // Evaluation
155
156 //- Cache fields
157 virtual void cacheFields(const bool store);
158
159 //- Calculate the coupled force
160 virtual forceSuSp calcCoupled
161 (
162 const typename CloudType::parcelType& p,
163 const typename CloudType::parcelType::trackingData& td,
164 const scalar dt,
165 const scalar mass,
166 const scalar Re,
167 const scalar muc
168 ) const;
169
170 //- Calculate the non-coupled force
172 (
173 const typename CloudType::parcelType& p,
174 const typename CloudType::parcelType::trackingData& td,
175 const scalar dt,
176 const scalar mass,
177 const scalar Re,
178 const scalar muc
179 ) const;
180
181 //- Return the added mass
182 virtual scalar massAdd
183 (
184 const typename CloudType::parcelType& p,
185 const typename CloudType::parcelType::trackingData& td,
186 const scalar mass
187 ) const;
188};
189
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193} // End namespace Foam
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#include "ParticleForceI.H"
198
199#ifdef NoRepository
200 #include "ParticleForce.C"
201#endif
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205#define makeParticleForceModel(CloudType) \
206 \
207 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
208 defineNamedTemplateTypeNameAndDebug \
209 (Foam::ParticleForce<kinematicCloudType>, 0); \
210 \
211 namespace Foam \
212 { \
213 defineTemplateRunTimeSelectionTable \
214 ( \
215 ParticleForce<kinematicCloudType>, \
216 dictionary \
217 ); \
218 }
219
221#define makeParticleForceModelType(SS, CloudType) \
222 \
223 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
224 defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
225 \
226 Foam::ParticleForce<kinematicCloudType>:: \
227 adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
228 add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233
234#endif
235
236// ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Abstract base class for particle forces.
Definition: ParticleForce.H:60
VectorSpace< Vector< vector >, vector, 2 > returnType
Convenience typedef for return type.
Definition: ParticleForce.H:94
virtual autoPtr< ParticleForce< CloudType > > clone() const
Construct and return a clone.
virtual forceSuSp calcNonCoupled(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.
Definition: ParticleForce.C:99
const dictionary & coeffs() const
Return the force coefficients dictionary.
virtual void cacheFields(const bool store)
Cache fields.
Definition: ParticleForce.C:74
static autoPtr< ParticleForce< CloudType > > New(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &forceType)
Selector.
declareRunTimeSelectionTable(autoPtr, ParticleForce, dictionary,(CloudType &owner, const fvMesh &mesh, const dictionary &dict),(owner, mesh, dict))
Declare runtime constructor selection table.
virtual ~ParticleForce()
Destructor.
Definition: ParticleForce.C:67
virtual scalar massAdd(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar mass) const
Return the added mass.
const CloudType & owner() const
Return const access to the cloud owner.
const fvMesh & mesh() const
Return the mesh database.
TypeName("particleForce")
Runtime type information.
virtual forceSuSp calcCoupled(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the coupled force.
Definition: ParticleForce.C:80
Templated vector space.
Definition: VectorSpace.H:79
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
Class used to pass data into container.
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:67
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
Vector< scalar > vector
Definition: vector.H:61
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)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73