ParticleTrap.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) 2012-2020 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::ParticleTrap
26 
27 Description
28  Traps particles within a given phase fraction for multi-phase cases.
29 
30  Model is activated using:
31  \verbatim
32  particleTrap1
33  {
34  type particleTrap;
35  alpha alpha; // name of the volume fraction field
36  threshold 0.95; // alpha value below which model is active
37  }
38  \endverbatim
39 
40 
41 SourceFiles
42  ParticleTrap.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef ParticleTrap_H
47 #define ParticleTrap_H
48 
49 #include "CloudFunctionObject.H"
50 #include "volFields.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class ParticleTrap Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class CloudType>
62 class ParticleTrap
63 :
64  public CloudFunctionObject<CloudType>
65 {
66  // Private Data
67 
68  // Typedefs
69 
70  //- Convenience typedef for parcel type
71  typedef typename CloudType::parcelType parcelType;
72 
73 
74  //- Name of vol fraction field
75  const word alphaName_;
76 
77  //- Pointer to the volume fraction field
78  const volScalarField* alphaPtr_;
79 
80  //- Gradient of the volume fraction field
81  autoPtr<volVectorField> gradAlphaPtr_;
82 
83  //- Threshold beyond which model is active
84  scalar threshold_;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("particleTrap");
91 
92 
93  // Constructors
94 
95  //- Construct from dictionary
97  (
98  const dictionary& dict,
100  const word& modelName
101  );
102 
103  //- Construct copy
105 
106  //- Construct and return a clone
108  {
110  (
111  new ParticleTrap<CloudType>(*this)
112  );
113  }
114 
115 
116  //- Destructor
117  virtual ~ParticleTrap();
118 
119 
120  // Member Functions
121 
122  // Evaluation
123 
124  //- Pre-evolve hook
125  virtual void preEvolve();
126 
127  //- Post-evolve hook
128  virtual void postEvolve();
129 
130  //- Post-move hook
131  virtual void postMove
132  (
133  typename CloudType::parcelType& p,
134  const scalar dt,
135  const point& position0,
136  bool& keepParticle
137  );
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #ifdef NoRepository
148  #include "ParticleTrap.C"
149 #endif
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
virtual void preEvolve()
Pre-evolve hook.
Definition: ParticleTrap.C:74
ParticleTrap(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ParticleTrap.C:33
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
A class for handling words, derived from string.
Definition: word.H:59
virtual void postEvolve()
Post-evolve hook.
Definition: ParticleTrap.C:97
virtual ~ParticleTrap()
Destructor.
Definition: ParticleTrap.C:67
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleTrap.H:106
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: ParticleTrap.C:105
TypeName("particleTrap")
Runtime type information.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
Traps particles within a given phase fraction for multi-phase cases.
Definition: ParticleTrap.H:61
Templated cloud function object base class.
Namespace for OpenFOAM.