PatchFlowRateInjection.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-2025 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::PatchFlowRateInjection
26 
27 Description
28  Patch injection in which the quantity of particulate material introduced is
29  specified as a fraction of the carrier flow rate.
30 
31  User specifies:
32  - Name of patch
33  - Injection duration
34  - The particulate/carrier volume or mass ratio
35  - The number concentration of parcels
36 
37  Properties:
38  - Initial parcel velocity given by local flow velocity
39  - Parcel diameters obtained by distribution model
40  - Parcels injected randomly across the patch
41 
42 SourceFiles
43  PatchFlowRateInjection.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef PatchFlowRateInjection_H
48 #define PatchFlowRateInjection_H
49 
50 #include "InjectionModel.H"
51 #include "patchInjectionBase.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 class distribution;
59 
60 /*---------------------------------------------------------------------------*\
61  Class PatchFlowRateInjection Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class CloudType>
66 :
67  public InjectionModel<CloudType>,
68  public patchInjectionBase
69 {
70  // Private Data
71 
72  //- Name of carrier (mass or volume) flux field
73  const word phiName_;
74 
75  //- Name of carrier density field
76  const word rhoName_;
77 
78  //- Injection duration [s]
79  const scalar duration_;
80 
81  //- The ratio of particulate volume to carrier volume [-]
82  autoPtr<Function1<scalar>> volumeRatio_;
83 
84  //- The ratio of particulate mass to carrier mass [-]
85  autoPtr<Function1<scalar>> massRatio_;
86 
87  //- Parcels to introduce per unit volume of particulates [m^-3]
88  const scalar parcelConcentration_;
89 
90  //- Parcel size distribution model
91  const autoPtr<distribution> sizeDistribution_;
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("patchFlowRateInjection");
98 
99 
100  // Constructors
101 
102  //- Construct from dictionary
104  (
105  const dictionary& dict,
106  CloudType& owner,
107  const word& modelName
108  );
109 
110  //- Construct copy
112 
113  //- Construct and return a clone
115  {
117  (
119  );
120  }
121 
122 
123  //- Destructor
124  virtual ~PatchFlowRateInjection();
125 
126 
127  // Member Functions
128 
129  //- Inherit topoChange from patchInjectionBase
131 
132  //- Set injector locations when mesh is updated
133  virtual void topoChange();
134 
135  //- Return the end-of-injection time
136  virtual scalar timeEnd() const;
137 
138  //- Return the total volumetric flow rate across the patch [m^3/s]
139  scalar volumetricFlowRate() const;
140 
141  //- Return the total mass flow rate across the patch [kg/s]
142  scalar massFlowRate() 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  //- Inherit setPositionAndCell from patchInjectionBase
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,
163  label& celli,
164  label& tetFacei,
165  label& tetPti,
166  label& facei
167  );
168 
169  virtual void setProperties
170  (
171  const label parcelI,
172  const label nParcels,
173  const scalar time,
174  typename CloudType::parcelType::trackingData& td,
175  typename CloudType::parcelType& parcel
176  );
177 
178  //- Flag to identify whether model fully describes the parcel
179  virtual bool fullyDescribed() const;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #ifdef NoRepository
190  #include "PatchFlowRateInjection.C"
191 #endif
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
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.
Patch injection in which the quantity of particulate material introduced is specified as a fraction o...
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.
TypeName("patchFlowRateInjection")
Runtime type information.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType::trackingData &td, typename CloudType::parcelType &parcel)
virtual ~PatchFlowRateInjection()
Destructor.
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
scalar massFlowRate() const
Return the total mass flow rate across the patch [kg/s].
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
scalar volumetricFlowRate() const
Return the total volumetric flow rate across the patch [m^3/s].
virtual void setPositionAndCell(const fvMesh &mesh, randomGenerator &rndGen, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Inherit setPositionAndCell from patchInjectionBase.
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.
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
Base class for patch-based injection models.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
virtual void setPositionAndCell(const fvMesh &mesh, randomGenerator &rndGen, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
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