CellZoneInjection.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::CellZoneInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Injection positions specified by a particle number density within a cell
34  set.
35 
36  User specifies:
37  - Number density of particles in cell set (effective)
38  - Total mass to inject
39  - Initial parcel velocity
40 
41  Properties:
42  - Parcel diameters obtained by PDF model
43  - All parcels introduced at SOI
44 
45 SourceFiles
46  CellZoneInjection.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef CellZoneInjection_H
51 #define CellZoneInjection_H
52 
53 #include "InjectionModel.H"
54 #include "distributionModel.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class CellZoneInjection Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class CloudType>
67 :
68  public InjectionModel<CloudType>
69 {
70  // Private data
71 
72  //- Name of cell zone
73  const word cellZoneName_;
74 
75  //- Number density
76  const scalar numberDensity_;
77 
78  //- Field of parcel positions
79  List<vector> positions_;
80 
81  //- List of cell labels corresponding to injector positions
82  labelList injectorCells_;
83 
84  //- List of tetFace labels corresponding to injector positions
85  labelList injectorTetFaces_;
86 
87  //- List of tetPt labels corresponding to injector positions
88  labelList injectorTetPts_;
89 
90  //- Field of parcel diameters
91  scalarList diameters_;
92 
93  //- Initial parcel velocity
94  const vector U0_;
95 
96  //- Parcel size distribution model
97  const autoPtr<distributionModel> sizeDistribution_;
98 
99 
100  // Private Member Functions
101 
102  //- Set the parcel injection positions
103  void setPositions(const labelList& cellZoneCells);
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("cellZoneInjection");
110 
111 
112  // Constructors
113 
114  //- Construct from dictionary
116  (
117  const dictionary& dict,
118  CloudType& owner,
119  const word& modelName
120  );
121 
122  //- Construct copy
124 
125  //- Construct and return a clone
127  {
129  (
131  );
132  }
133 
134 
135  //- Destructor
136  virtual ~CellZoneInjection();
137 
138 
139  // Member Functions
140 
141  //- Set injector locations when mesh is updated
142  virtual void updateMesh();
143 
144  //- Return the end-of-injection time
145  scalar timeEnd() const;
146 
147  //- Number of parcels to introduce relative to SOI
148  label parcelsToInject(const scalar time0, const scalar time1);
149 
150  //- Volume of parcels to introduce relative to SOI
151  scalar volumeToInject(const scalar time0, const scalar time1);
152 
153 
154  // Injection geometry
155 
156  //- Set the injection position and owner cell, tetFace and tetPt
157  virtual void setPositionAndCell
158  (
159  const label parcelI,
160  const label nParcels,
161  const scalar time,
162  vector& position,
163  label& cellOwner,
164  label& tetFacei,
165  label& tetPti
166  );
167 
168  //- Set the parcel properties
169  virtual void setProperties
170  (
171  const label parcelI,
172  const label nParcels,
173  const scalar time,
174  typename CloudType::parcelType& parcel
175  );
176 
177  //- Flag to identify whether model fully describes the parcel
178  virtual bool fullyDescribed() const;
179 
180  //- Return flag to identify whether or not injection of parcelI is
181  // permitted
182  virtual bool validInjection(const label parcelI);
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193  #include "CellZoneInjection.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
Foam::CellZoneInjection::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: CellZoneInjection.C:315
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::CellZoneInjection
Injection positions specified by a particle number density within a cell set.
Definition: CellZoneInjection.H:65
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::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::CellZoneInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: CellZoneInjection.C:273
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::CellZoneInjection::parcelsToInject
label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: CellZoneInjection.C:282
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::CellZoneInjection::~CellZoneInjection
virtual ~CellZoneInjection()
Destructor.
Definition: CellZoneInjection.C:217
Foam::CellZoneInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: CellZoneInjection.H:125
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::CellZoneInjection::CellZoneInjection
CellZoneInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: CellZoneInjection.C:168
Foam::CellZoneInjection::TypeName
TypeName("cellZoneInjection")
Runtime type information.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::CellZoneInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: CellZoneInjection.C:334
Foam::CellZoneInjection::volumeToInject
scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: CellZoneInjection.C:298
Foam::CellZoneInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: CellZoneInjection.C:224
Foam::Vector< scalar >
Foam::List< vector >
Foam::CellZoneInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: CellZoneInjection.C:357
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::CellZoneInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: CellZoneInjection.C:350
CellZoneInjection.C
distributionModel.H