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