ConeInjection.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::ConeInjection
26 
27 Description
28  Multi-point cone injection model.
29 
30  User specifies:
31  - time of start of injection
32  - list of injector positions and directions (along injection axes)
33  - number of parcels to inject per injector
34  - parcel velocities
35  - inner and outer half-cone angles
36 
37  Properties:
38  - Parcel diameters obtained by distribution model
39 
40 SourceFiles
41  ConeInjection.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef ConeInjection_H
46 #define ConeInjection_H
47 
48 #include "InjectionModel.H"
49 #include "distributionModel.H"
50 #include "vectorList.H"
51 #include "TimeFunction1.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class ConeInjection Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class CloudType>
63 class ConeInjection
64 :
65  public InjectionModel<CloudType>
66 {
67  // Private data
68 
69  //- List of position and axis for each injector
70  List<Tuple2<vector, vector>> positionAxis_;
71 
72  //- List of cell labels corresponding to injector positions
73  labelList injectorCells_;
74 
75  //- List of tetFace labels corresponding to injector positions
76  labelList injectorTetFaces_;
77 
78  //- List of tetPt labels corresponding to injector positions
79  labelList injectorTetPts_;
80 
81  //- Injection duration [s]
82  scalar duration_;
83 
84  //- Number of parcels to introduce per injector
85  const label parcelsPerInjector_;
86 
87  //- Flow rate profile relative to SOI []
88  const TimeFunction1<scalar> flowRateProfile_;
89 
90  //- Parcel velocity magnitude relative to SOI [m/s]
91  const TimeFunction1<scalar> Umag_;
92 
93  //- Inner half-cone angle relative to SOI [deg]
94  const TimeFunction1<scalar> thetaInner_;
95 
96  //- Outer half-cone angle relative to SOI [deg]
97  const TimeFunction1<scalar> thetaOuter_;
98 
99  //- Parcel size distribution model
100  const autoPtr<distributionModel> sizeDistribution_;
101 
102  //- Number of parcels per injector already injected
103  mutable label nInjected_;
104 
105 
106  // Tangential vectors to the direction vector
107 
108  //- First tangential vector
109  vectorList tanVec1_;
110 
111  //- Second tangential vector
112  vectorList tanVec2_;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("coneInjection");
119 
120 
121  // Constructors
122 
123  //- Construct from dictionary
125  (
126  const dictionary& dict,
127  CloudType& owner,
128  const word& modelName
129  );
130 
131  //- Construct copy
133 
134  //- Construct and return a clone
136  {
138  (
139  new ConeInjection<CloudType>(*this)
140  );
141  }
142 
143 
144  //- Destructor
145  virtual ~ConeInjection();
146 
147 
148  // Member Functions
149 
150  //- Set injector locations when mesh is updated
151  virtual void updateMesh();
152 
153  //- Return the end-of-injection time
154  scalar timeEnd() const;
155 
156  //- Number of parcels to introduce relative to SOI
157  virtual label parcelsToInject(const scalar time0, const scalar time1);
158 
159  //- Volume of parcels to introduce relative to SOI
160  virtual scalar volumeToInject(const scalar time0, const scalar time1);
161 
162 
163 
164  // Injection geometry
165 
166  //- Set the injection position and owner cell, tetFace and tetPt
167  virtual void setPositionAndCell
168  (
169  const label parcelI,
170  const label nParcels,
171  const scalar time,
172  vector& position,
173  label& cellOwner,
174  label& tetFacei,
175  label& tetPti
176  );
177 
178  //- Set the parcel properties
179  virtual void setProperties
180  (
181  const label parcelI,
182  const label nParcels,
183  const scalar time,
184  typename CloudType::parcelType& parcel
185  );
186 
187  //- Flag to identify whether model fully describes the parcel
188  virtual bool fullyDescribed() const;
189 
190  //- Return flag to identify whether or not injection of parcelI is
191  // permitted
192  virtual bool validInjection(const label parcelI);
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #ifdef NoRepository
203  #include "ConeInjection.C"
204 #endif
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
ConeInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ConeInjection.C:37
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
Templated injection model class.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
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, tetFace and tetPt.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
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
const CloudType & owner() const
Return const access to the owner cloud.
TypeName("coneInjection")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
scalar timeEnd() const
Return the end-of-injection time.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
virtual ~ConeInjection()
Destructor.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Namespace for OpenFOAM.
Multi-point cone injection model.
Definition: ConeInjection.H:62