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 #include "TimeFunction1.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  //- Concentration profile of particle volume to carrier volume [-]
82  const TimeFunction1<scalar> concentration_;
83 
84  //- Parcels to introduce per unit volume flow rate m3 [n/m^3]
85  const scalar parcelConcentration_;
86 
87  //- Parcel size distribution model
88  const autoPtr<distribution> sizeDistribution_;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("patchFlowRateInjection");
95 
96 
97  // Constructors
98 
99  //- Construct from dictionary
101  (
102  const dictionary& dict,
103  CloudType& owner,
104  const word& modelName
105  );
106 
107  //- Construct copy
109 
110  //- Construct and return a clone
112  {
114  (
116  );
117  }
118 
119 
120  //- Destructor
121  virtual ~PatchFlowRateInjection();
122 
123 
124  // Member Functions
125 
126  //- Inherit topoChange from patchInjectionBase
128 
129  //- Set injector locations when mesh is updated
130  virtual void topoChange();
131 
132  //- Return the end-of-injection time
133  virtual scalar timeEnd() const;
134 
135  //- Return the total volumetric flow rate across the patch [m^3/s]
136  scalar flowRate() const;
137 
138  //- Number of parcels to introduce relative to SOI
139  virtual label nParcelsToInject(const scalar time0, const scalar time1);
140 
141  //- Parcel mass to introduce relative to SOI
142  virtual scalar massToInject(const scalar time0, const scalar time1);
143 
144 
145  // Injection geometry
146 
147  //- Inherit setPositionAndCell from patchInjectionBase
149 
150  //- Set the injection position and owner cell, tetFace and tetPt
151  virtual void setPositionAndCell
152  (
153  const label parcelI,
154  const label nParcels,
155  const scalar time,
156  barycentric& coordinates,
157  label& celli,
158  label& tetFacei,
159  label& tetPti,
160  label& facei
161  );
162 
163  virtual void setProperties
164  (
165  const label parcelI,
166  const label nParcels,
167  const scalar time,
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:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
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 ~PatchFlowRateInjection()
Destructor.
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
scalar flowRate() const
Return the total volumetric flow rate across the patch [m^3/s].
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Inherit setPositionAndCell from patchInjectionBase.
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 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:160
Base class for patch-based injection models.
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
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