PatchInjection.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::PatchInjection
26 
27 Description
28  Patch injection
29 
30  User specifies
31  - Total mass to inject
32  - Name of patch
33  - Injection duration
34  - Initial parcel velocity
35  - Injection volume flow rate
36 
37  Additional
38  - Parcel diameters obtained by distribution model
39  - Parcels injected randomly across the patch
40 
41 SourceFiles
42  PatchInjection.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef PatchInjection_H
47 #define PatchInjection_H
48 
49 #include "InjectionModel.H"
50 #include "patchInjectionBase.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 template<class Type>
58 class TimeDataEntry;
59 
60 class distributionModel;
61 
62 /*---------------------------------------------------------------------------*\
63  Class PatchInjection Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class CloudType>
67 class PatchInjection
68 :
69  public InjectionModel<CloudType>,
70  public patchInjectionBase
71 {
72  // Private data
73 
74  //- Injection duration [s]
75  scalar duration_;
76 
77  //- Number of parcels to introduce per second []
79 
80  //- Initial parcel velocity [m/s]
81  const vector U0_;
82 
83  //- Flow rate profile relative to SOI []
85 
86  //- Parcel size distribution model
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("patchInjection");
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  (
114  new PatchInjection<CloudType>(*this)
115  );
116  }
117 
118 
119  //- Destructor
120  virtual ~PatchInjection();
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  virtual scalar timeEnd() const;
133 
134  //- Number of parcels to introduce relative to SOI
135  virtual label parcelsToInject(const scalar time0, const scalar time1);
136 
137  //- Volume of parcels to introduce relative to SOI
138  virtual scalar volumeToInject(const scalar time0, const scalar time1);
139 
140 
141  // Injection geometry
142 
143  //- Inherit setPositionAndCell from patchInjectionBase
145 
146  //- Set the injection position and owner cell, tetFace and tetPt
147  virtual void setPositionAndCell
148  (
149  const label parcelI,
150  const label nParcels,
151  const scalar time,
152  vector& position,
153  label& cellOwner,
154  label& tetFaceI,
155  label& tetPtI
156  );
157 
158  virtual void setProperties
159  (
160  const label parcelI,
161  const label nParcels,
162  const scalar time,
163  typename CloudType::parcelType& parcel
164  );
165 
166  //- Flag to identify whether model fully describes the parcel
167  virtual bool fullyDescribed() const;
168 
169  //- Return flag to identify whether or not injection of parcelI is
170  // permitted
171  virtual bool validInjection(const label parcelI);
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #ifdef NoRepository
182 # include "PatchInjection.C"
183 #endif
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::PatchInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: PatchInjection.C:208
Foam::PatchInjection::U0_
const vector U0_
Initial parcel velocity [m/s].
Definition: PatchInjection.H:80
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PatchInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: PatchInjection.C:116
Foam::PatchInjection::duration_
scalar duration_
Injection duration [s].
Definition: PatchInjection.H:74
Foam::PatchInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: PatchInjection.C:215
Foam::PatchInjection::TypeName
TypeName("patchInjection")
Runtime type information.
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
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::TimeDataEntry< scalar >
Foam::PatchInjection::PatchInjection
PatchInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchInjection.C:34
PatchInjection.C
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::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::PatchInjection::parcelsPerSecond_
const label parcelsPerSecond_
Number of parcels to introduce per second [].
Definition: PatchInjection.H:77
Foam::patchInjectionBase::updateMesh
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Definition: patchInjectionBase.C:84
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
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::PatchInjection::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: PatchInjection.C:168
Foam::PatchInjection
Patch injection.
Definition: PatchInjection.H:66
Foam::PatchInjection::timeEnd
virtual scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchInjection.C:108
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::PatchInjection::flowRateProfile_
const TimeDataEntry< scalar > flowRateProfile_
Flow rate profile relative to SOI [].
Definition: PatchInjection.H:83
Foam::PatchInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PatchInjection.H:109
Foam::PatchInjection::sizeDistribution_
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size distribution model.
Definition: PatchInjection.H:86
Foam::Vector< scalar >
Foam::patchInjectionBase
Definition: patchInjectionBase.H:61
Foam::PatchInjection::~PatchInjection
virtual ~PatchInjection()
Destructor.
Definition: PatchInjection.C:94
Foam::PatchInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: PatchInjection.C:192
Foam::PatchInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: PatchInjection.C:150
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::PatchInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: PatchInjection.C:101