37 template<
class CloudType>
52 time[particlei] =
p.soi();
53 position[particlei] =
p.position() + positionOffset_;
54 diameter[particlei] =
p.d();
67 ListListOps::combine<List<scalar>>
76 ListListOps::combine<List<point>>
85 ListListOps::combine<List<scalar>>
94 ListListOps::combine<List<vector>>
100 nParticles = time.
size();
103 scalar minTime =
min(time);
119 scalar sumVolume = 0;
129 this->volumeTotal_ = sumVolume;
132 Info<<
" Read " << nParticles <<
" particles" <<
endl;
138 template<
class CloudType>
143 const word& modelName
147 cloudName_(this->coeffDict().
lookup(
"cloud")),
151 time_(this->template getModelProperty<
scalarList>(
"time")),
152 position_(this->template getModelProperty<
vectorList>(
"position")),
153 positionOffset_(this->coeffDict().
lookup(
"positionOffset")),
154 diameter_(this->template getModelProperty<
scalarList>(
"diameter")),
155 U_(this->template getModelProperty<
vectorList>(
"U")),
156 volume_(this->template getModelProperty<
scalarList>(
"volume")),
159 this->coeffDict().getOrDefault(
"ignoreOutOfBounds", false)
163 this->template getModelProperty<label>
173 <<
"Injector model: " << this->
modelName()
174 <<
" Parcel basis must be set to fixed" 194 template<
class CloudType>
201 cloudName_(im.cloudName_),
202 injectorCells_(im.injectorCells_),
203 injectorTetFaces_(im.injectorTetFaces_),
204 injectorTetPts_(im.injectorTetPts_),
206 position_(im.position_),
207 positionOffset_(im.positionOffset_),
208 diameter_(im.diameter_),
211 ignoreOutOfBounds_(im.ignoreOutOfBounds_),
212 currentParticlei_(im.currentParticlei_)
218 template<
class CloudType>
223 bitSet keep(position_.size(),
true);
225 forAll(position_, particlei)
229 !this->findCellAtPosition
231 injectorCells_[particlei],
232 injectorTetFaces_[particlei],
233 injectorTetPts_[particlei],
234 position_[particlei],
239 keep.unset(particlei);
256 <<
" particles ignored, out of bounds" <<
endl;
261 template<
class CloudType>
268 template<
class CloudType>
275 label nParticles = 0;
278 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
288 template<
class CloudType>
295 scalar sumVolume = 0;
298 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
300 sumVolume += volume_[particlei];
308 template<
class CloudType>
312 const label nParcels,
325 position = position_[currentParticlei_];
326 cellOwner = injectorCells_[currentParticlei_];
327 tetFacei = injectorTetFaces_[currentParticlei_];
328 tetPti = injectorTetPts_[currentParticlei_];
332 template<
class CloudType>
342 parcel.U() = U_[currentParticlei_];
345 parcel.d() = diameter_[currentParticlei_];
349 template<
class CloudType>
356 template<
class CloudType>
366 template<
class CloudType>
371 if (this->writeTime())
373 this->setModelProperty(
"currentParticlei", currentParticlei_);
374 this->setModelProperty(
"time", time_);
375 this->setModelProperty(
"position", position_);
376 this->setModelProperty(
"diameter", diameter_);
377 this->setModelProperty(
"U", U_);
378 this->setModelProperty(
"volume", volume_);
Different types of constants.
void info()
Write injection info.
virtual bool validInjection(const label parceli)
Return flag to identify whether or not injection of parcelI is.
void size(const label n)
Older name for setAddressableSize.
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 massTotal_
Total mass to inject [kg].
scalarList time_
List of injection time per particle [s].
labelList injectorTetFaces_
List of tetFace label per injector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
InjectedParticleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
Templated injection model class.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Object access operator or list access operator (default is pass-through)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
Primarily stores particle properties so that it can be injected at a later time. Note that this store...
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
Lookup type of boundary radiation properties.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
const word & modelName() const
Return const access to the name of the sub-model.
parcelBasis parcelBasis_
Parcel basis enumeration.
const CloudType & owner() const
Return const access to the owner cloud.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
#define forAll(list, i)
Loop across all elements in list.
Replays an set of particle data based on an injectedParticleCloud, using the assumption of one partic...
label size() const noexcept
The number of elements in table.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
void setSize(const label n)
Alias for resize()
A class for handling words, derived from Foam::string.
A cloud is a registry collection of lagrangian particles.
constexpr scalar pi(M_PI)
labelList injectorCells_
List of cell label per injector.
vectorList position_
List of position per particle [m].
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
virtual void info()
Write injection info.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
scalar timeEnd() const
Return the end-of-injection time.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual linear/tree communicat...
dimensionedScalar pow3(const dimensionedScalar &ds)
labelList injectorTetPts_
List of tetPt label per injector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A List with indirect addressing. Like IndirectList but does not store addressing. ...
void initialise()
Initialise injectors.
virtual void setProperties(const label parceli, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual void updateMesh()
Set injector locations when mesh is updated.
messageStream Info
Information stream (stdout output on master, null elsewhere)
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3] Note: scaled to ensure massTotal is achie...
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Templated base class for dsmc cloud.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
const List< typename ParcelType::constantProperties > & constProps() const
Return all of the constant properties.