InjectedParticleDistributionInjection.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) 2015-2016 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::InjectedParticleDistributionInjection
28
29Description
30 Interrogates an injectedParticleCloud to convert the raw particle data
31 into a set of 'binned' injectors.
32
33 The bins are set according to the particle \c tag property, from which:
34 - diameters are converted into \c general distributions with a
35 user-specified bin width
36 - raw velocity and diameter data are resampled and stored to provide
37 variations per injector
38
39 The mass to inject can be set according to the raw input data mass total
40 by using the \c applyDistributionMassTotal switch
41
42
43Usage
44 \verbatim
45 model1
46 {
47 type injectedParticleDistributionInjection;
48 SOI 0;
49 parcelBasisType mass;
50 cloud eulerianParticleCloud;
51 positionOffset (-0.025 2 -0.025);
52 binWidth 0.1e-3;
53 parcelsPerInjector 500;
54 resampleSize 100; // optional
55 applyDistributionMassTotal yes;
56
57 // Placeholder only when using applyDistributionMassTotal
58 massTotal 0;
59 }
60 \endverbatim
61
62Note
63 The each injector location is assumed to be operating under steady
64 conditions, i.e. using a constant flow rate profile
65
66SourceFiles
67 InjectedParticleDistributionInjection.C
68
69See also
70 Foam::injectedParticle
71 Foam::injectedParticleCloud
72 Foam::functionObjects::extractEulerianParticles
73 Foam::distributionModels::general
74
75\*---------------------------------------------------------------------------*/
76
77#ifndef InjectedParticleDistributionInjection_H
78#define InjectedParticleDistributionInjection_H
79
80#include "InjectionModel.H"
81#include "general.H"
82#include "Switch.H"
83#include "vectorList.H"
84
85// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86
87namespace Foam
88{
89
90/*---------------------------------------------------------------------------*\
91 Class InjectedParticleDistributionInjection Declaration
92\*---------------------------------------------------------------------------*/
93
94template<class CloudType>
96:
97 public InjectionModel<CloudType>
98{
99protected:
100
101 // Protected data
102
103 //- Name of cloud used to seed the new particles
104 const word cloudName_;
105
106 //- List of start time per injector
108
109 //- List of end time per injector
111
112 //- List of position per injector
114
115 //- Position offset to apply to input positions
117
118 //- List of volume flow rate per injector [m3/s]
120
121 //- List of parcel velocity per injector
123
124 //- Bin width when generating particle distributions
125 scalar binWidth_;
126
127 //- List of size distribution model per injector
129
130 //- Target number of parcels to inject per injector
131 scalar parcelsPerInjector_;
132
133 //- Resample size
134 label resampleSize_;
135
136 //- Flag to apply mass calculated from distribution instead of
137 // InjectionModel massTotal_
139
140 //- Flag to suppress errors if particle injection site is out-of-bounds
142
143 //- Running total of number of parcels injected
144 label nParcelsInjected_;
145
146 //- Number of parcels injected in last step (local proc only)
147 label nParcelsInjected0_;
148
149 //- Current injector
150 label currentInjectori_;
151
152 //- Current sample
153 label currentSamplei_;
154
155
156 // Protected Member Functions
157
158 //- Initialise injectors
159 void initialise();
160
161
162public:
163
164 //- Runtime type information
165 TypeName("injectedParticleDistributionInjection");
166
167
168 // Constructors
169
170 //- Construct from dictionary
172 (
173 const dictionary& dict,
175 const word& modelName
176 );
177
178 //- Construct copy
180 (
182 );
183
184 //- Construct and return a clone
186 {
188 (
190 );
191 }
192
193
194 //- Destructor
196
197
198 // Member Functions
199
200 //- Set injector locations when mesh is updated
201 virtual void updateMesh();
202
203 //- Return the end-of-injection time
204 scalar timeEnd() const;
205
206 //- Number of parcels to introduce relative to SOI
207 virtual label parcelsToInject(const scalar time0, const scalar time1);
208
209 //- Volume of parcels to introduce relative to SOI
210 virtual scalar volumeToInject(const scalar time0, const scalar time1);
211
212
213 // Injection geometry
214
215 //- Set the injection position and owner cell, tetFace and tetPt
216 virtual void setPositionAndCell
217 (
218 const label parcelI,
219 const label nParcels,
220 const scalar time,
221 vector& position,
222 label& cellOwner,
223 label& tetFaceI,
224 label& tetPtI
225 );
226
227 //- Set the parcel properties
228 virtual void setProperties
229 (
230 const label parcelI,
231 const label nParcels,
232 const scalar time,
233 typename CloudType::parcelType& parcel
234 );
235
236 //- Flag to identify whether model fully describes the parcel
237 virtual bool fullyDescribed() const;
238
239 //- Return flag to identify whether or not injection of parcelI is
240 // permitted
241 virtual bool validInjection(const label parcelI);
242
243
244 // I-O
245
246 //- Write injection info to stream
247 void info(Ostream& os);
248};
249
250
251// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252
253} // End namespace Foam
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257#ifdef NoRepository
259#endif
260
261// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262
263#endif
264
265// ************************************************************************* //
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
Interrogates an injectedParticleCloud to convert the raw particle data into a set of 'binned' injecto...
label nParcelsInjected0_
Number of parcels injected in last step (local proc only)
bool applyDistributionMassTotal_
Flag to apply mass calculated from distribution instead of.
const word cloudName_
Name of cloud used to seed the new particles.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
PtrList< distributionModels::general > sizeDistribution_
List of size distribution model per injector.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
void info(Ostream &os)
Write injection info to stream.
label nParcelsInjected_
Running total of number of parcels injected.
vector positionOffset_
Position offset to apply to input positions.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
scalar binWidth_
Bin width when generating particle distributions.
scalarList volumeFlowRate_
List of volume flow rate per injector [m3/s].
List< vectorList > position_
List of position per injector.
List< vectorList > U_
List of parcel velocity per injector.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
TypeName("injectedParticleDistributionInjection")
Runtime type information.
Switch ignoreOutOfBounds_
Flag to suppress errors if particle injection site is out-of-bounds.
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.
scalar parcelsPerInjector_
Target number of parcels to inject per injector.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
scalar timeEnd() const
Return the end-of-injection time.
Templated injection model class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
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
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
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73