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 | 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::PatchInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Patch injection.
34 
35  User specifies:
36  - Total mass to inject
37  - Name of patch
38  - Injection duration
39  - Initial parcel velocity
40  - Injection volume flow rate
41 
42  Properties:
43  - Parcel diameters obtained by distribution model
44  - Parcels injected randomly across the patch
45 
46 SourceFiles
47  PatchInjection.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef PatchInjection_H
52 #define PatchInjection_H
53 
54 #include "InjectionModel.H"
55 #include "patchInjectionBase.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 template<class Type>
63 class TimeFunction1;
64 
65 class distributionModel;
66 
67 /*---------------------------------------------------------------------------*\
68  Class PatchInjection Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class CloudType>
72 class PatchInjection
73 :
74  public InjectionModel<CloudType>,
75  public patchInjectionBase
76 {
77  // Private data
78 
79  //- Injection duration [s]
80  scalar duration_;
81 
82  //- Number of parcels to introduce per second []
83  const label parcelsPerSecond_;
84 
85  //- Initial parcel velocity [m/s]
86  const vector U0_;
87 
88  //- Flow rate profile relative to SOI []
89  const TimeFunction1<scalar> flowRateProfile_;
90 
91  //- Parcel size distribution model
92  const autoPtr<distributionModel> sizeDistribution_;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("patchInjection");
99 
100 
101  // Constructors
102 
103  //- Construct from dictionary
105  (
106  const dictionary& dict,
107  CloudType& owner,
108  const word& modelName
109  );
110 
111  //- Construct copy
113 
114  //- Construct and return a clone
116  {
118  (
119  new PatchInjection<CloudType>(*this)
120  );
121  }
122 
123 
124  //- Destructor
125  virtual ~PatchInjection();
126 
127 
128  // Member Functions
129 
130  //- Inherit updateMesh from patchInjectionBase
132 
133  //- Set injector locations when mesh is updated
134  virtual void updateMesh();
135 
136  //- Return the end-of-injection time
137  virtual scalar timeEnd() const;
138 
139  //- Number of parcels to introduce relative to SOI
140  virtual label parcelsToInject(const scalar time0, const scalar time1);
141 
142  //- Volume of parcels to introduce relative to SOI
143  virtual scalar volumeToInject(const scalar time0, const scalar time1);
144 
145 
146  // Injection geometry
147 
148  //- Inherit setPositionAndCell from patchInjectionBase
150 
151  //- Set the injection position and owner cell, tetFace and tetPt
152  virtual void setPositionAndCell
153  (
154  const label parcelI,
155  const label nParcels,
156  const scalar time,
157  vector& position,
158  label& cellOwner,
159  label& tetFacei,
160  label& tetPti
161  );
162 
163  virtual void setProperties
164  (
165  const label parcelI,
166  const label nParcels,
167  const scalar time,
168  typename CloudType::parcelType& parcel
169  );
170 
171  //- Flag to identify whether model fully describes the parcel
172  virtual bool fullyDescribed() const;
173 
174  //- Return flag to identify whether or not injection of parcelI is
175  // permitted
176  virtual bool validInjection(const label parcelI);
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187  #include "PatchInjection.C"
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
Foam::PatchInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: PatchInjection.C:207
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::PatchInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: PatchInjection.C:119
Foam::PatchInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: PatchInjection.C:214
Foam::PatchInjection::TypeName
TypeName("patchInjection")
Runtime type information.
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
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::PatchInjection::PatchInjection
PatchInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchInjection.C:37
PatchInjection.C
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::patchInjectionBase::updateMesh
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
Definition: patchInjectionBase.C:82
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:167
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::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::PatchInjection
Patch injection.
Definition: PatchInjection.H:71
Foam::PatchInjection::timeEnd
virtual scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchInjection.C:111
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PatchInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: PatchInjection.H:114
Foam::Vector< scalar >
Foam::patchInjectionBase
Definition: patchInjectionBase.H:64
Foam::PatchInjection::~PatchInjection
virtual ~PatchInjection()
Destructor.
Definition: PatchInjection.C:97
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:191
Foam::PatchInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: PatchInjection.C:151
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::PatchInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: PatchInjection.C:104