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 "Function1.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 autoPtr<Function1<vector>> position_;
194 
195  //- Centreline direction in which to inject
196  const autoPtr<Function1<vector>> direction_;
197 
198  //- Coordinates corresponding to the injector position
199  barycentric injectorCoordinates_;
200 
201  //- Cell label corresponding to the injector position
202  label injectorCell_;
203 
204  //- Tet-face label corresponding to the injector position
205  label injectorTetFace_;
206 
207  //- Tet-point label corresponding to the injector position
208  label injectorTetPt_;
209 
210  //- Injection duration [s]
211  const scalar duration_;
212 
213  //- Mass flow rate relative to SOI []
214  const autoPtr<Function1<scalar>> massFlowRate_;
215 
216  //- Number of parcels to introduce per second
217  const autoPtr<Function1<scalar>> parcelsPerSecond_;
218 
219  //- Inner half-cone angle relative to SOI [deg]
220  const autoPtr<Function1<scalar>> thetaInner_;
221 
222  //- Outer half-cone angle relative to SOI [deg]
223  const autoPtr<Function1<scalar>> thetaOuter_;
224 
225  //- Parcel size distribution model
226  const autoPtr<distribution> sizeDistribution_;
227 
228 
229  // Disc geometry
230 
231  //- The inner disc diameter [m]
232  scalar dInner_;
233 
234  //- The outer disc diameter [m]
235  scalar dOuter_;
236 
237 
238  // Velocity model coefficients
239 
240  //- Parcel velocity [m/s]
242 
243  //- Discharge coefficient []
245 
246  //- Injection pressure [Pa]
248 
249 
250  // Private Member Functions
251 
252  //- Set the injection type
253  void setInjectionMethod();
254 
255  //- Set the injection flow type
256  void setFlowType();
257 
258 
259 public:
260 
261  //- Runtime type information
262  TypeName("coneInjection");
263 
264 
265  // Constructors
266 
267  //- Construct from dictionary
269  (
270  const dictionary& dict,
271  CloudType& owner,
272  const word& modelName
273  );
274 
275  //- Construct copy
277 
278  //- Construct and return a clone
280  {
282  (
283  new ConeInjection<CloudType>(*this)
284  );
285  }
286 
287 
288  //- Destructor
289  virtual ~ConeInjection();
290 
291 
292  // Member Functions
293 
294  //- Set injector locations when mesh is updated
295  virtual void topoChange();
296 
297  //- Return the end-of-injection time
298  scalar timeEnd() const;
299 
300  //- Number of parcels to introduce relative to SOI
301  virtual label nParcelsToInject(const scalar time0, const scalar time1);
302 
303  //- Parcel mass to introduce relative to SOI
304  virtual scalar massToInject(const scalar time0, const scalar time1);
305 
306 
307  // Injection geometry
308 
309  //- Set the injection position and owner cell, tetFace and tetPt
310  virtual void setPositionAndCell
311  (
312  const label parcelI,
313  const label nParcels,
314  const scalar time,
315  barycentric& coordinates,
316  label& celli,
317  label& tetFacei,
318  label& tetPti,
319  label& facei
320  );
321 
322  //- Set the parcel properties
323  virtual void setProperties
324  (
325  const label parcelI,
326  const label nParcels,
327  const scalar time,
328  typename CloudType::parcelType::trackingData& td,
329  typename CloudType::parcelType& parcel
330  );
331 
332  //- Flag to identify whether model fully describes the parcel
333  virtual bool fullyDescribed() const;
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 // ************************************************************************* //
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.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType::trackingData &td, typename CloudType::parcelType &parcel)
Set the parcel properties.
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 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:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
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:162
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