Loading...
Searching...
No Matches
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 ParticleForce.C
37 ParticleForceNew.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_ParticleForce_H
42#define Foam_ParticleForce_H
43
44#include "dictionary.H"
45#include "forceSuSp.H"
46#include "fvMesh.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class ParticleForce Declaration
56\*---------------------------------------------------------------------------*/
57
58template<class CloudType>
59class ParticleForce
60{
61 // Private Data
62
63 //- Reference to the owner cloud
64 CloudType& owner_;
65
66 //- Reference to the mesh database
67 const fvMesh& mesh_;
68
69 //- Force coefficients dictionary
70 const dictionary coeffs_;
71
72
73public:
74
75 //- Runtime type information
76 TypeName("particleForce");
77
78 //- Declare runtime constructor selection table
80 (
81 autoPtr,
84 (
86 const fvMesh& mesh,
87 const dictionary& dict
88 ),
89 (owner, mesh, dict)
90 );
91
92
93 //- Convenience typedef for return type
95
96
97 // Constructors
98
99 //- Construct from mesh
103 const fvMesh& mesh,
104 const dictionary& dict,
105 const word& forceType,
106 const bool readCoeffs
107 );
108
109 //- Construct copy
110 ParticleForce(const ParticleForce& pf);
111
112 //- Construct and return a clone
114 {
116 (
117 new ParticleForce<CloudType>(*this)
118 );
119 }
120
121
122 //- Destructor
123 virtual ~ParticleForce();
124
125
126 //- Selector
128 (
130 const fvMesh& mesh,
131 const dictionary& dict,
132 const word& forceType
133 );
134
135
136 // Member Functions
137
138 // Access
139
140 //- Return const access to the cloud owner
141 const CloudType& owner() const noexcept { return owner_; }
142
143 //- Return reference to the cloud owner
144 CloudType& owner() noexcept { return owner_; }
145
146 //- Return the mesh database
147 const fvMesh& mesh() const noexcept { return mesh_; }
148
149 //- Return the force coefficients dictionary
150 const dictionary& coeffs() const noexcept { return coeffs_; }
151
152
153 // Evaluation
154
155 //- Cache fields
156 virtual void cacheFields(const bool store);
157
158 //- Calculate the coupled force
159 virtual forceSuSp calcCoupled
161 const typename CloudType::parcelType& p,
162 const typename CloudType::parcelType::trackingData& td,
163 const scalar dt,
164 const scalar mass,
165 const scalar Re,
166 const scalar muc
167 ) const;
168
169 //- Calculate the non-coupled force
171 (
172 const typename CloudType::parcelType& p,
173 const typename CloudType::parcelType::trackingData& td,
174 const scalar dt,
175 const scalar mass,
176 const scalar Re,
177 const scalar muc
178 ) const;
179
180 //- Return the added mass
181 virtual scalar massAdd
182 (
183 const typename CloudType::parcelType& p,
184 const typename CloudType::parcelType::trackingData& td,
185 const scalar mass
186 ) const;
187};
188
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192} // End namespace Foam
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196#ifdef NoRepository
197 #include "ParticleForce.C"
198#endif
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202#define makeParticleForceModel(CloudType) \
203 \
204 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
205 defineNamedTemplateTypeNameAndDebug \
206 (Foam::ParticleForce<kinematicCloudType>, 0); \
207 \
208 namespace Foam \
209 { \
210 defineTemplateRunTimeSelectionTable \
211 ( \
212 ParticleForce<kinematicCloudType>, \
213 dictionary \
214 ); \
215 }
216
217
218#define makeParticleForceModelType(SS, CloudType) \
219 \
220 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
221 defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
222 \
223 Foam::ParticleForce<kinematicCloudType>:: \
224 adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
225 add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
226
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230
231#endif
232
233// ************************************************************************* //
const fvMesh & mesh() const noexcept
Return the mesh database.
VectorSpace< Vector< vector >, vector, 2 > returnType
Convenience typedef for return type.
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.
CloudType & owner() noexcept
Return reference to the cloud owner.
virtual void cacheFields(const bool store)
Cache fields.
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.
const CloudType & owner() const noexcept
Return const access to the cloud owner.
virtual scalar massAdd(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar mass) const
Return the added mass.
ParticleForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &forceType, const bool readCoeffs)
Construct from mesh.
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.
const dictionary & coeffs() const noexcept
Return the force coefficients dictionary.
Templated vector space.
Definition VectorSpace.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Helper container for force Su and Sp terms.
Definition forceSuSp.H:63
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
dynamicFvMesh & mesh
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
DSMCCloud< dsmcParcel > CloudType
const direction noexcept
Definition scalarImpl.H:265
scalarField Re(const UList< complex > &cmplx)
Extract real component.
Vector< scalar > vector
Definition vector.H:57
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:68