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-2023 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, by using patch flow rate to determine concentration and
29  velocity.
30 
31  User specifies:
32  - Name of patch
33  - Injection duration
34  - Injection target concentration/carrier volume flow rate
35 
36  Properties:
37  - Initial parcel velocity given by local flow velocity
38  - Parcel diameters obtained by distribution model
39  - Parcels injected randomly across the patch
40 
41 SourceFiles
42  PatchFlowRateInjection.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef PatchFlowRateInjection_H
47 #define PatchFlowRateInjection_H
48 
49 #include "InjectionModel.H"
50 #include "patchInjectionBase.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 class distribution;
58 
59 /*---------------------------------------------------------------------------*\
60  Class PatchFlowRateInjection Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
65 :
66  public InjectionModel<CloudType>,
67  public patchInjectionBase
68 {
69  // Private Data
70 
71  //- Name of carrier (mass or volume) flux field
72  const word phiName_;
73 
74  //- Name of carrier density field
75  const word rhoName_;
76 
77  //- Injection duration [s]
78  const scalar duration_;
79 
80  //- Concentration profile of particle volume to carrier volume [-]
81  autoPtr<Function1<scalar>> concentration_;
82 
83  //- Parcels to introduce per unit volume flow rate m3 [n/m^3]
84  const scalar parcelConcentration_;
85 
86  //- Parcel size distribution model
87  const autoPtr<distribution> sizeDistribution_;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("patchFlowRateInjection");
94 
95 
96  // Constructors
97 
98  //- Construct from dictionary
100  (
101  const dictionary& dict,
102  CloudType& owner,
103  const word& modelName
104  );
105 
106  //- Construct copy
108 
109  //- Construct and return a clone
111  {
113  (
115  );
116  }
117 
118 
119  //- Destructor
120  virtual ~PatchFlowRateInjection();
121 
122 
123  // Member Functions
124 
125  //- Inherit topoChange from patchInjectionBase
127 
128  //- Set injector locations when mesh is updated
129  virtual void topoChange();
130 
131  //- Return the end-of-injection time
132  virtual scalar timeEnd() const;
133 
134  //- Return the total volumetric flow rate across the patch [m^3/s]
135  scalar flowRate() const;
136 
137  //- Number of parcels to introduce relative to SOI
138  virtual label nParcelsToInject(const scalar time0, const scalar time1);
139 
140  //- Parcel mass to introduce relative to SOI
141  virtual scalar massToInject(const scalar time0, const scalar time1);
142 
143 
144  // Injection geometry
145 
146  //- Inherit setPositionAndCell from patchInjectionBase
148 
149  //- Set the injection position and owner cell, tetFace and tetPt
150  virtual void setPositionAndCell
151  (
152  const label parcelI,
153  const label nParcels,
154  const scalar time,
155  barycentric& coordinates,
156  label& celli,
157  label& tetFacei,
158  label& tetPti,
159  label& facei
160  );
161 
162  virtual void setProperties
163  (
164  const label parcelI,
165  const label nParcels,
166  const scalar time,
167  typename CloudType::parcelType::trackingData& td,
168  typename CloudType::parcelType& parcel
169  );
170 
171  //- Flag to identify whether model fully describes the parcel
172  virtual bool fullyDescribed() const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "PatchFlowRateInjection.C"
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
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, by using patch flow rate to determine concentration and velocity.
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 flowRate() const
Return the total volumetric flow rate across the patch [m^3/s].
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual label nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
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 keyword definitions, which are a keyword followed by any number of values (e....
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
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