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 | Copyright (C) 2011-2015 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
29  - uses patch flow rate to determine concentration and velociy
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  - Initial parcel velocity given by local flow velocity
37  - Parcel diameters obtained by distribution model
38  - Parcels injected randomly across the patch
39 
40 SourceFiles
41  PatchFlowRateInjection.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef PatchFlowRateInjection_H
46 #define PatchFlowRateInjection_H
47 
48 #include "InjectionModel.H"
49 #include "patchInjectionBase.H"
50 #include "TimeDataEntry.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 class distributionModel;
58 
59 /*---------------------------------------------------------------------------*\
60  Class PatchFlowRateInjection Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
65 :
66  public InjectionModel<CloudType>,
67  public patchInjectionBase
68 {
69  // Private data
70 
71  //- Name of carrier (mass or volume) flux field
72  const word phiName_;
73 
74  //- Name of carrier density field
75  const word rhoName_;
76 
77  //- Injection duration [s]
78  scalar duration_;
79 
80  //- Concentration profile of particle volume to carrier volume [-]
82 
83  //- Parcels to introduce per unit volume flow rate m3 [n/m3]
84  const scalar parcelConcentration_;
85 
86  //- Parcel size distribution model
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("patchFlowRateInjection");
94 
95 
96  // Constructors
97 
98  //- Construct from dictionary
100  (
101  const dictionary& dict,
102  CloudType& owner,
103  const word& modelName
104  );
105 
106  //- Construct copy
108 
109  //- Construct and return a clone
110  virtual autoPtr<InjectionModel<CloudType> > clone() const
111  {
113  (
115  );
116  }
117 
118 
119  //- Destructor
120  virtual ~PatchFlowRateInjection();
121 
122 
123  // Member Functions
124 
125  //- Inherit updateMesh from patchInjectionBase
127 
128  //- Set injector locations when mesh is updated
129  virtual void updateMesh();
130 
131  //- Return the end-of-injection time
132  scalar timeEnd() const;
133 
134  //- Return the total volumetric flow rate across the patch [m3/s]
135  virtual scalar flowRate() const;
136 
137  //- Number of parcels to introduce relative to SOI
138  virtual label parcelsToInject(const scalar time0, const scalar time1);
139 
140  //- Volume of parcels to introduce relative to SOI
141  virtual scalar volumeToInject(const scalar time0, const scalar time1);
142 
143 
144  // Injection geometry
145 
146  //- Inherit setPositionAndCell from patchInjectionBase
148 
149  //- Set the injection position and owner cell, tetFace and tetPt
150  virtual void setPositionAndCell
151  (
152  const label parcelI,
153  const label nParcels,
154  const scalar time,
155  vector& position,
156  label& cellOwner,
157  label& tetFaceI,
158  label& tetPtI
159  );
160 
161  virtual void setProperties
162  (
163  const label parcelI,
164  const label nParcels,
165  const scalar time,
166  typename CloudType::parcelType& parcel
167  );
168 
169  //- Flag to identify whether model fully describes the parcel
170  virtual bool fullyDescribed() const;
171 
172  //- Return flag to identify whether or not injection of parcelI is
173  // permitted
174  virtual bool validInjection(const label parcelI);
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #ifdef NoRepository
185 # include "PatchFlowRateInjection.C"
186 #endif
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
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:214
Foam::PatchFlowRateInjection
Patch injection.
Definition: PatchFlowRateInjection.H:63
Foam::PatchFlowRateInjection::flowRate
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m3/s].
Definition: PatchFlowRateInjection.C:121
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PatchFlowRateInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PatchFlowRateInjection.H:109
PatchFlowRateInjection.C
Foam::PatchFlowRateInjection::sizeDistribution_
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size distribution model.
Definition: PatchFlowRateInjection.H:86
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:238
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
Foam::PatchFlowRateInjection::~PatchFlowRateInjection
virtual ~PatchFlowRateInjection()
Destructor.
Definition: PatchFlowRateInjection.C:100
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
distributionModel
A library of runtime-selectable distribution models.
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
InjectionModel.H
Foam::PatchFlowRateInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: PatchFlowRateInjection.C:107
Foam::TimeDataEntry< scalar >
Foam::PatchFlowRateInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchFlowRateInjection.C:114
Foam::label
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
Foam::PatchFlowRateInjection::rhoName_
const word rhoName_
Name of carrier density field.
Definition: PatchFlowRateInjection.H:74
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::patchInjectionBase::updateMesh
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Definition: patchInjectionBase.C:84
Foam::PatchFlowRateInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: PatchFlowRateInjection.C:261
Foam::PatchFlowRateInjection::phiName_
const word phiName_
Name of carrier (mass or volume) flux field.
Definition: PatchFlowRateInjection.H:71
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::PatchFlowRateInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: PatchFlowRateInjection.C:191
TimeDataEntry.H
Foam::PatchFlowRateInjection::TypeName
TypeName("patchFlowRateInjection")
Runtime type information.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::PatchFlowRateInjection::parcelConcentration_
const scalar parcelConcentration_
Parcels to introduce per unit volume flow rate m3 [n/m3].
Definition: PatchFlowRateInjection.H:83
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
patchInjectionBase.H
Foam::patchInjectionBase::setPositionAndCell
virtual void setPositionAndCell(const polyMesh &mesh, cachedRandom &rnd, vector &position, label &cellOwner, label &tetFaceI, label &tetPtI)
Set the injection position and owner cell, tetFace and tetPt.
Definition: patchInjectionBase.C:150
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::PatchFlowRateInjection::PatchFlowRateInjection
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchFlowRateInjection.C:36
Foam::Vector< scalar >
Foam::PatchFlowRateInjection::duration_
scalar duration_
Injection duration [s].
Definition: PatchFlowRateInjection.H:77
Foam::patchInjectionBase
Definition: patchInjectionBase.H:61
Foam::PatchFlowRateInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: PatchFlowRateInjection.C:152
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::PatchFlowRateInjection::concentration_
const TimeDataEntry< scalar > concentration_
Concentration profile of particle volume to carrier volume [-].
Definition: PatchFlowRateInjection.H:80
Foam::PatchFlowRateInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: PatchFlowRateInjection.C:254