PatchFlowRateInjection.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::PatchFlowRateInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Patch injection, by using patch flow rate to determine concentration and
34  velocity.
35 
36  User specifies:
37  - Total mass to inject
38  - Name of patch
39  - Injection duration
40  - Injection target concentration/carrier volume flow rate
41 
42  Properties:
43  - Initial parcel velocity given by local flow velocity
44  - Parcel diameters obtained by distribution model
45  - Parcels injected randomly across the patch
46 
47 SourceFiles
48  PatchFlowRateInjection.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef PatchFlowRateInjection_H
53 #define PatchFlowRateInjection_H
54 
55 #include "InjectionModel.H"
56 #include "patchInjectionBase.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 class distributionModel;
64 
65 /*---------------------------------------------------------------------------*\
66  Class PatchFlowRateInjection Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class CloudType>
71 :
72  public InjectionModel<CloudType>,
73  public patchInjectionBase
74 {
75  // Private data
76 
77  //- Name of carrier (mass or volume) flux field
78  const word phiName_;
79 
80  //- Name of carrier density field
81  const word rhoName_;
82 
83  //- Injection duration [s]
84  scalar duration_;
85 
86  //- Concentration profile of particle volume to carrier volume [-]
87  autoPtr<Function1<scalar>> concentration_;
88 
89  //- Parcels to introduce per unit volume flow rate m3 [n/m3]
90  const scalar parcelConcentration_;
91 
92  //- Parcel size distribution model
93  const autoPtr<distributionModel> sizeDistribution_;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("patchFlowRateInjection");
100 
101 
102  // Constructors
103 
104  //- Construct from dictionary
106  (
107  const dictionary& dict,
108  CloudType& owner,
109  const word& modelName
110  );
111 
112  //- Construct copy
114 
115  //- Construct and return a clone
117  {
119  (
121  );
122  }
123 
124 
125  //- Destructor
126  virtual ~PatchFlowRateInjection();
127 
128 
129  // Member Functions
130 
131  //- Inherit updateMesh from patchInjectionBase
133 
134  //- Set injector locations when mesh is updated
135  virtual void updateMesh();
136 
137  //- Return the end-of-injection time
138  scalar timeEnd() const;
139 
140  //- Return the total volumetric flow rate across the patch [m3/s]
141  virtual scalar flowRate() const;
142 
143  //- Number of parcels to introduce relative to SOI
144  virtual label parcelsToInject(const scalar time0, const scalar time1);
145 
146  //- Volume of parcels to introduce relative to SOI
147  virtual scalar volumeToInject(const scalar time0, const scalar time1);
148 
149 
150  // Injection geometry
151 
152  //- Inherit setPositionAndCell from patchInjectionBase
154 
155  //- Set the injection position and owner cell, tetFace and tetPt
156  virtual void setPositionAndCell
157  (
158  const label parcelI,
159  const label nParcels,
160  const scalar time,
161  vector& position,
162  label& cellOwner,
163  label& tetFacei,
164  label& tetPti
165  );
166 
167  virtual void setProperties
168  (
169  const label parcelI,
170  const label nParcels,
171  const scalar time,
172  typename CloudType::parcelType& parcel
173  );
174 
175  //- Flag to identify whether model fully describes the parcel
176  virtual bool fullyDescribed() const;
177 
178  //- Return flag to identify whether or not injection of parcelI is
179  // permitted
180  virtual bool validInjection(const label parcelI);
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #ifdef NoRepository
191  #include "PatchFlowRateInjection.C"
192 #endif
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
TypeName("patchFlowRateInjection")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Templated injection model class.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
virtual void updateMesh()
Set injector locations when mesh is updated.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:98
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
const CloudType & owner() const
Return const access to the owner cloud.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
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.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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.
label setPositionAndCell(const fvMesh &mesh, const scalar fraction01, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
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:67
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m3/s].
virtual ~PatchFlowRateInjection()
Destructor.
Namespace for OpenFOAM.