InjectedParticleInjection.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-2019 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::InjectedParticleInjection
28
29Description
30 Replays an set of particle data based on an injectedParticleCloud, using
31 the assumption of one particle per parcel.
32
33Usage
34 \verbatim
35 model1
36 {
37 type injectedParticleInjection;
38 SOI 0;
39 massTotal 0; // Place holder only
40 parcelBasisType fixed;
41 nParticle 1; // 1 particle per parcel
42 cloud eulerianParticleCloud;
43 positionOffset (-0.025 2 -0.025);
44 }
45 \endverbatim
46
47SourceFiles
48 InjectedParticleInjection.C
49
50See also
51 Foam::injectedParticle
52 Foam::injectedParticleCloud
53 Foam::functionObjects::extractEulerianParticles
54
55\*---------------------------------------------------------------------------*/
56
57#ifndef InjectedParticleInjection_H
58#define InjectedParticleInjection_H
59
60#include "InjectionModel.H"
61#include "Switch.H"
62#include "vectorList.H"
63
64// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65
66namespace Foam
67{
68
69class injectedParticleCloud;
70
71/*---------------------------------------------------------------------------*\
72 Class InjectedParticleInjection Declaration
73\*---------------------------------------------------------------------------*/
74
75template<class CloudType>
77:
78 public InjectionModel<CloudType>
79{
80protected:
81
82 // Protected data
83
84 //- Name of cloud used to seed the new particles
85 const word cloudName_;
86
87 //- List of cell label per injector
89
90 //- List of tetFace label per injector
92
93 //- List of tetPt label per injector
95
96 //- List of injection time per particle [s]
98
99 //- List of position per particle [m]
101
102 //- Position offset to apply to input positions
104
105 //- List of diameter per particle [m]
107
108 //- List of velocity per particle [m/s]
110
111 //- List of volume per particle [m3]
113
114 //- Flag to suppress errors if particle injection site is out-of-bounds
116
117 //- Index of current particle
118 label currentParticlei_;
119
120
121 // Protected Member Functions
122
123 //- Initialise injectors
124 void initialise();
125
126
127public:
128
129 //- Runtime type information
130 TypeName("injectedParticleInjection");
131
132
133 // Constructors
134
135 //- Construct from dictionary
137 (
138 const dictionary& dict,
140 const word& modelName
141 );
142
143 //- Construct copy
145 (
147 );
148
149 //- Construct and return a clone
151 {
153 (
155 );
156 }
157
158
159 //- Destructor
160 virtual ~InjectedParticleInjection() = default;
161
162
163 // Member Functions
164
165 //- Set injector locations when mesh is updated
166 virtual void updateMesh();
167
168 //- Return the end-of-injection time
169 scalar timeEnd() const;
170
171 //- Number of parcels to introduce relative to SOI
172 virtual label parcelsToInject(const scalar time0, const scalar time1);
173
174 //- Volume of parcels to introduce relative to SOI
175 virtual scalar volumeToInject(const scalar time0, const scalar time1);
176
177
178 // Injection geometry
179
180 //- Set the injection position and owner cell, tetFace and tetPt
181 virtual void setPositionAndCell
182 (
183 const label parceli,
184 const label nParcels,
185 const scalar time,
186 vector& position,
187 label& cellOwner,
188 label& tetFacei,
189 label& tetPti
190 );
191
192 //- Set the parcel properties
193 virtual void setProperties
194 (
195 const label parceli,
196 const label nParcels,
197 const scalar time,
198 typename CloudType::parcelType& parcel
199 );
200
201 //- Flag to identify whether model fully describes the parcel
202 virtual bool fullyDescribed() const;
203
204 //- Return flag to identify whether or not injection of parcelI is
205 // permitted
206 virtual bool validInjection(const label parceli);
207
208
209 // I-O
210
211 //- Write injection info to stream
212 void info(Ostream& os);
213};
214
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#ifdef NoRepository
224#endif
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228#endif
229
230// ************************************************************************* //
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
Replays an set of particle data based on an injectedParticleCloud, using the assumption of one partic...
void initialise()
Initialise injectors.
const word cloudName_
Name of cloud used to seed the new particles.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual ~InjectedParticleInjection()=default
Destructor.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
vectorList U_
List of velocity per particle [m/s].
labelList injectorCells_
List of cell label per injector.
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.
vector positionOffset_
Position offset to apply to input positions.
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 void setProperties(const label parceli, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
labelList injectorTetPts_
List of tetPt label per injector.
label currentParticlei_
Index of current particle.
vectorList position_
List of position per particle [m].
Switch ignoreOutOfBounds_
Flag to suppress errors if particle injection site is out-of-bounds.
labelList injectorTetFaces_
List of tetFace label per injector.
TypeName("injectedParticleInjection")
Runtime type information.
scalarList time_
List of injection time per particle [s].
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool validInjection(const label parceli)
Return flag to identify whether or not injection of parcelI is.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
scalarList volume_
List of volume per particle [m3].
scalarList diameter_
List of diameter per particle [m].
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 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