Go to the documentation of this file.
38 template<
class CloudType>
53 time[particlei] =
p.soi();
54 position[particlei] =
p.position() + positionOffset_;
55 diameter[particlei] =
p.d();
69 ListListOps::combine<List<scalar>>
79 ListListOps::combine<List<point>>
89 ListListOps::combine<List<scalar>>
99 ListListOps::combine<List<vector>>
105 nParticles = time.size();
108 scalar minTime =
min(time);
124 scalar sumVolume = 0;
134 this->volumeTotal_ = sumVolume;
137 Info<<
" Read " << nParticles <<
" particles" <<
endl;
143 template<
class CloudType>
148 const word& modelName
152 cloudName_(this->coeffDict().
lookup(
"cloud")),
156 time_(this->
template getModelProperty<scalarList>(
"time")),
157 position_(this->
template getModelProperty<vectorList>(
"position")),
158 positionOffset_(this->coeffDict().
lookup(
"positionOffset")),
159 diameter_(this->
template getModelProperty<scalarList>(
"diameter")),
160 U_(this->
template getModelProperty<vectorList>(
"U")),
161 volume_(this->
template getModelProperty<scalarList>(
"volume")),
164 this->coeffDict().getOrDefault(
"ignoreOutOfBounds",
false)
168 this->
template getModelProperty<label>
178 <<
"Injector model: " << this->modelName()
179 <<
" Parcel basis must be set to fixed"
189 injectorCells_.setSize(position_.size());
190 injectorTetFaces_.setSize(position_.size());
191 injectorTetPts_.setSize(position_.size());
195 this->massTotal_ = this->volumeTotal_*this->owner().
constProps().rho0();
199 template<
class CloudType>
223 template<
class CloudType>
228 bitSet keep(position_.size(),
true);
230 forAll(position_, particlei)
234 !this->findCellAtPosition
236 injectorCells_[particlei],
237 injectorTetFaces_[particlei],
238 injectorTetPts_[particlei],
239 position_[particlei],
244 keep.unset(particlei);
260 Info<<
" " << nRejected
261 <<
" particles ignored, out of bounds" <<
endl;
266 template<
class CloudType>
273 template<
class CloudType>
280 label nParticles = 0;
283 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
293 template<
class CloudType>
300 scalar sumVolume = 0;
303 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
305 sumVolume += volume_[particlei];
313 template<
class CloudType>
317 const label nParcels,
330 position = position_[currentParticlei_];
331 cellOwner = injectorCells_[currentParticlei_];
332 tetFacei = injectorTetFaces_[currentParticlei_];
333 tetPti = injectorTetPts_[currentParticlei_];
337 template<
class CloudType>
347 parcel.U() = U_[currentParticlei_];
350 parcel.d() = diameter_[currentParticlei_];
354 template<
class CloudType>
361 template<
class CloudType>
371 template<
class CloudType>
376 if (this->writeTime())
378 this->setModelProperty(
"currentParticlei", currentParticlei_);
379 this->setModelProperty(
"time", time_);
380 this->setModelProperty(
"position", position_);
381 this->setModelProperty(
"diameter", diameter_);
382 this->setModelProperty(
"U", U_);
383 this->setModelProperty(
"volume", volume_);
vector positionOffset_
Position offset to apply to input positions.
label size() const noexcept
The number of elements in table.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual void info(Ostream &os)
Write injection info to stream.
A class for handling words, derived from Foam::string.
scalarList volume_
List of volume per particle [m3].
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const List< typename ParcelType::constantProperties > & constProps() const
Return all of the constant properties.
label currentParticlei_
Index of current particle.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
labelList injectorCells_
List of cell label per injector.
labelList injectorTetPts_
List of tetPt label per injector.
Different types of constants.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
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.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
Templated injection model class.
Replays an set of particle data based on an injectedParticleCloud, using the assumption of one partic...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
vectorList U_
List of velocity per particle [m/s].
virtual void setProperties(const label parceli, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual bool validInjection(const label parceli)
Return flag to identify whether or not injection of parcelI is.
dimensionedScalar pow3(const dimensionedScalar &ds)
messageStream Info
Information stream (uses stdout - output is on the master only)
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
void transfer(List< T > &list)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Templated base class for dsmc cloud.
Primarily stores particle properties so that it can be injected at a later time. Note that this store...
scalarList diameter_
List of diameter per particle [m].
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
scalar timeEnd() const
Return the end-of-injection time.
vectorList position_
List of position per particle [m].
void initialise()
Initialise injectors.
void info(Ostream &os)
Write injection info to stream.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A cloud is a registry collection of lagrangian particles.
InjectedParticleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
constexpr scalar pi(M_PI)
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
const word cloudName_
Name of cloud used to seed the new particles.
A List with indirect addressing.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Switch ignoreOutOfBounds_
Flag to suppress errors if particle injection site is out-of-bounds.
virtual void updateMesh()
Set injector locations when mesh is updated.
scalarList time_
List of injection time per particle [s].
labelList injectorTetFaces_
List of tetFace label per injector.