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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::ParticleForce
28 
29 Group
30  grpLagrangianIntermediateForceSubModels
31 
32 Description
33  Abstract base class for particle forces
34 
35 SourceFiles
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"
48 #include "runTimeSelectionTables.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class ParticleForce Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class CloudType>
60 class 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 
74 public:
75 
76  //- Runtime type information
77  TypeName("particleForce");
78 
79  //- Declare runtime constructor selection table
81  (
82  autoPtr,
84  dictionary,
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  (
103  CloudType& owner,
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
114  virtual autoPtr<ParticleForce<CloudType>> clone() const
115  {
117  (
118  new ParticleForce<CloudType>(*this)
119  );
120  }
121 
122 
123  //- Destructor
124  virtual ~ParticleForce();
125 
126 
127  //- Selector
129  (
130  CloudType& owner,
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
171  virtual forceSuSp calcNonCoupled
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
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 
220 
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 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::ParticleForce::clone
virtual autoPtr< ParticleForce< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleForce.H:113
Foam::ParticleForce::owner
const CloudType & owner() const
Return const access to the cloud owner.
Definition: ParticleForceI.H:31
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::ParticleForce::TypeName
TypeName("particleForce")
Runtime type information.
Foam::ParticleForce::ParticleForce
ParticleForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &forceType, const bool readCoeffs)
Construct from mesh.
Definition: ParticleForce.C:34
Foam::ParticleForce::returnType
VectorSpace< Vector< vector >, vector, 2 > returnType
Convenience typedef for return type.
Definition: ParticleForce.H:94
forceSuSp.H
Foam::ParticleForce::calcCoupled
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
Foam::ParticleForce::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, ParticleForce, dictionary,(CloudType &owner, const fvMesh &mesh, const dictionary &dict),(owner, mesh, dict))
Declare runtime constructor selection table.
Foam::ParticleForce::New
static autoPtr< ParticleForce< CloudType > > New(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &forceType)
Selector.
Definition: ParticleForceNew.C:36
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::ParticleForce::calcNonCoupled
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
Foam::forceSuSp
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:64
Foam::ParticleForce::cacheFields
virtual void cacheFields(const bool store)
Cache fields.
Definition: ParticleForce.C:74
Foam::ParticleForce
Abstract base class for particle forces.
Definition: ParticleForce.H:59
Foam::ParticleForce::massAdd
virtual scalar massAdd(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar mass) const
Return the added mass.
Definition: ParticleForce.C:118
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::ParticleForce::coeffs
const dictionary & coeffs() const
Return the force coefficients dictionary.
Definition: ParticleForceI.H:52
dictionary.H
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
ParticleForceI.H
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
ParticleForce.C
Foam::ParticleForce::mesh
const fvMesh & mesh() const
Return the mesh database.
Definition: ParticleForceI.H:45
Foam::ParticleForce::~ParticleForce
virtual ~ParticleForce()
Destructor.
Definition: ParticleForce.C:67