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 // ************************************************************************* //
Foam::PatchFlowRateInjection
Patch injection, by using patch flow rate to determine concentration and velocity.
Definition: PatchFlowRateInjection.H:69
Foam::PatchFlowRateInjection::flowRate
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m3/s].
Definition: PatchFlowRateInjection.C:126
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::PatchFlowRateInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PatchFlowRateInjection.H:115
PatchFlowRateInjection.C
Foam::PatchFlowRateInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: PatchFlowRateInjection.C:244
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::PatchFlowRateInjection::~PatchFlowRateInjection
virtual ~PatchFlowRateInjection()
Destructor.
Definition: PatchFlowRateInjection.C:105
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::PatchFlowRateInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: PatchFlowRateInjection.C:112
Foam::PatchFlowRateInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchFlowRateInjection.C:119
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::PatchFlowRateInjection::setPositionAndCell
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.
Definition: PatchFlowRateInjection.C:220
Foam::patchInjectionBase::updateMesh
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Definition: patchInjectionBase.C:82
Foam::PatchFlowRateInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: PatchFlowRateInjection.C:267
Foam::patchInjectionBase::setPositionAndCell
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.
Definition: patchInjectionBase.C:148
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::PatchFlowRateInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: PatchFlowRateInjection.C:197
Foam::PatchFlowRateInjection::TypeName
TypeName("patchFlowRateInjection")
Runtime type information.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
patchInjectionBase.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PatchFlowRateInjection::PatchFlowRateInjection
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchFlowRateInjection.C:38
Foam::Vector< scalar >
Foam::patchInjectionBase
Definition: patchInjectionBase.H:64
Foam::PatchFlowRateInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: PatchFlowRateInjection.C:157
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::PatchFlowRateInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: PatchFlowRateInjection.C:260