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,
101  };
102 
104 
105  //- Flow type enumeration
106  enum class flowType
107  {
111  };
113  static const Enum<flowType> flowTypeNames;
114 
115 
116 private:
117 
118  // Private data
119 
120  //- Point/disc injection method
121  injectionMethod injectionMethod_;
122 
123  //- Flow type
124  flowType flowType_;
125 
126  //- Outer nozzle diameter [m]
127  const scalar outerDiameter_;
128 
129  //- Inner nozzle diameter [m]
130  const scalar innerDiameter_;
131 
132  //- Injection duration [s]
133  scalar duration_;
134 
135  //- Position relative to SOI []
136  autoPtr<Function1<vector>> positionVsTime_;
137 
138  //- Static injector - position [m]
139  vector position_;
140 
141  //- Static injector - cell containing injector position []
142  label injectorCell_;
143 
144  //- Static injector - index of tet face for injector cell
145  label tetFacei_;
146 
147  //- Static injector - index of tet point for injector cell
148  label tetPti_;
149 
150  //- Injector direction []
151  autoPtr<Function1<vector>> directionVsTime_;
152 
153  //- Cached direction vector
154  vector direction_;
155 
156  //- Swirl velocity (optional)
157  autoPtr<Function1<scalar>> omegaPtr_;
158 
159  //- Number of parcels to introduce per second []
160  const label parcelsPerSecond_;
161 
162  //- Flow rate profile relative to SOI []
163  autoPtr<Function1<scalar>> flowRateProfile_;
164 
165  //- Inner half-cone angle relative to SOI [deg]
166  autoPtr<Function1<scalar>> thetaInner_;
167 
168  //- Outer half-cone angle relative to SOI [deg]
169  autoPtr<Function1<scalar>> thetaOuter_;
170 
171  //- Parcel size PDF model
172  autoPtr<distributionModel> sizeDistribution_;
173 
174 
175  // Tangential vectors to the direction vector
176 
177  //- First tangential vector
178  vector tanVec1_;
179 
180  //- Second tangential vector
181  vector tanVec2_;
182 
183  //- Injection vector orthogonal to direction
184  vector normal_;
185 
186 
187  // Velocity model coefficients
188 
189  //- Constant velocity [m/s]
190  scalar UMag_;
191 
192  //- Discharge coefficient, relative to SOI [m/s]
194 
195  //- Injection pressure [Pa]
197 
198 
199  // Private Member Functions
200 
201  //- Set the injection position and direction
202  void setInjectionGeometry();
203 
204  //- Set the injection flow type
205  void setFlowType();
206 
207 
208 public:
209 
210  //- Runtime type information
211  TypeName("coneNozzleInjection");
212 
213 
214  // Constructors
215 
216  //- Construct from dictionary
218  (
219  const dictionary& dict,
220  CloudType& owner,
221  const word& modelName
222  );
223 
224  //- Construct copy
226 
227  //- Construct and return a clone
229  {
231  (
233  );
234  }
235 
236 
237  //- Destructor
238  virtual ~ConeNozzleInjection() = default;
239 
240 
241  // Member Functions
242 
243  //- Set injector locations when mesh is updated
244  virtual void updateMesh();
245 
246  //- Return the end-of-injection time
247  scalar timeEnd() const;
248 
249  //- Number of parcels to introduce relative to SOI
250  virtual label parcelsToInject(const scalar time0, const scalar time1);
251 
252  //- Volume of parcels to introduce relative to SOI
253  virtual scalar volumeToInject(const scalar time0, const scalar time1);
254 
255 
256  // Injection geometry
257 
258  //- Set the injection position and owner cell
259  virtual void setPositionAndCell
260  (
261  const label parcelI,
262  const label nParcels,
263  const scalar time,
264  vector& position,
265  label& cellOwner,
266  label& tetFacei,
267  label& tetPti
268  );
269 
270  //- Set the parcel properties
271  virtual void setProperties
272  (
273  const label parcelI,
274  const label nParcels,
275  const scalar time,
276  typename CloudType::parcelType& parcel
277  );
278 
279  //- Flag to identify whether model fully describes the parcel
280  virtual bool fullyDescribed() const;
281 
282  //- Return flag to identify whether or not injection of parcelI is
283  // permitted
284  virtual bool validInjection(const label parcelI);
285 };
286 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 } // End namespace Foam
291 
292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293 
294 #ifdef NoRepository
295  #include "ConeNozzleInjection.C"
296 #endif
297 
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299 
300 #endif
301 
302 // ************************************************************************* //
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
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.