PatchFlowRateInjection: Corrected parallel handling of the random position
Resolves bug-report http://bugs.openfoam.org/view.php?id=2111
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user