From e0eafb9773a6bed2c56f60828d897ebe79a61512 Mon Sep 17 00:00:00 2001 From: graham <g.macpherson@opencfd.co.uk> Date: Fri, 17 Apr 2009 13:59:09 +0100 Subject: [PATCH] Added probabilistic insertion of an additional particle on a face proportional to the remainder after taking the integer part. --- .../InflowBoundaryModel/FreeStream/FreeStream.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C index 58526a048a5..cd18d9064d3 100644 --- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -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]; -- GitLab