CellZoneInjection.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-2024 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::CellZoneInjection
26 
27 Description
28  Injection positions specified by a particle number density within a cell
29  set.
30 
31  User specifies:
32  - Number density of particles in cell set (effective)
33  - Initial parcel velocity
34 
35  Properties:
36  - Parcel diameters obtained by PDF model
37  - All parcels introduced at SOI
38 
39 SourceFiles
40  CellZoneInjection.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef CellZoneInjection_H
45 #define CellZoneInjection_H
46 
47 #include "InjectionModel.H"
48 #include "distribution.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class CellZoneInjection Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class CloudType>
61 :
62  public InjectionModel<CloudType>
63 {
64  // Private Data
65 
66  //- Name of cell zone
67  const word cellZoneName_;
68 
69  //- Mass to inject
70  const scalar massTotal_;
71 
72  //- Number density
73  const scalar numberDensity_;
74 
75  //- Field of parcel coordinates
76  List<barycentric> injectorCoordinates_;
77 
78  //- List of cell labels corresponding to injector coordinates
79  labelList injectorCells_;
80 
81  //- List of tetFace labels corresponding to injector coordinates
82  labelList injectorTetFaces_;
83 
84  //- List of tetPt labels corresponding to injector coordinates
85  labelList injectorTetPts_;
86 
87  //- Field of parcel diameters
88  scalarList diameters_;
89 
90  //- Initial parcel velocity
91  const vector U0_;
92 
93  //- Parcel size distribution model
94  const autoPtr<distribution> sizeDistribution_;
95 
96 
97  // Private Member Functions
98 
99  //- Set the parcel injection positions
100  void setPositions(const labelList& cellZoneCells);
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("cellZoneInjection");
107 
108 
109  // Constructors
110 
111  //- Construct from dictionary
113  (
114  const dictionary& dict,
115  CloudType& owner,
116  const word& modelName
117  );
118 
119  //- Construct copy
121 
122  //- Construct and return a clone
124  {
126  (
128  );
129  }
130 
131 
132  //- Destructor
133  virtual ~CellZoneInjection();
134 
135 
136  // Member Functions
137 
138  //- Set injector locations when mesh is updated
139  virtual void topoChange();
140 
141  //- Return the end-of-injection time
142  virtual scalar timeEnd() const;
143 
144  //- Number of parcels to introduce relative to SOI
145  virtual scalar nParcelsToInject(const scalar time0, const scalar time1);
146 
147  //- Parcel mass to introduce relative to SOI
148  virtual scalar massToInject(const scalar time0, const scalar time1);
149 
150 
151  // Injection geometry
152 
153  //- Set the injection position and owner cell, tetFace and tetPt
154  virtual void setPositionAndCell
155  (
156  const label parcelI,
157  const label nParcels,
158  const scalar time,
160  label& celli,
161  label& tetFacei,
162  label& tetPti,
163  label& facei
164  );
165 
166  //- Set the parcel properties
167  virtual void setProperties
168  (
169  const label parcelI,
170  const label nParcels,
171  const scalar time,
172  typename CloudType::parcelType::trackingData& td,
173  typename CloudType::parcelType& parcel
174  );
175 
176  //- Flag to identify whether model fully describes the parcel
177  virtual bool fullyDescribed() const;
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #ifdef NoRepository
188  #include "CellZoneInjection.C"
189 #endif
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
Injection positions specified by a particle number density within a cell set.
virtual scalar nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual void topoChange()
Set injector locations when mesh is updated.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType::trackingData &td, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
virtual ~CellZoneInjection()
Destructor.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
TypeName("cellZoneInjection")
Runtime type information.
CellZoneInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual scalar timeEnd() const
Return the end-of-injection time.
virtual scalar massToInject(const scalar time0, const scalar time1)
Parcel mass to introduce relative to SOI.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
Templated injection model class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
barycentric coordinates(const polyMesh &mesh, const point &position, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the coordinates given the position and tet topology.
Definition: tracking.C:1259
Namespace for OpenFOAM.
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