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