ConeNozzleInjection.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-2018 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::ConeNozzleInjection
26 
27 Description
28  Cone injection.
29 
30  User specifies:
31  - time of start of injection
32  - injector position
33  - direction (along injection axis)
34  - parcel flow rate
35  - inner and outer half-cone angles
36 
37  Properties:
38  - Parcel diameters obtained by size distribution model.
39 
40  - Parcel velocity is calculated as:
41  - Constant velocity:
42  \verbatim
43  U = <specified by user>
44  \endverbatim
45 
46  - Pressure driven velocity:
47  \verbatim
48  U = sqrt(2*(Pinj - Pamb)/rho)
49  \endverbatim
50 
51  - Flow rate and discharge:
52  \verbatim
53  U = V_dot/(A*Cd)
54  \endverbatim
55 
56 SourceFiles
57  ConeNozzleInjection.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef ConeNozzleInjection_H
62 #define ConeNozzleInjection_H
63 
64 #include "InjectionModel.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 // Forward declaration of classes
72 
73 template<class Type>
74 class TimeFunction1;
75 
76 class distributionModel;
77 
78 /*---------------------------------------------------------------------------*\
79  Class ConeNozzleInjection Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 template<class CloudType>
84 :
85  public InjectionModel<CloudType>
86 {
87 public:
88 
89  //- Injection method enumeration
90  enum injectionMethod
91  {
93  imDisc
94  };
95 
96  //- Flow type enumeration
97  enum flowType
98  {
102  };
103 
104 
105 private:
106 
107  // Private data
108 
109  //- Point/disc injection method
110  injectionMethod injectionMethod_;
111 
112  //- Flow type
113  flowType flowType_;
114 
115  //- Outer nozzle diameter [m]
116  const scalar outerDiameter_;
117 
118  //- Inner nozzle diameter [m]
119  const scalar innerDiameter_;
120 
121  //- Injection duration [s]
122  scalar duration_;
123 
124  //- Injector position [m]
125  vector position_;
126 
127  //- Cell containing injector position []
128  label injectorCell_;
129 
130  //- Index of tet face for injector cell
131  label tetFacei_;
132 
133  //- Index of tet point for injector cell
134  label tetPti_;
135 
136  //- Injector direction []
137  vector direction_;
138 
139  //- Number of parcels to introduce per second []
140  const label parcelsPerSecond_;
141 
142  //- Flow rate profile relative to SOI []
143  const TimeFunction1<scalar> flowRateProfile_;
144 
145  //- Inner half-cone angle relative to SOI [deg]
146  const TimeFunction1<scalar> thetaInner_;
147 
148  //- Outer half-cone angle relative to SOI [deg]
149  const TimeFunction1<scalar> thetaOuter_;
150 
151  //- Parcel size PDF model
152  const autoPtr<distributionModel> sizeDistribution_;
153 
154 
155  // Tangential vectors to the direction vector
156 
157  //- First tangential vector
158  vector tanVec1_;
159 
160  //- Second tangential vector
161  vector tanVec2_;
162 
163  //- Injection vector orthogonal to direction
164  vector normal_;
165 
166 
167  // Velocity model coefficients
168 
169  //- Constant velocity [m/s]
170  scalar UMag_;
171 
172  //- Discharge coefficient, relative to SOI [m/s]
174 
175  //- Injection pressure [Pa]
176  TimeFunction1<scalar> Pinj_;
177 
178 
179  // Private Member Functions
180 
181  //- Set the injection type
182  void setInjectionMethod();
183 
184  //- Set the injection flow type
185  void setFlowType();
186 
187 
188 public:
189 
190  //- Runtime type information
191  TypeName("coneNozzleInjection");
192 
193 
194  // Constructors
195 
196  //- Construct from dictionary
198  (
199  const dictionary& dict,
200  CloudType& owner,
201  const word& modelName
202  );
203 
204  //- Construct copy
206 
207  //- Construct and return a clone
209  {
211  (
213  );
214  }
215 
216 
217  //- Destructor
218  virtual ~ConeNozzleInjection();
219 
220 
221  // Member Functions
222 
223  //- Set injector locations when mesh is updated
224  virtual void updateMesh();
225 
226  //- Return the end-of-injection time
227  scalar timeEnd() const;
228 
229  //- Number of parcels to introduce relative to SOI
230  virtual label parcelsToInject(const scalar time0, const scalar time1);
231 
232  //- Volume of parcels to introduce relative to SOI
233  virtual scalar volumeToInject(const scalar time0, const scalar time1);
234 
235 
236  // Injection geometry
237 
238  //- Set the injection position and owner cell
239  virtual void setPositionAndCell
240  (
241  const label parcelI,
242  const label nParcels,
243  const scalar time,
244  vector& position,
245  label& cellOwner,
246  label& tetFacei,
247  label& tetPti
248  );
249 
250  //- Set the parcel properties
251  virtual void setProperties
252  (
253  const label parcelI,
254  const label nParcels,
255  const scalar time,
256  typename CloudType::parcelType& parcel
257  );
258 
259  //- Flag to identify whether model fully describes the parcel
260  virtual bool fullyDescribed() const;
261 
262  //- Return flag to identify whether or not injection of parcelI is
263  // permitted
264  virtual bool validInjection(const label parcelI);
265 };
266 
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 } // End namespace Foam
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 #ifdef NoRepository
275  #include "ConeNozzleInjection.C"
276 #endif
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 #endif
281 
282 // ************************************************************************* //
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
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
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
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
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 string.
Definition: word.H:59
Light wrapper around Function1 to provide a mechanism to update time-based entries.
flowType
Flow type enumeration.
TypeName("coneNozzleInjection")
Runtime type information.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
scalar timeEnd() const
Return the end-of-injection time.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual ~ConeNozzleInjection()
Destructor.
A library of runtime-selectable distribution models.
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Namespace for OpenFOAM.