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 | Copyright (C) 2011-2012 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::BrownianMotionForce
26 
27 Description
28  Calculates particle Brownian motion force
29 
30 SourceFiles
31  BrownianMotionForceI.H
32  BrownianMotionForce.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef BrownianMotionForce_H
37 #define BrownianMotionForce_H
38 
39 #include "ParticleForce.H"
40 #include "cachedRandom.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class BrownianMotionForce Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class CloudType>
53 :
54  public ParticleForce<CloudType>
55 {
56  // Private data
57 
58  //- Reference to the cloud random number generator
60 
61  //- Molecular free path length [m]
62  const scalar lambda_;
63 
64  //- Turbulence flag
65  bool turbulence_;
66 
67  //- Pointer to the turbulence kinetic energy field
68  const volScalarField* kPtr_;
69 
70  //- Flag that indicates ownership of turbulence k field
71  bool ownK_;
72 
73 
74  // Private Member Functions
75 
76  //- Inverse erf for Gaussian distribution
77  scalar erfInv(const scalar y) const;
78 
79  //- Return the k field from the turbulence model
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("BrownianMotion");
87 
88 
89  // Constructors
90 
91  //- Construct from mesh
93  (
95  const fvMesh& mesh,
96  const dictionary& dict
97  );
98 
99  //- Construct copy
101 
102  //- Construct and return a clone
103  virtual autoPtr<ParticleForce<CloudType> > clone() const
104  {
106  (
108  );
109  }
110 
111 
112  //- Destructor
113  virtual ~BrownianMotionForce();
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Return const access to the molecular free path length [m]
121  inline scalar lambda() const;
122 
123  //- Return const access to the turbulence flag
124  inline bool turbulence() const;
125 
126 
127  // Evaluation
128 
129  //- Cache fields
130  virtual void cacheFields(const bool store);
131 
132  //- Calculate the non-coupled force
133  virtual forceSuSp calcCoupled
134  (
135  const typename CloudType::parcelType& p,
136  const scalar dt,
137  const scalar mass,
138  const scalar Re,
139  const scalar muc
140  ) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #include "BrownianMotionForceI.H"
151 
152 #ifdef NoRepository
153  #include "BrownianMotionForce.C"
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
Foam::ParticleForce::owner
const CloudType & owner() const
Return const access to the cloud owner.
Definition: ParticleForceI.H:29
p
p
Definition: pEqn.H:62
Foam::BrownianMotionForce::BrownianMotionForce
BrownianMotionForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
Definition: BrownianMotionForce.C:88
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::BrownianMotionForce::~BrownianMotionForce
virtual ~BrownianMotionForce()
Destructor.
Definition: BrownianMotionForce.C:121
Foam::Re
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
BrownianMotionForceI.H
Foam::BrownianMotionForce::cacheFields
virtual void cacheFields(const bool store)
Cache fields.
Definition: BrownianMotionForce.C:128
Foam::BrownianMotionForce::TypeName
TypeName("BrownianMotion")
Runtime type information.
Foam::BrownianMotionForce::turbulence
bool turbulence() const
Return const access to the turbulence flag.
Definition: BrownianMotionForceI.H:36
Foam::BrownianMotionForce::erfInv
scalar erfInv(const scalar y) const
Inverse erf for Gaussian distribution.
Definition: BrownianMotionForce.C:36
Foam::BrownianMotionForce::lambda
scalar lambda() const
Return const access to the molecular free path length [m].
Definition: BrownianMotionForceI.H:29
BrownianMotionForce.C
Foam::cachedRandom
Random number generator.
Definition: cachedRandom.H:63
Foam::forceSuSp
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:58
Foam::ParticleForce
Abstract base class for particle forces.
Definition: ParticleForce.H:53
ParticleForce.H
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::BrownianMotionForce::clone
virtual autoPtr< ParticleForce< CloudType > > clone() const
Construct and return a clone.
Definition: BrownianMotionForce.H:102
dict
dictionary dict
Definition: searchingEngine.H:14
cachedRandom.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::BrownianMotionForce
Calculates particle Brownian motion force.
Definition: BrownianMotionForce.H:51
Foam::BrownianMotionForce::kPtr_
const volScalarField * kPtr_
Pointer to the turbulence kinetic energy field.
Definition: BrownianMotionForce.H:67
Foam::BrownianMotionForce::calcCoupled
virtual forceSuSp calcCoupled(const typename CloudType::parcelType &p, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.
Definition: BrownianMotionForce.C:160
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::BrownianMotionForce::ownK_
bool ownK_
Flag that indicates ownership of turbulence k field.
Definition: BrownianMotionForce.H:70
Foam::BrownianMotionForce::lambda_
const scalar lambda_
Molecular free path length [m].
Definition: BrownianMotionForce.H:61
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::ParticleForce::mesh
const fvMesh & mesh() const
Return the mesh database.
Definition: ParticleForceI.H:43
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::BrownianMotionForce::turbulence_
bool turbulence_
Turbulence flag.
Definition: BrownianMotionForce.H:64
Foam::BrownianMotionForce::rndGen_
cachedRandom & rndGen_
Reference to the cloud random number generator.
Definition: BrownianMotionForce.H:58
Foam::BrownianMotionForce::kModel
tmp< volScalarField > kModel() const
Return the k field from the turbulence model.
Definition: BrownianMotionForce.C:56
y
scalar y
Definition: LISASMDCalcMethod1.H:14