ParticleTrap.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) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2020 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::ParticleTrap
29 
30 Group
31  grpLagrangianIntermediateFunctionObjects
32 
33 Description
34  Traps particles within a given phase fraction for multi-phase cases.
35 
36  Model is activated using:
37  \verbatim
38  particleTrap1
39  {
40  type particleTrap;
41  alphaName alpha; // name volume fraction field
42  threshold 0.95; // alpha value below which model is active
43  }
44  \endverbatim
45 
46 
47 SourceFiles
48  ParticleTrap.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef ParticleTrap_H
53 #define ParticleTrap_H
54 
55 #include "CloudFunctionObject.H"
56 #include "volFields.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class ParticleTrap Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 template<class CloudType>
68 class ParticleTrap
69 :
70  public CloudFunctionObject<CloudType>
71 {
72  // Private Data
73 
74  // Typedefs
75 
76  //- Convenience typedef for parcel type
77  typedef typename CloudType::parcelType parcelType;
78 
79 
80  //- Name of vol fraction field
81  const word alphaName_;
82 
83  //- Pointer to the volume fraction field
84  const volScalarField* alphaPtr_;
85 
86  //- Gradient of the volume fraction field
87  autoPtr<volVectorField> gradAlphaPtr_;
88 
89  //- Threshold beyond which model is active
90  scalar threshold_;
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("particleTrap");
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  (
117  new ParticleTrap<CloudType>(*this)
118  );
119  }
120 
121 
122  //- Destructor
123  virtual ~ParticleTrap() = default;
124 
125 
126  // Member Functions
127 
128  // Evaluation
129 
130  //- Pre-evolve hook
131  virtual void preEvolve
132  (
133  const typename parcelType::trackingData& td
134  );
135 
136  //- Post-evolve hook
137  virtual void postEvolve
138  (
139  const typename parcelType::trackingData& td
140  );
141 
142  //- Post-move hook
143  virtual void postMove
144  (
145  parcelType& p,
146  const scalar dt,
147  const point& position0,
148  bool& keepParticle
149  );
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "ParticleTrap.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
volFields.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::ParticleTrap::~ParticleTrap
virtual ~ParticleTrap()=default
Destructor.
Foam::ParticleTrap::TypeName
TypeName("particleTrap")
Runtime type information.
Foam::ParticleTrap::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleTrap.H:112
Foam::ParticleTrap
Traps particles within a given phase fraction for multi-phase cases.
Definition: ParticleTrap.H:67
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
CloudFunctionObject.H
Foam::ParticleTrap::preEvolve
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
Definition: ParticleTrap.C:71
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
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
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::Vector< scalar >
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:62
ParticleTrap.C
Foam::ParticleTrap::postMove
virtual void postMove(parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: ParticleTrap.C:107
Foam::ParticleTrap::postEvolve
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
Definition: ParticleTrap.C:97
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::ParticleTrap::ParticleTrap
ParticleTrap(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ParticleTrap.C:36