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 #include "TimeFunction1.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 class distributionModel;
65 
66 /*---------------------------------------------------------------------------*\
67  Class PatchFlowRateInjection Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class CloudType>
72 :
73  public InjectionModel<CloudType>,
74  public patchInjectionBase
75 {
76  // Private data
77 
78  //- Name of carrier (mass or volume) flux field
79  const word phiName_;
80 
81  //- Name of carrier density field
82  const word rhoName_;
83 
84  //- Injection duration [s]
85  scalar duration_;
86 
87  //- Concentration profile of particle volume to carrier volume [-]
88  const TimeFunction1<scalar> concentration_;
89 
90  //- Parcels to introduce per unit volume flow rate m3 [n/m3]
91  const scalar parcelConcentration_;
92 
93  //- Parcel size distribution model
94  const autoPtr<distributionModel> sizeDistribution_;
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("patchFlowRateInjection");
101 
102 
103  // Constructors
104 
105  //- Construct from dictionary
107  (
108  const dictionary& dict,
109  CloudType& owner,
110  const word& modelName
111  );
112 
113  //- Construct copy
115 
116  //- Construct and return a clone
118  {
120  (
122  );
123  }
124 
125 
126  //- Destructor
127  virtual ~PatchFlowRateInjection();
128 
129 
130  // Member Functions
131 
132  //- Inherit updateMesh from patchInjectionBase
134 
135  //- Set injector locations when mesh is updated
136  virtual void updateMesh();
137 
138  //- Return the end-of-injection time
139  scalar timeEnd() const;
140 
141  //- Return the total volumetric flow rate across the patch [m3/s]
142  virtual scalar flowRate() const;
143 
144  //- Number of parcels to introduce relative to SOI
145  virtual label parcelsToInject(const scalar time0, const scalar time1);
146 
147  //- Volume of parcels to introduce relative to SOI
148  virtual scalar volumeToInject(const scalar time0, const scalar time1);
149 
150 
151  // Injection geometry
152 
153  //- Inherit setPositionAndCell from patchInjectionBase
155 
156  //- Set the injection position and owner cell, tetFace and tetPt
157  virtual void setPositionAndCell
158  (
159  const label parcelI,
160  const label nParcels,
161  const scalar time,
162  vector& position,
163  label& cellOwner,
164  label& tetFacei,
165  label& tetPti
166  );
167 
168  virtual void setProperties
169  (
170  const label parcelI,
171  const label nParcels,
172  const scalar time,
173  typename CloudType::parcelType& parcel
174  );
175 
176  //- Flag to identify whether model fully describes the parcel
177  virtual bool fullyDescribed() const;
178 
179  //- Return flag to identify whether or not injection of parcelI is
180  // permitted
181  virtual bool validInjection(const label parcelI);
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
192  #include "PatchFlowRateInjection.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Foam::PatchFlowRateInjection
Patch injection, by using patch flow rate to determine concentration and velocity.
Definition: PatchFlowRateInjection.H:70
Foam::PatchFlowRateInjection::flowRate
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m3/s].
Definition: PatchFlowRateInjection.C:124
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::PatchFlowRateInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PatchFlowRateInjection.H:116
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:242
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::PatchFlowRateInjection::~PatchFlowRateInjection
virtual ~PatchFlowRateInjection()
Destructor.
Definition: PatchFlowRateInjection.C:103
Foam::TimeFunction1< scalar >
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::patchInjectionBase::setPositionAndCell
void 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::PatchFlowRateInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: PatchFlowRateInjection.C:110
Foam::PatchFlowRateInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchFlowRateInjection.C:117
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:218
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:265
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:195
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:121
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:39
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:155
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:258
TimeFunction1.H