Go to the documentation of this file.
39 template<
class CloudType>
48 generationSetName_(this->coeffDict().
lookup(
"generationCellSet")),
49 inflationSetName_(this->coeffDict().
lookup(
"inflationCellSet")),
52 duration_(this->coeffDict().getScalar(
"duration")),
72 volumeAccumulator_(0.0),
74 selfSeed_(this->coeffDict().getOrDefault(
"selfSeed",
false)),
80 this->coeffDict().subDict(
"sizeDistribution"),
85 duration_ = owner.db().time().userTimeToTime(duration_);
89 this->coeffDict().readEntry(
"dSeed", dSeed_);
92 cellSet generationCells(this->owner().
mesh(), generationSetName_);
94 generationCells_ = generationCells.
toc();
96 cellSet inflationCells(this->owner().
mesh(), inflationSetName_);
99 inflationCells |= generationCells;
101 inflationCells_ = inflationCells.
toc();
105 scalar generationVolume = 0.0;
107 forAll(generationCells_, gCI)
109 label cI = generationCells_[gCI];
114 scalar totalGenerationVolume = generationVolume;
118 fraction_ = generationVolume/totalGenerationVolume;
122 this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_);
123 this->massTotal_ *= fraction_;
127 template<
class CloudType>
134 generationSetName_(im.generationSetName_),
135 inflationSetName_(im.inflationSetName_),
136 generationCells_(im.generationCells_),
137 inflationCells_(im.inflationCells_),
138 duration_(im.duration_),
139 flowRateProfile_(im.flowRateProfile_),
140 growthRate_(im.growthRate_),
141 newParticles_(im.newParticles_),
142 volumeAccumulator_(im.volumeAccumulator_),
143 fraction_(im.fraction_),
144 selfSeed_(im.selfSeed_),
146 sizeDistribution_(im.sizeDistribution_.clone())
152 template<
class CloudType>
159 template<
class CloudType>
164 template<
class CloudType>
167 return this->SOI_ + duration_;
171 template<
class CloudType>
183 scalar gR = growthRate_.value(time1);
185 scalar dT = time1 - time0;
189 forAll(inflationCells_, iCI)
191 label cI = inflationCells_[iCI];
199 scalar dTarget = pPtr->dTarget();
201 pPtr->d() =
min(dTarget, pPtr->d() + gR*dT);
207 newParticles_.clear();
215 if ((time0 >= 0.0) && (time0 < duration_))
217 volumeAccumulator_ +=
218 fraction_*flowRateProfile_.integrate(time0, time1);
224 label maxIterations =
max
227 (10*volumeAccumulator_)
231 label iterationNo = 0;
236 while (!generationCells_.empty() && volumeAccumulator_ > 0)
238 if (iterationNo > maxIterations)
241 <<
"Maximum particle split iterations ("
242 << maxIterations <<
") exceeded" <<
endl;
247 label cI = generationCells_
252 generationCells_.size() - 1
262 if (selfSeed_ && !cellCentresUsed.
found(cI))
264 scalar dNew = sizeDistribution_().sample();
277 cellCentresUsed.
insert(cI);
290 scalar pD = pPtr->d();
293 if ((pD/pPtr->dTarget()) < rnd.
sample01<scalar>())
298 const point pP(pPtr->position());
299 const vector& pU = pPtr->U();
322 scalar
x = a/
sqrt(3.0);
323 scalar r = a/(2.0*
sqrt(6.0));
325 scalar d = a/(2.0*
sqrt(3.0));
327 scalar dNew = sizeDistribution_().sample();
338 volumeAccumulator_ -= volNew;
340 dNew = sizeDistribution_().sample();
349 volumeAccumulator_ -= volNew;
351 dNew = sizeDistribution_().sample();
360 volumeAccumulator_ -= volNew;
362 dNew = sizeDistribution_().sample();
371 volumeAccumulator_ -= volNew;
406 gatheredNewParticles,
413 newParticles_ = combinedNewParticles;
419 return newParticles_.size();
423 template<
class CloudType>
430 if ((time0 >= 0.0) && (time0 < duration_))
432 return fraction_*flowRateProfile_.integrate(time0, time1);
439 template<
class CloudType>
451 position = newParticles_[parcelI].first().first();
453 this->findCellAtPosition
464 template<
class CloudType>
473 parcel.U() = newParticles_[parcelI].first().second();
475 parcel.d() = newParticles_[parcelI].second().first();
477 parcel.dTarget() = newParticles_[parcelI].second().second();
481 template<
class CloudType>
488 template<
class CloudType>
A class for handling words, derived from Foam::string.
InflationInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
static constexpr const zero Zero
Global zero (0)
Type sample01()
Return a sample whose components lie in the range [0,1].
static bool & parRun()
Test if this a parallel run, or allow modify access.
Templated injection model class.
static bool master(const label communicator=worldComm)
Am I the master process.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Inflation injection - creates new particles by splitting existing particles within in a set of genera...
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
Random & rndGen()
Return reference to the random object.
#define forAll(list, i)
Loop across all elements in list.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
#define R(A, B, C, D, E, F, K, M)
const List< DynamicList< molecule * > > & cellOccupancy
const fvMesh & mesh() const
Return reference to the mesh.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
void deleteParticle(ParticleType &p)
Remove particle from cloud and delete.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Lookup type of boundary radiation properties.
Templated base class for dsmc cloud.
const List< DynamicList< ParcelType * > > & cellOccupancy() const
Return the cell occupancy addressing.
virtual ~InflationInjection()
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const scalarField & cellVolumes() const
A collection of cell labels.
Vector< scalar > vector
A scalar version of the templated Vector.
static autoPtr< distributionModel > New(const dictionary &dict, Random &rndGen)
Selector.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
An ordered pair of two objects of type <T> with first() and second() elements.
Type position(const Type &start, const Type &end)
Return a sample on the interval [start,end].
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
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 timeEnd() const
Return the end-of-injection time.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
bool found(const Key &key) const
Return true if hashed entry is found in table.
#define WarningInFunction
Report a warning using Foam::Warning.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
virtual void updateMesh()
Set injector locations when mesh is updated.