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 | Copyright (C) 2012-2016 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  alphaName alpha; // name 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 label celli,
135  const scalar dt,
136  const point& position0,
137  bool& keepParticle
138  );
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #ifdef NoRepository
149  #include "ParticleTrap.C"
150 #endif
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
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
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleTrap.H:106
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 void postMove(typename CloudType::parcelType &p, const label celli, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: ParticleTrap.C:105
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
TypeName("particleTrap")
Runtime type information.
const CloudType & owner() const
Return const access to the owner cloud.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Traps particles within a given phase fraction for multi-phase cases.
Definition: ParticleTrap.H:61
Templated cloud function object base class.
Namespace for OpenFOAM.