Added probabilistic insertion of an additional particle on a face proportional to the remainder after taking the integer part.

This commit is contained in:
graham
2009-04-17 13:59:09 +01:00
parent d544973b14
commit e0eafb9773

View File

@ -249,9 +249,16 @@ void Foam::FreeStream<CloudType>::inflow()
{
scalar& faceAccumulator = pFA[i][f];
// Number of particles to insert
// Number of whole particles to insert
label nI = max(label(faceAccumulator), 0);
// Add another particle with a probability proportional to the
// remainder of taking the integer part of faceAccumulator
if ((faceAccumulator - nI) > rndGen.scalar01())
{
nI++;
}
faceAccumulator -= nI;
label typeId = moleculeTypeIds_[i];