diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C index 81be9ea9ceff69c05f886e0b030d62f46e059090..4703885b37aaa1b1bce6c5fdf2cf7d936be19102 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchFlowRateInjection/PatchFlowRateInjection.C @@ -161,6 +161,9 @@ Foam::label Foam::PatchFlowRateInjection<CloudType>::parcelsToInject scalar c = concentration_.value(0.5*(time0 + time1)); scalar nParcels = parcelConcentration_*c*flowRate()*dt; + + cachedRandom& rnd = this->owner().rndGen(); + label nParcelsToInject = floor(nParcels); // Inject an additional parcel with a probability based on the @@ -170,7 +173,7 @@ Foam::label Foam::PatchFlowRateInjection<CloudType>::parcelsToInject nParcelsToInject > 0 && ( nParcels - scalar(nParcelsToInject) - > this->owner().rndGen().position(scalar(0), scalar(1)) + > rnd.globalPosition(scalar(0), scalar(1)) ) ) { @@ -242,10 +245,10 @@ void Foam::PatchFlowRateInjection<CloudType>::setProperties typename CloudType::parcelType& parcel ) { - // set particle velocity to carrier velocity + // Set particle velocity to carrier velocity parcel.U() = this->owner().U()[parcel.cell()]; - // set particle diameter + // Set particle diameter parcel.d() = sizeDistribution_->sample(); } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C index 82d56739dc19842dd3428545e25d47632313b3df..a83812ab010aa384bd2b6b230841a68863cdd526 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C @@ -156,14 +156,7 @@ void Foam::patchInjectionBase::setPositionAndCell label& tetPtI ) { - scalar areaFraction = 0; - - if (Pstream::master()) - { - areaFraction = rnd.position<scalar>(0, patchArea_); - } - - Pstream::scatter(areaFraction); + scalar areaFraction = rnd.globalPosition(scalar(0), patchArea_); if (cellOwners_.size() > 0) {