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  };
102 
104 
105  //- Flow type enumeration
106  enum class flowType
107  {
111  };
112 
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  //- Number of parcels to introduce per second []
157  const label parcelsPerSecond_;
158 
159  //- Flow rate profile relative to SOI []
160  autoPtr<Function1<scalar>> flowRateProfile_;
161 
162  //- Inner half-cone angle relative to SOI [deg]
163  autoPtr<Function1<scalar>> thetaInner_;
164 
165  //- Outer half-cone angle relative to SOI [deg]
166  autoPtr<Function1<scalar>> thetaOuter_;
167 
168  //- Parcel size PDF model
169  autoPtr<distributionModel> sizeDistribution_;
170 
171 
172  // Tangential vectors to the direction vector
173 
174  //- First tangential vector
175  vector tanVec1_;
176 
177  //- Second tangential vector
178  vector tanVec2_;
179 
180  //- Injection vector orthogonal to direction
181  vector normal_;
182 
183 
184  // Velocity model coefficients
185 
186  //- Constant velocity [m/s]
187  scalar UMag_;
188 
189  //- Discharge coefficient, relative to SOI [m/s]
191 
192  //- Injection pressure [Pa]
194 
195 
196  // Private Member Functions
197 
198  //- Set the injection position and direction
199  void setInjectionGeometry();
200 
201  //- Set the injection flow type
202  void setFlowType();
203 
204 
205 public:
206 
207  //- Runtime type information
208  TypeName("coneNozzleInjection");
209 
210 
211  // Constructors
212 
213  //- Construct from dictionary
215  (
216  const dictionary& dict,
217  CloudType& owner,
218  const word& modelName
219  );
220 
221  //- Construct copy
223 
224  //- Construct and return a clone
226  {
228  (
230  );
231  }
232 
233 
234  //- Destructor
235  virtual ~ConeNozzleInjection() = default;
236 
237 
238  // Member Functions
239 
240  //- Set injector locations when mesh is updated
241  virtual void updateMesh();
242 
243  //- Return the end-of-injection time
244  scalar timeEnd() const;
245 
246  //- Number of parcels to introduce relative to SOI
247  virtual label parcelsToInject(const scalar time0, const scalar time1);
248 
249  //- Volume of parcels to introduce relative to SOI
250  virtual scalar volumeToInject(const scalar time0, const scalar time1);
251 
252 
253  // Injection geometry
254 
255  //- Set the injection position and owner cell
256  virtual void setPositionAndCell
257  (
258  const label parcelI,
259  const label nParcels,
260  const scalar time,
261  vector& position,
262  label& cellOwner,
263  label& tetFacei,
264  label& tetPti
265  );
266 
267  //- Set the parcel properties
268  virtual void setProperties
269  (
270  const label parcelI,
271  const label nParcels,
272  const scalar time,
273  typename CloudType::parcelType& parcel
274  );
275 
276  //- Flag to identify whether model fully describes the parcel
277  virtual bool fullyDescribed() const;
278 
279  //- Return flag to identify whether or not injection of parcelI is
280  // permitted
281  virtual bool validInjection(const label parcelI);
282 };
283 
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 } // End namespace Foam
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 #ifdef NoRepository
292  #include "ConeNozzleInjection.C"
293 #endif
294 
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 
297 #endif
298 
299 // ************************************************************************* //
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:65
Foam::ConeNozzleInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ConeNozzleInjection.C:324
Foam::ConeNozzleInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ConeNozzleInjection.C:521
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
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:340
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:102
Foam::ConeNozzleInjection::flowTypeNames
static const Enum< flowType > flowTypeNames
Definition: ConeNozzleInjection.H:112
Foam::ConeNozzleInjection::injectionMethod::imDisc
Foam::ConeNozzleInjection::ConeNozzleInjection
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ConeNozzleInjection.C:167
Foam::ConeNozzleInjection
Cone injection.
Definition: ConeNozzleInjection.H:89
Foam::ConeNozzleInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ConeNozzleInjection.C:297
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:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ConeNozzleInjection::injectionMethod::imPoint
Foam::ConeNozzleInjection::~ConeNozzleInjection
virtual ~ConeNozzleInjection()=default
Destructor.
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:316
Foam::Vector< scalar >
Foam::ConeNozzleInjection::flowType::ftFlowRateAndDischarge
Foam::ConeNozzleInjection::flowType
flowType
Flow type enumeration.
Definition: ConeNozzleInjection.H:105
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:448
Foam::ConeNozzleInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ConeNozzleInjection.C:514
ConeNozzleInjection.C
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::ConeNozzleInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: ConeNozzleInjection.H:224
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:356
Enum.H