ParticleForce.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 dictionary
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 references 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 typename CloudType::parcelType::trackingData& td,
158  const scalar dt,
159  const scalar mass,
160  const scalar Re,
161  const scalar muc
162  ) const;
163 
164  //- Calculate the non-coupled force
165  virtual forceSuSp calcNonCoupled
166  (
167  const typename CloudType::parcelType& p,
168  const typename CloudType::parcelType::trackingData& td,
169  const scalar dt,
170  const scalar mass,
171  const scalar Re,
172  const scalar muc
173  ) const;
174 
175  //- Return the added mass
176  virtual scalar massAdd
177  (
178  const typename CloudType::parcelType& p,
179  const typename CloudType::parcelType::trackingData& td,
180  const scalar mass
181  ) const;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #include "ParticleForceI.H"
192 
193 #ifdef NoRepository
194  #include "ParticleForce.C"
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 #define makeParticleForceModel(CloudType) \
200  \
201  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
202  defineNamedTemplateTypeNameAndDebug \
203  (Foam::ParticleForce<kinematicCloudType>, 0); \
204  \
205  namespace Foam \
206  { \
207  defineTemplateRunTimeSelectionTable \
208  ( \
209  ParticleForce<kinematicCloudType>, \
210  dictionary \
211  ); \
212  }
213 
215 #define makeParticleForceModelType(SS, CloudType) \
216  \
217  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
218  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
219  \
220  Foam::ParticleForce<kinematicCloudType>:: \
221  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
222  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 
228 #endif
229 
230 // ************************************************************************* //
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
dictionary dict
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 scalar massAdd(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar mass) const
Return the added mass.
Templated vector space.
Definition: VectorSpace.H:53
const fvMesh & mesh() const
Return the mesh database.
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 CloudType & owner() const
Return const access to the cloud owner.
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:61
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
const dictionary & coeffs() const
Return the force coefficients dictionary.
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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
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
virtual ~ParticleForce()
Destructor.
Definition: ParticleForce.C:67
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
declareRunTimeSelectionTable(autoPtr, ParticleForce, dictionary,(CloudType &owner, const fvMesh &mesh, const dictionary &dict),(owner, mesh, dict))
Declare runtime constructor selection table.
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
virtual autoPtr< ParticleForce< CloudType > > clone() const
Construct and return a clone.
Namespace for OpenFOAM.