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 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 TimeFunction1;
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,
102  };
103 
105 
106  //- Flow type enumeration
107  enum class flowType
108  {
112  };
113 
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  TimeFunction1<vector> positionVsTime_;
138 
139  //- Injector position [m]
140  vector position_;
141 
142  //- Cell containing injector position []
143  label injectorCell_;
144 
145  //- Index of tet face for injector cell
146  label tetFacei_;
147 
148  //- Index of tet point for injector cell
149  label tetPti_;
150 
151  //- Injector direction []
152  vector direction_;
153 
154  //- Number of parcels to introduce per second []
155  const label parcelsPerSecond_;
156 
157  //- Flow rate profile relative to SOI []
158  const TimeFunction1<scalar> flowRateProfile_;
159 
160  //- Inner half-cone angle relative to SOI [deg]
161  const TimeFunction1<scalar> thetaInner_;
162 
163  //- Outer half-cone angle relative to SOI [deg]
164  const TimeFunction1<scalar> thetaOuter_;
165 
166  //- Parcel size PDF model
167  const autoPtr<distributionModel> sizeDistribution_;
168 
169 
170  // Tangential vectors to the direction vector
171 
172  //- First tangential vector
173  vector tanVec1_;
174 
175  //- Second tangential vector
176  vector tanVec2_;
177 
178  //- Injection vector orthogonal to direction
179  vector normal_;
180 
181 
182  // Velocity model coefficients
183 
184  //- Constant velocity [m/s]
185  scalar UMag_;
186 
187  //- Discharge coefficient, relative to SOI [m/s]
189 
190  //- Injection pressure [Pa]
191  TimeFunction1<scalar> Pinj_;
192 
193 
194  // Private Member Functions
195 
196  //- Set the injection type
197  void setInjectionMethod();
198 
199  //- Set the injection flow type
200  void setFlowType();
201 
202 
203 public:
204 
205  //- Runtime type information
206  TypeName("coneNozzleInjection");
207 
208 
209  // Constructors
210 
211  //- Construct from dictionary
213  (
214  const dictionary& dict,
215  CloudType& owner,
216  const word& modelName
217  );
218 
219  //- Construct copy
221 
222  //- Construct and return a clone
224  {
226  (
228  );
229  }
230 
231 
232  //- Destructor
233  virtual ~ConeNozzleInjection();
234 
235 
236  // Member Functions
237 
238  //- Set injector locations when mesh is updated
239  virtual void updateMesh();
240 
241  //- Return the end-of-injection time
242  scalar timeEnd() const;
243 
244  //- Number of parcels to introduce relative to SOI
245  virtual label parcelsToInject(const scalar time0, const scalar time1);
246 
247  //- Volume of parcels to introduce relative to SOI
248  virtual scalar volumeToInject(const scalar time0, const scalar time1);
249 
250 
251  // Injection geometry
252 
253  //- Set the injection position and owner cell
254  virtual void setPositionAndCell
255  (
256  const label parcelI,
257  const label nParcels,
258  const scalar time,
259  vector& position,
260  label& cellOwner,
261  label& tetFacei,
262  label& tetPti
263  );
264 
265  //- Set the parcel properties
266  virtual void setProperties
267  (
268  const label parcelI,
269  const label nParcels,
270  const scalar time,
271  typename CloudType::parcelType& parcel
272  );
273 
274  //- Flag to identify whether model fully describes the parcel
275  virtual bool fullyDescribed() const;
276 
277  //- Return flag to identify whether or not injection of parcelI is
278  // permitted
279  virtual bool validInjection(const label parcelI);
280 };
281 
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 } // End namespace Foam
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #ifdef NoRepository
290  #include "ConeNozzleInjection.C"
291 #endif
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 
295 #endif
296 
297 // ************************************************************************* //
Foam::ConeNozzleInjection::injectionMethod
injectionMethod
Injection method enumeration.
Definition: ConeNozzleInjection.H:96
Foam::ConeNozzleInjection::TypeName
TypeName("coneNozzleInjection")
Runtime type information.
Foam::Enum< injectionMethod >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ConeNozzleInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ConeNozzleInjection.C:309
Foam::ConeNozzleInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ConeNozzleInjection.C:484
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::TimeFunction1
Light wrapper around Function1 to provide a mechanism to update time-based entries.
Definition: ConeNozzleInjection.H:80
Foam::distributionModel
A library of runtime-selectable distribution models.
Definition: distributionModel.H:70
Foam::ConeNozzleInjection::flowType::ftConstantVelocity
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::ConeNozzleInjection::flowType::ftPressureDrivenVelocity
Foam::ConeNozzleInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: ConeNozzleInjection.C:325
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::ConeNozzleInjection::injectionMethodNames
static const Enum< injectionMethod > injectionMethodNames
Definition: ConeNozzleInjection.H:103
Foam::ConeNozzleInjection::flowTypeNames
static const Enum< flowType > flowTypeNames
Definition: ConeNozzleInjection.H:113
Foam::ConeNozzleInjection::injectionMethod::imDisc
Foam::ConeNozzleInjection::ConeNozzleInjection
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ConeNozzleInjection.C:126
Foam::ConeNozzleInjection
Cone injection.
Definition: ConeNozzleInjection.H:89
Foam::ConeNozzleInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ConeNozzleInjection.C:275
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ConeNozzleInjection::injectionMethod::imPoint
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::ConeNozzleInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: ConeNozzleInjection.C:301
Foam::Vector< scalar >
Foam::ConeNozzleInjection::flowType::ftFlowRateAndDischarge
Foam::ConeNozzleInjection::flowType
flowType
Flow type enumeration.
Definition: ConeNozzleInjection.H:106
Foam::ConeNozzleInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: ConeNozzleInjection.C:411
Foam::ConeNozzleInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ConeNozzleInjection.C:477
ConeNozzleInjection.C
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::ConeNozzleInjection::injectionMethod::imMovingPoint
Foam::ConeNozzleInjection::~ConeNozzleInjection
virtual ~ConeNozzleInjection()
Destructor.
Definition: ConeNozzleInjection.C:268
Foam::ConeNozzleInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: ConeNozzleInjection.H:222
Foam::ConeNozzleInjection::setPositionAndCell
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.
Definition: ConeNozzleInjection.C:341
Enum.H