PatchInjection.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 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 distribution;
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  const scalar duration_;
76 
77  //- Mass flow rate relative to SOI []
78  const TimeFunction1<scalar> massFlowRate_;
79 
80  //- Number of parcels to introduce per second []
81  const TimeFunction1<scalar> parcelsPerSecond_;
82 
83  //- Initial parcel velocity [m/s]
84  const vector U0_;
85 
86  //- Parcel size distribution model
87  const autoPtr<distribution> 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 topoChange from patchInjectionBase
127 
128  //- Set injector locations when mesh is updated
129  virtual void topoChange();
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 nParcelsToInject(const scalar time0, const scalar time1);
136 
137  //- Parcel mass to introduce relative to SOI
138  virtual scalar massToInject(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  barycentric& coordinates,
153  label& celli,
154  label& tetFacei,
155  label& tetPti,
156  label& facei
157  );
158 
159  virtual void setProperties
160  (
161  const label parcelI,
162  const label nParcels,
163  const scalar time,
164  typename CloudType::parcelType& parcel
165  );
166 
167  //- Flag to identify whether model fully describes the parcel
168  virtual bool fullyDescribed() const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #ifdef NoRepository
179  #include "PatchInjection.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
Templated injection model class.
Patch injection.
virtual void topoChange()
Set injector locations when mesh is updated.
TypeName("patchInjection")
Runtime type information.
virtual ~PatchInjection()
Destructor.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
PatchInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Inherit setPositionAndCell from patchInjectionBase.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual label nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual scalar timeEnd() const
Return the end-of-injection time.
virtual scalar massToInject(const scalar time0, const scalar time1)
Parcel mass to introduce relative to SOI.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Base class for patch-based injection models.
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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