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-2019 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 updateMesh from patchInjectionBase
129 
130  //- Set injector locations when mesh is updated
131  virtual void updateMesh();
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 
146  // Injection geometry
147 
148  //- Inherit setPositionAndCell from patchInjectionBase
150 
151  //- Set the injection position and owner cell, tetFace and tetPt
152  virtual void setPositionAndCell
153  (
154  const label parcelI,
155  const label nParcels,
156  const scalar time,
157  vector& position,
158  label& cellOwner,
159  label& tetFacei,
160  label& tetPti
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  //- Return flag to identify whether or not injection of parcelI is
175  // permitted
176  virtual bool validInjection(const label parcelI);
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187  #include "PatchFlowRateInjection.C"
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
TypeName("patchFlowRateInjection")
Runtime type information.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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.
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: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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
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:69
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m^3/s].
virtual ~PatchFlowRateInjection()
Destructor.
Namespace for OpenFOAM.