CellZoneInjection.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) 2011-2017 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::CellZoneInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Injection positions specified by a particle number density within a cell
34  set.
35 
36  User specifies:
37  - Number density of particles in cell set (effective)
38  - Total mass to inject
39  - Initial parcel velocity
40 
41  Properties:
42  - Parcel diameters obtained by PDF model
43  - All parcels introduced at SOI
44 
45 SourceFiles
46  CellZoneInjection.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef CellZoneInjection_H
51 #define CellZoneInjection_H
52 
53 #include "InjectionModel.H"
54 #include "distributionModel.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class CellZoneInjection Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class CloudType>
67 :
68  public InjectionModel<CloudType>
69 {
70  // Private data
71 
72  //- Name of cell zone
73  const word cellZoneName_;
74 
75  //- Number density
76  const scalar numberDensity_;
77 
78  //- Field of parcel positions
79  List<vector> positions_;
80 
81  //- List of cell labels corresponding to injector positions
82  labelList injectorCells_;
83 
84  //- List of tetFace labels corresponding to injector positions
85  labelList injectorTetFaces_;
86 
87  //- List of tetPt labels corresponding to injector positions
88  labelList injectorTetPts_;
89 
90  //- Field of parcel diameters
91  scalarList diameters_;
92 
93  //- Initial parcel velocity
94  const vector U0_;
95 
96  //- Parcel size distribution model
97  const autoPtr<distributionModel> sizeDistribution_;
98 
99 
100  // Private Member Functions
101 
102  //- Set the parcel injection positions
103  void setPositions(const labelList& cellZoneCells);
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("cellZoneInjection");
110 
111 
112  // Constructors
113 
114  //- Construct from dictionary
116  (
117  const dictionary& dict,
118  CloudType& owner,
119  const word& modelName
120  );
121 
122  //- Construct copy
124 
125  //- Construct and return a clone
127  {
129  (
131  );
132  }
133 
134 
135  //- Destructor
136  virtual ~CellZoneInjection();
137 
138 
139  // Member Functions
140 
141  //- Set injector locations when mesh is updated
142  virtual void updateMesh();
143 
144  //- Return the end-of-injection time
145  scalar timeEnd() const;
146 
147  //- Number of parcels to introduce relative to SOI
148  label parcelsToInject(const scalar time0, const scalar time1);
150  //- Volume of parcels to introduce relative to SOI
151  scalar volumeToInject(const scalar time0, const scalar time1);
152 
153 
154  // Injection geometry
155 
156  //- Set the injection position and owner cell, tetFace and tetPt
157  virtual void setPositionAndCell
158  (
159  const label parcelI,
160  const label nParcels,
161  const scalar time,
162  vector& position,
163  label& cellOwner,
164  label& tetFacei,
165  label& tetPti
166  );
167 
168  //- Set the parcel properties
169  virtual void setProperties
170  (
171  const label parcelI,
172  const label nParcels,
173  const scalar time,
174  typename CloudType::parcelType& parcel
175  );
176 
177  //- Flag to identify whether model fully describes the parcel
178  virtual bool fullyDescribed() const;
179 
180  //- Return flag to identify whether or not injection of parcelI is
181  // permitted
182  virtual bool validInjection(const label parcelI);
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193  #include "CellZoneInjection.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
virtual ~CellZoneInjection()
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Templated injection model class.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:98
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
const CloudType & owner() const
Return const access to the owner cloud.
TypeName("cellZoneInjection")
Runtime type information.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Injection positions specified by a particle number density within a cell set.
A class for handling words, derived from Foam::string.
Definition: word.H:63
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
CellZoneInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
scalar timeEnd() const
Return the end-of-injection time.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
virtual void updateMesh()
Set injector locations when mesh is updated.
scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Namespace for OpenFOAM.