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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::InjectedParticleInjection
28 
29 Description
30  Replays an set of particle data based on an injectedParticleCloud, using
31  the assumption of one particle per parcel.
32 
33 Usage
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 
47 SourceFiles
48  InjectedParticleInjection.C
49 
50 See 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 
66 namespace Foam
67 {
68 
69 class injectedParticleCloud;
70 
71 /*---------------------------------------------------------------------------*\
72  Class InjectedParticleInjection Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 template<class CloudType>
77 :
78  public InjectionModel<CloudType>
79 {
80 protected:
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]
109  vectorList U_;
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 
127 public:
128 
129  //- Runtime type information
130  TypeName("injectedParticleInjection");
131 
132 
133  // Constructors
134 
135  //- Construct from dictionary
137  (
138  const dictionary& dict,
139  CloudType& owner,
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
223 # include "InjectedParticleInjection.C"
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Foam::InjectedParticleInjection::positionOffset_
vector positionOffset_
Position offset to apply to input positions.
Definition: InjectedParticleInjection.H:102
Foam::InjectedParticleInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: InjectedParticleInjection.C:294
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
vectorList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::InjectedParticleInjection::volume_
scalarList volume_
List of volume per particle [m3].
Definition: InjectedParticleInjection.H:111
Foam::InjectedParticleInjection::currentParticlei_
label currentParticlei_
Index of current particle.
Definition: InjectedParticleInjection.H:117
Foam::InjectedParticleInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: InjectedParticleInjection.C:354
Foam::InjectedParticleInjection::injectorCells_
labelList injectorCells_
List of cell label per injector.
Definition: InjectedParticleInjection.H:87
Foam::InjectedParticleInjection::injectorTetPts_
labelList injectorTetPts_
List of tetPt label per injector.
Definition: InjectedParticleInjection.H:93
Foam::InjectedParticleInjection::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: InjectedParticleInjection.C:314
Foam::InjectedParticleInjection::TypeName
TypeName("injectedParticleInjection")
Runtime type information.
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::InjectedParticleInjection
Replays an set of particle data based on an injectedParticleCloud, using the assumption of one partic...
Definition: InjectedParticleInjection.H:75
Foam::InjectedParticleInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: InjectedParticleInjection.H:149
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::InjectedParticleInjection::U_
vectorList U_
List of velocity per particle [m/s].
Definition: InjectedParticleInjection.H:108
Foam::InjectedParticleInjection::setProperties
virtual void setProperties(const label parceli, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: InjectedParticleInjection.C:338
Foam::InjectedParticleInjection::validInjection
virtual bool validInjection(const label parceli)
Return flag to identify whether or not injection of parcelI is.
Definition: InjectedParticleInjection.C:362
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Switch.H
InjectedParticleInjection.C
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::InjectedParticleInjection::diameter_
scalarList diameter_
List of diameter per particle [m].
Definition: InjectedParticleInjection.H:105
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::InjectedParticleInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: InjectedParticleInjection.C:266
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::InjectedParticleInjection::position_
vectorList position_
List of position per particle [m].
Definition: InjectedParticleInjection.H:99
Foam::InjectedParticleInjection::initialise
void initialise()
Initialise injectors.
Definition: InjectedParticleInjection.C:38
Foam::InjectedParticleInjection::info
void info(Ostream &os)
Write injection info to stream.
Definition: InjectedParticleInjection.C:371
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::InjectedParticleInjection::InjectedParticleInjection
InjectedParticleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: InjectedParticleInjection.C:144
Foam::Vector< scalar >
Foam::List< label >
Foam::InjectedParticleInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: InjectedParticleInjection.C:274
Foam::InjectedParticleInjection::cloudName_
const word cloudName_
Name of cloud used to seed the new particles.
Definition: InjectedParticleInjection.H:84
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::InjectedParticleInjection::~InjectedParticleInjection
virtual ~InjectedParticleInjection()=default
Destructor.
Foam::InjectedParticleInjection::ignoreOutOfBounds_
Switch ignoreOutOfBounds_
Flag to suppress errors if particle injection site is out-of-bounds.
Definition: InjectedParticleInjection.H:114
Foam::InjectedParticleInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: InjectedParticleInjection.C:223
Foam::InjectedParticleInjection::time_
scalarList time_
List of injection time per particle [s].
Definition: InjectedParticleInjection.H:96
Foam::InjectedParticleInjection::injectorTetFaces_
labelList injectorTetFaces_
List of tetFace label per injector.
Definition: InjectedParticleInjection.H:90