ConeNozzleInjection.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  Copyright (C) 2018-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ConeNozzleInjection
29 
30 Group
31  grpLagrangianIntermediateInjectionSubModels
32 
33 Description
34  Cone injection.
35 
36  User specifies:
37  - time of start of injection
38  - injector position
39  - direction (along injection axis)
40  - parcel flow rate
41  - inner and outer half-cone angles
42 
43  Properties:
44  - Parcel diameters obtained by size distribution model.
45 
46  - Parcel velocity is calculated as:
47  - Constant velocity:
48  \verbatim
49  U = <specified by user>
50  \endverbatim
51 
52  - Pressure driven velocity:
53  \verbatim
54  U = sqrt(2*(Pinj - Pamb)/rho)
55  \endverbatim
56 
57  - Flow rate and discharge:
58  \verbatim
59  U = V_dot/(A*Cd)
60  \endverbatim
61 
62 SourceFiles
63  ConeNozzleInjection.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef ConeNozzleInjection_H
68 #define ConeNozzleInjection_H
69 
70 #include "InjectionModel.H"
71 #include "Enum.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 // Forward declaration of classes
79 
80 template<class Type>
81 class Function1;
82 
83 class distributionModel;
84 
85 /*---------------------------------------------------------------------------*\
86  Class ConeNozzleInjection Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class CloudType>
91 :
92  public InjectionModel<CloudType>
93 {
94 public:
95 
96  //- Injection method enumeration
97  enum class injectionMethod
98  {
99  imPoint,
100  imDisc,
101  imDiscSegments //<! Disc with angular segments
102  };
103 
105 
106  //- Flow type enumeration
107  enum class flowType
108  {
112  };
114  static const Enum<flowType> flowTypeNames;
115 
116 
117 private:
118 
119  // Private data
120 
121  //- Point/disc injection method
122  injectionMethod injectionMethod_;
123 
124  //- Flow type
125  flowType flowType_;
126 
127  //- Outer nozzle diameter [m]
128  const scalar outerDiameter_;
129 
130  //- Inner nozzle diameter [m]
131  const scalar innerDiameter_;
132 
133  //- Injection duration [s]
134  scalar duration_;
135 
136  //- Position relative to SOI []
137  autoPtr<Function1<vector>> positionVsTime_;
138 
139  //- Static injector - position [m]
140  vector position_;
141 
142  //- Static injector - cell containing injector position []
143  label injectorCell_;
144 
145  //- Static injector - index of tet face for injector cell
146  label tetFacei_;
147 
148  //- Static injector - index of tet point for injector cell
149  label tetPti_;
150 
151  //- Injector direction []
152  autoPtr<Function1<vector>> directionVsTime_;
153 
154  //- Cached direction vector
155  vector direction_;
156 
157  //- Swirl velocity (optional)
158  autoPtr<Function1<scalar>> omegaPtr_;
159 
160  //- Number of parcels to introduce per second []
161  const label parcelsPerSecond_;
162 
163  //- Flow rate profile relative to SOI []
164  autoPtr<Function1<scalar>> flowRateProfile_;
165 
166  //- Inner half-cone angle relative to SOI [deg]
167  autoPtr<Function1<scalar>> thetaInner_;
168 
169  //- Outer half-cone angle relative to SOI [deg]
170  autoPtr<Function1<scalar>> thetaOuter_;
171 
172  //- Parcel size PDF model
173  autoPtr<distributionModel> sizeDistribution_;
174 
175  //- Previous-time value
176  scalar t0_;
177 
178  //- Number of injectors in angular-segmented disc
179  label nInjectors_;
180 
181  //- Estimated speed of the moving injector
182  vector Uinjector_;
183 
184  //- Initial injector direction
185  vector initialInjectorDir_;
186 
187 
188  // Tangential vectors to the direction vector
189 
190  //- First tangential vector
191  vector tanVec1_;
192 
193  //- Second tangential vector
194  vector tanVec2_;
195 
196  //- Injection vector orthogonal to direction
197  vector normal_;
198 
199 
200  // Velocity model coefficients
201 
202  //- Constant velocity [m/s]
203  scalar UMag_;
204 
205  //- Discharge coefficient, relative to SOI [m/s]
207 
208  //- Injection pressure [Pa]
210 
211 
212  // Private Member Functions
213 
214  //- Set the injection position and direction
215  void setInjectionGeometry();
216 
217  //- Set the injection flow type
218  void setFlowType();
219 
220 
221 public:
222 
223  //- Runtime type information
224  TypeName("coneNozzleInjection");
225 
226 
227  // Constructors
228 
229  //- Construct from dictionary
231  (
232  const dictionary& dict,
233  CloudType& owner,
234  const word& modelName
235  );
236 
237  //- Construct copy
239 
240  //- Construct and return a clone
242  {
244  (
246  );
247  }
248 
249 
250  //- Destructor
251  virtual ~ConeNozzleInjection() = default;
252 
253 
254  // Member Functions
255 
256  //- Set injector locations when mesh is updated
257  virtual void updateMesh();
258 
259  //- Return the end-of-injection time
260  scalar timeEnd() const;
261 
262  //- Number of parcels to introduce relative to SOI
263  virtual label parcelsToInject(const scalar time0, const scalar time1);
264 
265  //- Volume of parcels to introduce relative to SOI
266  virtual scalar volumeToInject(const scalar time0, const scalar time1);
267 
268 
269  // Injection geometry
270 
271  //- Set the injection position and owner cell
272  virtual void setPositionAndCell
273  (
274  const label parcelI,
275  const label nParcels,
276  const scalar time,
277  vector& position,
278  label& cellOwner,
279  label& tetFacei,
280  label& tetPti
281  );
282 
283  //- Set the parcel properties
284  virtual void setProperties
285  (
286  const label parcelI,
287  const label nParcels,
288  const scalar time,
289  typename CloudType::parcelType& parcel
290  );
291 
292  //- Flag to identify whether model fully describes the parcel
293  virtual bool fullyDescribed() const;
294 
295  //- Return flag to identify whether or not injection of parcelI is
296  // permitted
297  virtual bool validInjection(const label parcelI);
298 
299 
300  // I-O
301 
302  //- Write injection info
303  virtual void info();
304 };
305 
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 } // End namespace Foam
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 #ifdef NoRepository
314  #include "ConeNozzleInjection.C"
315 #endif
316 
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 
319 #endif
320 
321 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Templated injection model class.
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.
static const Enum< flowType > flowTypeNames
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
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
const CloudType & owner() const
Return const access to the owner cloud.
injectionMethod
Injection method enumeration.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void info()
Write injection info.
flowType
Flow type enumeration.
TypeName("coneNozzleInjection")
Runtime type information.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
virtual ~ConeNozzleInjection()=default
Destructor.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
scalar timeEnd() const
Return the end-of-injection time.
virtual void updateMesh()
Set injector locations when mesh is updated.
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
static const Enum< injectionMethod > injectionMethodNames
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Namespace for OpenFOAM.