37template<
class CloudType>
52 time[particlei] =
p.soi();
54 diameter[particlei] =
p.d();
100 nParticles = time.
size();
103 scalar minTime =
min(time);
119 scalar sumVolume = 0;
132 Info<<
" Read " << nParticles <<
" particles" <<
endl;
138template<
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"
194template<
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_),
218template<
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;
261template<
class CloudType>
268template<
class CloudType>
275 label nParticles = 0;
278 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
288template<
class CloudType>
295 scalar sumVolume = 0;
298 if ((time_[particlei] >= time0) && (time_[particlei] < time1))
300 sumVolume += volume_[particlei];
308template<
class CloudType>
312 const label nParcels,
325 position = position_[currentParticlei_];
332template<
class CloudType>
342 parcel.
U() = U_[currentParticlei_];
349template<
class CloudType>
356template<
class CloudType>
366template<
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_);
const CloudType & owner() const
Return const access to the owner cloud.
virtual bool writeTime() const
Flag to indicate when to write a property.
const List< typename ParcelType::constantProperties > & constProps() const
Return all of the constant properties.
const vector & U() const
Return const access to velocity.
label size() const noexcept
The number of elements in table.
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 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.
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.
scalarList time_
List of injection time per particle [s].
void info()
Write injection info.
InjectedParticleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
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.
parcelBasis parcelBasis_
Parcel basis enumeration.
virtual void info()
Write injection info.
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3] Note: scaled to ensure massTotal is achie...
InjectionModel(CloudType &owner)
Construct null from owner.
scalar massTotal_
Total mass to inject [kg].
virtual bool findCellAtPosition(label &celli, label &tetFacei, label &tetPti, vector &position, bool errorOnNotFound=true)
Find the cell that contains the supplied position.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void setSize(label n)
Alias for resize().
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
bitSet & unset(const bitSet &other)
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the...
A cloud is a registry collection of lagrangian particles.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Primarily stores particle properties so that it can be injected at a later time. Note that this store...
Lookup type of boundary radiation properties.
bool getModelProperty(const word &entryName, Type &value) const
Retrieve generic property from the sub-model.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
const word & modelName() const
Return const access to the name of the sub-model.
void setModelProperty(const word &entryName, const Type &value)
Add generic property to the sub-model.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
constexpr scalar pi(M_PI)
Different types of constants.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
DSMCCloud< dsmcParcel > CloudType
List< label > labelList
A List of labels.
dimensionedScalar pow3(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< vector > vectorList
List of vector.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< scalar > scalarList
List of scalar.
#define forAll(list, i)
Loop across all elements in list.
Object access operator or list access operator (default is pass-through).