ConeInjection.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) 2011-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::ConeInjection
26 
27 Description
28  This injector injects particles in a number of cones. The user specifies a
29  position and a direction to inject at, and two angles to inject between.
30  Optionally, this injector can introduce particles over a disc, instead of
31  at a point, in which case inner and outer diameters of the disc are also
32  specified.
33 
34  The velocity is specified either as constant, or it is calculated from an
35  injection pressure, or it is calculated from the injector mass flow rate
36  and a discharge coefficient; i.e.:
37 
38  Constant velocity:
39  \f[
40  U = U_{constant}
41  \f]
42 
43  Pressure driven velocity:
44  \f[
45  U = \sqrt{2(p_{injection} - p)/\rho}
46  \f]
47 
48  Flow rate and discharge:
49  \f[
50  U = \dot{m}/(\rho A C_{discharge})
51  \f]
52 
53 Usage
54  \table
55  Property | Description | Required | Default
56  position | The injection position | yes |
57  direction | The injection direction | yes |
58  thetaInner | The inner cone angle | yes |
59  thetaOuter | The outer cone angle | yes |
60  injectionMethod | Inject at a point or on a disc | no | point
61  dInner | The inner disc diameter |\\
62  if disc or flowRateAndDischarge |
63  dInner | The outer disc diameter |\\
64  if disc or flowRateAndDischarge |
65  flowType | Inject with constantVelocity, pressureDrivenVelocity \\
66  or flowRateAndDischarge | no | constantVelocity
67  Umag | The injection velocity | if constantVelocity |
68  Pinj | The injection pressure |\\
69  if pressureDrivenVelocity |
70  Cd | The discharge coefficient | if flowRateAndDischarge |
71  \endtable
72 
73  Example specification:
74 
75  \verbatim
76  injectionModels
77  {
78  model1
79  {
80  type coneInjection;
81 
82  // Times
83  SOI 0;
84  duration 1;
85 
86  // Quantities
87  massTotal 0; // <-- not used with these settings
88  parcelBasisType fixed;
89  parcelsPerSecond 1000000;
90  flowRateProfile constant 1;
91  nParticle 1;
92 
93  // Sizes
94  sizeDistribution
95  {
96  type fixedValue;
97  fixedValueDistribution
98  {
99  value 0.0025;
100  }
101  }
102 
103  // Geometry
104  position (-0.15 -0.1 0);
105  direction (1 0 0);
106  thetaInner 0;
107  thetaOuter 45;
108 
109  // - Inject at a point
110  injectionMethod point;
111 
113  //injectionMethod disc;
114  //dInner 0;
115  //dOuter 0.05;
116 
117  // Velocity
118 
119  // - Inject with constant velocity
120  flowType constantVelocity;
121  Umag 1;
122 
125  //flowType flowRateAndDischarge;
126  //Cd 0.9;
127 
129  //flowType pressureDrivenVelocity;
130  //Pinj 10e5;
131  }
132  }
133  \endverbatim
134 
135 SourceFiles
136  ConeInjection.C
137 
138 \*---------------------------------------------------------------------------*/
139 
140 #ifndef ConeInjection_H
141 #define ConeInjection_H
142 
143 #include "InjectionModel.H"
144 #include "distributionModel.H"
145 #include "TimeFunction1.H"
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 namespace Foam
150 {
151 
152 /*---------------------------------------------------------------------------*\
153  Class ConeInjection Declaration
154 \*---------------------------------------------------------------------------*/
155 
156 template<class CloudType>
157 class ConeInjection
158 :
159  public InjectionModel<CloudType>
160 {
161 public:
162 
163  //- Injection method enumeration
164  enum injectionMethod
165  {
166  imPoint,
167  imDisc
168  };
169 
170  //- Flow type enumeration
171  enum flowType
172  {
176  };
177 
178 
179 private:
180 
181  // Private Data
182 
183  //- Point/disc injection method
184  injectionMethod injectionMethod_;
185 
186  //- Flow type
187  flowType flowType_;
188 
189  //- Position of the injector
190  const TimeFunction1<vector> position_;
191 
192  //- Is the position constant?
193  const bool positionIsConstant_;
194 
195  //- Centreline direction in which to inject
196  const TimeFunction1<vector> direction_;
197 
198  //- Cell label corresponding to the injector position
199  label injectorCell_;
200 
201  //- Tet-face label corresponding to the injector position
202  label injectorTetFace_;
203 
204  //- Tet-point label corresponding to the injector position
205  label injectorTetPt_;
206 
207  //- Injection duration [s]
208  scalar duration_;
209 
210  //- Number of parcels to introduce per second
211  const label parcelsPerSecond_;
213  //- Flow rate profile relative to SOI []
214  const TimeFunction1<scalar> flowRateProfile_;
215 
216  //- Inner half-cone angle relative to SOI [deg]
217  const TimeFunction1<scalar> thetaInner_;
218 
219  //- Outer half-cone angle relative to SOI [deg]
220  const TimeFunction1<scalar> thetaOuter_;
222  //- Parcel size distribution model
223  const autoPtr<distributionModel> sizeDistribution_;
224 
225 
226  // Disc geometry
227 
228  //- The inner disc diameter [m]
229  scalar dInner_;
231  //- The outer disc diameter [m]
232  scalar dOuter_;
233 
234 
235  // Velocity model coefficients
236 
237  //- Parcel velocity [m/s]
238  TimeFunction1<scalar> Umag_;
239 
240  //- Discharge coefficient []
242 
243  //- Injection pressure [Pa]
244  TimeFunction1<scalar> Pinj_;
245 
246 
247  // Private Member Functions
248 
249  //- Set the injection type
250  void setInjectionMethod();
251 
252  //- Set the injection flow type
253  void setFlowType();
254 
255 
256 public:
257 
258  //- Runtime type information
259  TypeName("coneInjection");
260 
261 
262  // Constructors
263 
264  //- Construct from dictionary
266  (
267  const dictionary& dict,
268  CloudType& owner,
269  const word& modelName
270  );
271 
272  //- Construct copy
274 
275  //- Construct and return a clone
277  {
279  (
280  new ConeInjection<CloudType>(*this)
281  );
282  }
283 
284 
285  //- Destructor
286  virtual ~ConeInjection();
287 
288 
289  // Member Functions
290 
291  //- Set injector locations when mesh is updated
292  virtual void updateMesh();
293 
294  //- Return the end-of-injection time
295  scalar timeEnd() const;
296 
297  //- Number of parcels to introduce relative to SOI
298  virtual label parcelsToInject(const scalar time0, const scalar time1);
299 
300  //- Volume of parcels to introduce relative to SOI
301  virtual scalar volumeToInject(const scalar time0, const scalar time1);
302 
303 
304 
305  // Injection geometry
306 
307  //- Set the injection position and owner cell, tetFace and tetPt
308  virtual void setPositionAndCell
309  (
310  const label parcelI,
311  const label nParcels,
312  const scalar time,
313  vector& position,
314  label& cellOwner,
315  label& tetFacei,
316  label& tetPti
317  );
318 
319  //- Set the parcel properties
320  virtual void setProperties
321  (
322  const label parcelI,
323  const label nParcels,
324  const scalar time,
325  typename CloudType::parcelType& parcel
326  );
327 
328  //- Flag to identify whether model fully describes the parcel
329  virtual bool fullyDescribed() const;
330 
331  //- Return flag to identify whether or not injection of parcelI is
332  // permitted
333  virtual bool validInjection(const label parcelI);
334 };
335 
336 
337 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
338 
339 } // End namespace Foam
340 
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342 
343 #ifdef NoRepository
344  #include "ConeInjection.C"
345 #endif
346 
347 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348 
349 #endif
350 
351 // ************************************************************************* //
ConeInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
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.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
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.
TypeName("coneInjection")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
scalar timeEnd() const
Return the end-of-injection time.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
injectionMethod
Injection method enumeration.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
virtual ~ConeInjection()
Destructor.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
flowType
Flow type enumeration.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Namespace for OpenFOAM.
This injector injects particles in a number of cones. The user specifies a position and a direction t...