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