PatchCollisionDensity.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) 2018 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::PatchCollisionDensity
28 
29 Description
30  Function object which generates fields of the number and rate of collisions
31  per unit area on all patches. Can optionally take a minimum speed below
32  which a collision is not counted.
33 
34  Example usage:
35  \verbatim
36  patchCollisionDensity1
37  {
38  type patchCollisionDensity;
39  minSpeed 1e-3;
40  }
41  \endverbatim
42 
43 SourceFiles
44  PatchCollisionDensity.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef PatchCollisionDensity_H
49 #define PatchCollisionDensity_H
50 
51 #include "CloudFunctionObject.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class PatchCollisionDensity Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class CloudType>
64 :
65  public CloudFunctionObject<CloudType>
66 {
67  // Private data
68 
69  typedef typename CloudType::particleType parcelType;
70 
71  //- The threshold for a collision
72  const scalar minSpeed_;
73 
74  //- The field of the number of collisions per unit area
75  volScalarField::Boundary collisionDensity_;
76 
77  //- The field of the number of collisions per unit area at the last
78  // output
79  volScalarField::Boundary collisionDensity0_;
80 
81  //- The time at the last output
82  scalar time0_;
83 
84 
85 protected:
86 
87  // Protected Member Functions
88 
89  //- Write post-processing info
90  void write();
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("patchCollisionDensity");
97 
98 
99  // Constructors
100 
101  //- Construct from dictionary
103  (
104  const dictionary& dict,
105  CloudType& owner,
106  const word& modelName
107  );
108 
109  //- Construct copy
111 
112  //- Construct and return a clone
114  {
116  (
118  );
119  }
120 
121 
122  //- Destructor
123  virtual ~PatchCollisionDensity() = default;
124 
125 
126  // Member Functions
127 
128  //- Post-patch hook
129  virtual void postPatch
130  (
131  const parcelType& p,
132  const polyPatch& pp,
133  bool& keepParticle
134  );
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #ifdef NoRepository
145  #include "PatchCollisionDensity.C"
146 #endif
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::PatchCollisionDensity::write
void write()
Write post-processing info.
Definition: PatchCollisionDensity.C:38
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
PatchCollisionDensity.C
Foam::PatchCollisionDensity
Function object which generates fields of the number and rate of collisions per unit area on all patc...
Definition: PatchCollisionDensity.H:62
Foam::PatchCollisionDensity::~PatchCollisionDensity
virtual ~PatchCollisionDensity()=default
Destructor.
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
Foam::PatchCollisionDensity::postPatch
virtual void postPatch(const parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
Definition: PatchCollisionDensity.C:143
Foam::PatchCollisionDensity::TypeName
TypeName("patchCollisionDensity")
Runtime type information.
CloudFunctionObject.H
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::PatchCollisionDensity::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: PatchCollisionDensity.H:112
Foam::Cloud::particleType
ParticleType particleType
Definition: Cloud.H:114
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PatchCollisionDensity::PatchCollisionDensity
PatchCollisionDensity(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchCollisionDensity.C:82
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:62