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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::PatchInjection
29
30Group
31 grpLagrangianIntermediateInjectionSubModels
32
33Description
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
47SourceFiles
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
60namespace Foam
61{
62
63class distributionModel;
64
65/*---------------------------------------------------------------------------*\
66 Class PatchInjection Declaration
67\*---------------------------------------------------------------------------*/
68
69template<class CloudType>
71:
72 public InjectionModel<CloudType>,
74{
75public:
76
77 // Public Data Types
78
79 //- Velocity type enumeration
80 enum velocityType
81 {
85 };
86
87 //- Velocity type names
89
90
91private:
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
121public:
122
123 //- Runtime type information
124 TypeName("patchInjection");
125
126
127 // Constructors
128
129 //- Construct from dictionary
131 (
132 const dictionary& dict,
134 const word& modelName
135 );
136
137 //- Construct copy
139
140 //- Construct and return a clone
142 {
144 (
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// ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
Templated injection model class.
Patch injection.
TypeName("patchInjection")
Runtime type information.
velocityType
Velocity type enumeration.
@ vtFixedValue
User supplied fixed value.
@ vtPatchValue
Patch face values.
@ vtZeroGradient
Patch internal cell values.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual ~PatchInjection()=default
Destructor.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
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.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
static const Enum< velocityType > velocityTypeNames_
Velocity type names.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual scalar timeEnd() const
Return the end-of-injection time.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
void updateMesh()
Update for new mesh topology.
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.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73