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-2016 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  Properties:
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 TimeFunction1;
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 []
78  const label parcelsPerSecond_;
79 
80  //- Initial parcel velocity [m/s]
81  const vector U0_;
82 
83  //- Flow rate profile relative to SOI []
84  const TimeFunction1<scalar> flowRateProfile_;
85 
86  //- Parcel size distribution model
87  const autoPtr<distributionModels::distributionModel> sizeDistribution_;
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
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 // ************************************************************************* //
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
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
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
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.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Templated injection model class.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
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.
virtual scalar timeEnd() const
Return the end-of-injection time.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~PatchInjection()
Destructor.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
TypeName("patchInjection")
Runtime type information.
PatchInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
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.
const CloudType & owner() const
Return const access to the owner cloud.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Namespace for OpenFOAM.