BrownianMotionForce.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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::BrownianMotionForce
29 
30 Description
31  Calculates particle Brownian motion force.
32 
33  Reference:
34  \verbatim
35  Li, A., & Ahmadi, G. (1992).
36  Dispersion and deposition of spherical particles from point sources
37  in a turbulent channel flow.
38  Aerosol science and technology,
39  16(4), 209-226.
40  \endverbatim
41 
42  Entries
43  \table
44  Property | Description | Type | Reqd | Deflt
45  lambda | Molecular free path length | scalar | yes | -
46  turbulence | Use turbulence | bool | yes | -
47  spherical | Spherical instead of cubic distribution | bool | no | true
48  \endtable
49 
50 Note
51  The treatment changed from cubic to spherical around v1606.
52  Reinstate support for cubic via spherical (true/false) switch after v2306.
53 
54 SourceFiles
55  BrownianMotionForce.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef Foam_BrownianMotionForce_H
60 #define Foam_BrownianMotionForce_H
61 
62 #include "ParticleForce.H"
63 #include "Random.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class BrownianMotionForce Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 template<class CloudType>
75 class BrownianMotionForce
76 :
77  public ParticleForce<CloudType>
78 {
79  // Private Data
80 
81  //- Reference to the cloud random number generator
82  Random& rndGen_;
83 
84  //- Molecular free path length [m]
85  const scalar lambda_;
86 
87  //- Pointer to the turbulence kinetic energy field
88  const volScalarField* kPtr_;
89 
90  //- Turbulence flag
91  bool turbulence_;
92 
93  //- Local ownership of the turbulence k field
94  bool ownK_;
95 
96  //- Spherical vs cubic (transitional)
97  bool useSpherical_;
98 
99 
100  // Private Member Functions
101 
102  //- Return the k field from the turbulence model
103  tmp<volScalarField> kModel() const;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("BrownianMotion");
110 
111 
112  // Constructors
113 
114  //- Construct from mesh
116  (
117  CloudType& owner,
118  const fvMesh& mesh,
119  const dictionary& dict
120  );
121 
122  //- Construct copy
124 
125  //- Construct and return a clone
126  virtual autoPtr<ParticleForce<CloudType>> clone() const
127  {
129  (
131  );
132  }
133 
134 
135  //- Destructor
136  virtual ~BrownianMotionForce();
137 
138 
139  // Member Functions
140 
141  // Access
142 
143  //- The molecular free path length [m]
144  scalar lambda() const noexcept { return lambda_; }
145 
146  //- The turbulence flag
147  bool turbulence() const noexcept { return turbulence_; }
148 
149 
150  // Evaluation
151 
152  //- Cache fields
153  virtual void cacheFields(const bool store);
154 
155  //- Calculate the coupled force
156  virtual forceSuSp calcCoupled
157  (
158  const typename CloudType::parcelType& p,
159  const typename CloudType::parcelType::trackingData& td,
160  const scalar dt,
161  const scalar mass,
162  const scalar Re,
163  const scalar muc
164  ) const;
165 };
166 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #ifdef NoRepository
175  #include "BrownianMotionForce.C"
176 #endif
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
dictionary dict
bool turbulence() const noexcept
The turbulence flag.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual autoPtr< ParticleForce< CloudType > > clone() const
Construct and return a clone.
const fvMesh & mesh() const noexcept
Return the mesh database.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
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.
TypeName("BrownianMotion")
Runtime type information.
BrownianMotionForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const direction noexcept
Definition: Scalar.H:258
virtual void cacheFields(const bool store)
Cache fields.
scalarField Re(const UList< complex > &cmplx)
Extract real component.
Definition: complexField.C:207
const CloudType & owner() const noexcept
Return const access to the cloud owner.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual ~BrownianMotionForce()
Destructor.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
scalar lambda() const noexcept
The molecular free path length [m].
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Namespace for OpenFOAM.
Calculates particle Brownian motion force.