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-2023 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  parcelsPerSecond 1000000;
88 
89  // - Inject parcels with a fixed number of particles
90  nParticle 1;
91 
93  //massTotal 6.0e-6;
94  //uniformParcelSize volume;
95 
96  // Sizes
97  sizeDistribution
98  {
99  type fixedValue;
100  fixedValueDistribution
101  {
102  value 0.0025;
103  }
104  }
105 
106  // Geometry
107  position (-0.15 -0.1 0);
108  direction (1 0 0);
109  thetaInner 0;
110  thetaOuter 45;
111 
112  // - Inject at a point
113  injectionMethod point;
114 
116  //injectionMethod disc;
117  //dInner 0;
118  //dOuter 0.05;
119 
120  // Velocity
121 
122  // - Inject with constant velocity
123  flowType constantVelocity;
124  Umag 1;
125 
128  //flowType flowRateAndDischarge;
129  //Cd 0.9;
130 
132  //flowType pressureDrivenVelocity;
133  //Pinj 10e5;
134  }
135  }
136  \endverbatim
137 
138 SourceFiles
139  ConeInjection.C
140 
141 \*---------------------------------------------------------------------------*/
142 
143 #ifndef ConeInjection_H
144 #define ConeInjection_H
145 
146 #include "InjectionModel.H"
147 #include "distribution.H"
148 #include "TimeFunction1.H"
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 namespace Foam
153 {
154 
155 /*---------------------------------------------------------------------------*\
156  Class ConeInjection Declaration
157 \*---------------------------------------------------------------------------*/
158 
159 template<class CloudType>
160 class ConeInjection
161 :
162  public InjectionModel<CloudType>
163 {
164 public:
165 
166  //- Injection method enumeration
167  enum injectionMethod
168  {
169  imPoint,
170  imDisc
171  };
172 
173  //- Flow type enumeration
174  enum flowType
175  {
179  };
180 
181 
182 private:
183 
184  // Private Data
185 
186  //- Point/disc injection method
187  injectionMethod injectionMethod_;
188 
189  //- Flow type
190  flowType flowType_;
191 
192  //- Position of the injector
193  const TimeFunction1<vector> position_;
194 
195  //- Is the position constant?
196  const bool positionIsConstant_;
197 
198  //- Centreline direction in which to inject
199  const TimeFunction1<vector> direction_;
200 
201  //- Coordinates corresponding to the injector position
202  barycentric injectorCoordinates_;
203 
204  //- Cell label corresponding to the injector position
205  label injectorCell_;
206 
207  //- Tet-face label corresponding to the injector position
208  label injectorTetFace_;
209 
210  //- Tet-point label corresponding to the injector position
211  label injectorTetPt_;
212 
213  //- Injection duration [s]
214  const scalar duration_;
215 
216  //- Mass flow rate relative to SOI []
217  const TimeFunction1<scalar> massFlowRate_;
218 
219  //- Number of parcels to introduce per second
220  const TimeFunction1<scalar> parcelsPerSecond_;
221 
222  //- Inner half-cone angle relative to SOI [deg]
223  const TimeFunction1<scalar> thetaInner_;
224 
225  //- Outer half-cone angle relative to SOI [deg]
226  const TimeFunction1<scalar> thetaOuter_;
227 
228  //- Parcel size distribution model
229  const autoPtr<distribution> sizeDistribution_;
230 
231 
232  // Disc geometry
233 
234  //- The inner disc diameter [m]
235  scalar dInner_;
236 
237  //- The outer disc diameter [m]
238  scalar dOuter_;
239 
240 
241  // Velocity model coefficients
242 
243  //- Parcel velocity [m/s]
244  TimeFunction1<scalar> Umag_;
245 
246  //- Discharge coefficient []
248 
249  //- Injection pressure [Pa]
250  TimeFunction1<scalar> Pinj_;
251 
252 
253  // Private Member Functions
254 
255  //- Set the injection type
256  void setInjectionMethod();
257 
258  //- Set the injection flow type
259  void setFlowType();
260 
261 
262 public:
263 
264  //- Runtime type information
265  TypeName("coneInjection");
266 
267 
268  // Constructors
269 
270  //- Construct from dictionary
272  (
273  const dictionary& dict,
274  CloudType& owner,
275  const word& modelName
276  );
277 
278  //- Construct copy
280 
281  //- Construct and return a clone
283  {
285  (
286  new ConeInjection<CloudType>(*this)
287  );
288  }
289 
290 
291  //- Destructor
292  virtual ~ConeInjection();
293 
294 
295  // Member Functions
296 
297  //- Set injector locations when mesh is updated
298  virtual void topoChange();
299 
300  //- Return the end-of-injection time
301  scalar timeEnd() const;
302 
303  //- Number of parcels to introduce relative to SOI
304  virtual label nParcelsToInject(const scalar time0, const scalar time1);
305 
306  //- Parcel mass to introduce relative to SOI
307  virtual scalar massToInject(const scalar time0, const scalar time1);
308 
309 
310  // Injection geometry
311 
312  //- Set the injection position and owner cell, tetFace and tetPt
313  virtual void setPositionAndCell
314  (
315  const label parcelI,
316  const label nParcels,
317  const scalar time,
318  barycentric& coordinates,
319  label& celli,
320  label& tetFacei,
321  label& tetPti,
322  label& facei
323  );
324 
325  //- Set the parcel properties
326  virtual void setProperties
327  (
328  const label parcelI,
329  const label nParcels,
330  const scalar time,
331  typename CloudType::parcelType& parcel
332  );
333 
334  //- Flag to identify whether model fully describes the parcel
335  virtual bool fullyDescribed() const;
336 };
337 
338 
339 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340 
341 } // End namespace Foam
342 
343 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
344 
345 #ifdef NoRepository
346  #include "ConeInjection.C"
347 #endif
348 
349 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350 
351 #endif
352 
353 // ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
This injector injects particles in a number of cones. The user specifies a position and a direction t...
virtual ~ConeInjection()
Destructor.
virtual void topoChange()
Set injector locations when mesh is updated.
ConeInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
flowType
Flow type enumeration.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
injectionMethod
Injection method enumeration.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
TypeName("coneInjection")
Runtime type information.
virtual label nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
scalar timeEnd() const
Return the end-of-injection time.
virtual scalar massToInject(const scalar time0, const scalar time1)
Parcel mass to introduce relative to SOI.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
Definition: barycentric.H:45
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