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-2022 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  - Total mass to inject
33  - Name of patch
34  - Injection duration
35  - Injection target concentration/carrier volume flow rate
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 #include "TimeFunction1.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 class distributionModel;
60 
61 /*---------------------------------------------------------------------------*\
62  Class PatchFlowRateInjection Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class CloudType>
67 :
68  public InjectionModel<CloudType>,
69  public patchInjectionBase
70 {
71  // Private Data
72 
73  //- Name of carrier (mass or volume) flux field
74  const word phiName_;
75 
76  //- Name of carrier density field
77  const word rhoName_;
78 
79  //- Injection duration [s]
80  scalar duration_;
81 
82  //- Concentration profile of particle volume to carrier volume [-]
83  const TimeFunction1<scalar> concentration_;
84 
85  //- Parcels to introduce per unit volume flow rate m3 [n/m^3]
86  const scalar parcelConcentration_;
87 
88  //- Parcel size distribution model
89  const autoPtr<distributionModel> sizeDistribution_;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("patchFlowRateInjection");
96 
97 
98  // Constructors
99 
100  //- Construct from dictionary
102  (
103  const dictionary& dict,
104  CloudType& owner,
105  const word& modelName
106  );
107 
108  //- Construct copy
110 
111  //- Construct and return a clone
113  {
115  (
117  );
118  }
119 
120 
121  //- Destructor
122  virtual ~PatchFlowRateInjection();
123 
124 
125  // Member Functions
126 
127  //- Inherit topoChange from patchInjectionBase
129 
130  //- Set injector locations when mesh is updated
131  virtual void topoChange();
132 
133  //- Return the end-of-injection time
134  scalar timeEnd() const;
135 
136  //- Return the total volumetric flow rate across the patch [m^3/s]
137  virtual scalar flowRate() const;
138 
139  //- Number of parcels to introduce relative to SOI
140  virtual label parcelsToInject(const scalar time0, const scalar time1);
141 
142  //- Volume of parcels to introduce relative to SOI
143  virtual scalar volumeToInject(const scalar time0, const scalar time1);
144 
145  //- Return the average parcel mass over the injection period
146  virtual scalar averageParcelMass();
147 
148 
149  // Injection geometry
150 
151  //- Inherit setPositionAndCell from patchInjectionBase
153 
154  //- Set the injection position and owner cell, tetFace and tetPt
155  virtual void setPositionAndCell
156  (
157  const label parcelI,
158  const label nParcels,
159  const scalar time,
160  vector& position,
161  label& cellOwner,
162  label& tetFacei,
163  label& tetPti
164  );
165 
166  virtual void setProperties
167  (
168  const label parcelI,
169  const label nParcels,
170  const scalar time,
171  typename CloudType::parcelType& parcel
172  );
173 
174  //- Flag to identify whether model fully describes the parcel
175  virtual bool fullyDescribed() const;
176 
177  //- Return flag to identify whether or not injection of parcelI is
178  // permitted
179  virtual bool validInjection(const label parcelI);
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 // ************************************************************************* //
TypeName("patchFlowRateInjection")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Templated injection model class.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Base class for patch-based injection models.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual scalar averageParcelMass()
Return the average parcel mass over the injection period.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
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.
Patch injection, by using patch flow rate to determine concentration and velocity.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
scalar timeEnd() const
Return the end-of-injection time.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
virtual void topoChange()
Set injector locations when mesh is updated.
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m^3/s].
virtual ~PatchFlowRateInjection()
Destructor.
Namespace for OpenFOAM.