ConeInjection.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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::ConeInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Multi-point cone injection model.
34 
35  User specifies:
36  - time of start of injection
37  - list of injector positions and directions (along injection axes)
38  - number of parcels to inject per injector
39  - parcel velocities
40  - inner and outer half-cone angles
41 
42  Properties:
43  - Parcel diameters obtained by distribution model
44 
45 SourceFiles
46  ConeInjection.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef ConeInjection_H
51 #define ConeInjection_H
52 
53 #include "InjectionModel.H"
54 #include "distributionModel.H"
55 #include "vectorList.H"
56 #include "TimeFunction1.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class ConeInjection Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 template<class CloudType>
68 class ConeInjection
69 :
70  public InjectionModel<CloudType>
71 {
72  // Private data
73 
74  //- List of position and axis for each injector
75  List<Tuple2<vector, vector>> positionAxis_;
76 
77  //- List of cell labels corresponding to injector positions
78  labelList injectorCells_;
79 
80  //- List of tetFace labels corresponding to injector positions
81  labelList injectorTetFaces_;
82 
83  //- List of tetPt labels corresponding to injector positions
84  labelList injectorTetPts_;
85 
86  //- Injection duration [s]
87  scalar duration_;
88 
89  //- Number of parcels to introduce per injector
90  const label parcelsPerInjector_;
91 
92  //- Flow rate profile relative to SOI []
93  const TimeFunction1<scalar> flowRateProfile_;
94 
95  //- Parcel velocity magnitude relative to SOI [m/s]
96  const TimeFunction1<scalar> Umag_;
97 
98  //- Inner half-cone angle relative to SOI [deg]
99  const TimeFunction1<scalar> thetaInner_;
100 
101  //- Outer half-cone angle relative to SOI [deg]
102  const TimeFunction1<scalar> thetaOuter_;
103 
104  //- Parcel size distribution model
105  const autoPtr<distributionModel> sizeDistribution_;
106 
107  //- Number of parcels per injector already injected
108  mutable label nInjected_;
109 
110 
111  // Tangential vectors to the direction vector
112 
113  //- First tangential vector
114  vectorList tanVec1_;
115 
116  //- Second tangential vector
117  vectorList tanVec2_;
118 
119 
120 public:
121 
122  //- Runtime type information
123  TypeName("coneInjection");
124 
125 
126  // Constructors
127 
128  //- Construct from dictionary
130  (
131  const dictionary& dict,
132  CloudType& owner,
133  const word& modelName
134  );
135 
136  //- Construct copy
138 
139  //- Construct and return a clone
141  {
143  (
144  new ConeInjection<CloudType>(*this)
145  );
146  }
147 
148 
149  //- Destructor
150  virtual ~ConeInjection() = default;
151 
152 
153  // Member Functions
154 
155  //- Set injector locations when mesh is updated
156  virtual void updateMesh();
157 
158  //- Return the end-of-injection time
159  scalar timeEnd() const;
160 
161  //- Number of parcels to introduce relative to SOI
162  virtual label parcelsToInject(const scalar time0, const scalar time1);
163 
164  //- Volume of parcels to introduce relative to SOI
165  virtual scalar volumeToInject(const scalar time0, const scalar time1);
166 
167 
168 
169  // Injection geometry
170 
171  //- Set the injection position and owner cell, tetFace and tetPt
172  virtual void setPositionAndCell
173  (
174  const label parcelI,
175  const label nParcels,
176  const scalar time,
177  vector& position,
178  label& cellOwner,
179  label& tetFacei,
180  label& tetPti
181  );
182 
183  //- Set the parcel properties
184  virtual void setProperties
185  (
186  const label parcelI,
187  const label nParcels,
188  const scalar time,
189  typename CloudType::parcelType& parcel
190  );
191 
192  //- Flag to identify whether model fully describes the parcel
193  virtual bool fullyDescribed() const;
194 
195  //- Return flag to identify whether or not injection of parcelI is
196  // permitted
197  virtual bool validInjection(const label parcelI);
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #ifdef NoRepository
208  #include "ConeInjection.C"
209 #endif
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
ConeInjection.C
vectorList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ConeInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ConeInjection.C:318
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::TimeFunction1< scalar >
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::ConeInjection::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, tetFace and tetPt.
Definition: ConeInjection.C:253
Foam::ConeInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: ConeInjection.C:237
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::ConeInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ConeInjection.C:311
Foam::ConeInjection::ConeInjection
ConeInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ConeInjection.C:40
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::ConeInjection::TypeName
TypeName("coneInjection")
Runtime type information.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::ConeInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ConeInjection.C:214
Foam::ConeInjection
Multi-point cone injection model.
Definition: ConeInjection.H:67
Foam::Vector< scalar >
Foam::ConeInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: ConeInjection.C:274
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::ConeInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ConeInjection.C:165
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::ConeInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: ConeInjection.H:139
TimeFunction1.H
Foam::ConeInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: ConeInjection.C:206
distributionModel.H
Foam::ConeInjection::~ConeInjection
virtual ~ConeInjection()=default
Destructor.