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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::PatchInjection
29 
30 Group
31  grpLagrangianIntermediateInjectionSubModels
32 
33 Description
34  Patch injection.
35 
36  User specifies:
37  - Total mass to inject
38  - Name of patch
39  - Injection duration
40  - Initial parcel velocity
41  - Injection volume flow rate
42 
43  Properties:
44  - Parcel diameters obtained by distribution model
45  - Parcels injected randomly across the patch
46 
47 SourceFiles
48  PatchInjection.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef PatchInjection_H
53 #define PatchInjection_H
54 
55 #include "InjectionModel.H"
56 #include "patchInjectionBase.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 class distributionModel;
64 
65 /*---------------------------------------------------------------------------*\
66  Class PatchInjection Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class CloudType>
70 class PatchInjection
71 :
72  public InjectionModel<CloudType>,
73  public patchInjectionBase
74 {
75 public:
76 
77  // Public Data Types
78 
79  //- Velocity type enumeration
80  enum velocityType
81  {
85  };
86 
87  //- Velocity type names
89 
90 
91 private:
92 
93  // Private data
94 
95  //- Injection duration [s]
96  scalar duration_;
97 
98  //- Number of parcels to introduce per second []
99  const label parcelsPerSecond_;
100 
101  //- Velocity type
102  const velocityType velocityType_;
103 
104  //- Initial parcel velocity [m/s]
105  // Note: Only used for vtFixedValue
106  const vector U0_;
107 
108  //- Flow rate profile relative to SOI []
109  autoPtr<Function1<scalar>> flowRateProfile_;
110 
111  //- Parcel size distribution model
112  const autoPtr<distributionModel> sizeDistribution_;
113 
114  //- Current parcel being processed
115  label currentParceli_;
116 
117  //- Current face being processed
118  label currentFacei_;
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("patchInjection");
125 
126 
127  // Constructors
128 
129  //- Construct from dictionary
131  (
132  const dictionary& dict,
133  CloudType& owner,
134  const word& modelName
135  );
136 
137  //- Construct copy
139 
140  //- Construct and return a clone
142  {
144  (
145  new PatchInjection<CloudType>(*this)
146  );
147  }
148 
149 
150  //- Destructor
151  virtual ~PatchInjection() = default;
152 
153 
154  // Member Functions
155 
156  //- Inherit updateMesh from patchInjectionBase
158 
159  //- Set injector locations when mesh is updated
160  virtual void updateMesh();
161 
162  //- Return the end-of-injection time
163  virtual scalar timeEnd() const;
164 
165  //- Number of parcels to introduce relative to SOI
166  virtual label parcelsToInject(const scalar time0, const scalar time1);
167 
168  //- Volume of parcels to introduce relative to SOI
169  virtual scalar volumeToInject(const scalar time0, const scalar time1);
170 
171 
172  // Injection geometry
173 
174  //- Inherit setPositionAndCell from patchInjectionBase
176 
177  //- Set the injection position and owner cell, tetFace and tetPt
178  virtual void setPositionAndCell
179  (
180  const label parcelI,
181  const label nParcels,
182  const scalar time,
183  vector& position,
184  label& cellOwner,
185  label& tetFacei,
186  label& tetPti
187  );
188 
189  virtual void setProperties
190  (
191  const label parcelI,
192  const label nParcels,
193  const scalar time,
194  typename CloudType::parcelType& parcel
195  );
196 
197  //- Flag to identify whether model fully describes the parcel
198  virtual bool fullyDescribed() const;
199 
200  //- Return flag to identify whether or not injection of parcelI is
201  // permitted
202  virtual bool validInjection(const label parcelI);
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
213  #include "PatchInjection.C"
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Foam::PatchInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: PatchInjection.C:292
Foam::Enum< velocityType >
Foam::PatchInjection::velocityType
velocityType
Velocity type enumeration.
Definition: PatchInjection.H:79
Foam::PatchInjection::~PatchInjection
virtual ~PatchInjection()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::PatchInjection::vtFixedValue
User supplied fixed value.
Definition: PatchInjection.H:81
Foam::PatchInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: PatchInjection.C:144
Foam::PatchInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: PatchInjection.C:299
Foam::PatchInjection::TypeName
TypeName("patchInjection")
Runtime type information.
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::PatchInjection::PatchInjection
PatchInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: PatchInjection.C:47
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:192
Foam::patchInjectionBase::setPositionAndCell
label 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::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:123
Foam::PatchInjection::velocityTypeNames_
static const Enum< velocityType > velocityTypeNames_
Velocity type names.
Definition: PatchInjection.H:87
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
patchInjectionBase.H
Foam::PatchInjection
Patch injection.
Definition: PatchInjection.H:69
Foam::PatchInjection::timeEnd
virtual scalar timeEnd() const
Return the end-of-injection time.
Definition: PatchInjection.C:136
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:140
Foam::Vector< scalar >
Foam::patchInjectionBase
Definition: patchInjectionBase.H:64
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:218
Foam::PatchInjection::vtPatchValue
Patch face values.
Definition: PatchInjection.H:82
Foam::PatchInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: PatchInjection.C:176
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:129
Foam::PatchInjection::vtZeroGradient
Patch internal cell values.
Definition: PatchInjection.H:83