From a8b37fc4a725db9dcaa7e30efa6b0fad66cca822 Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 13 Apr 2009 13:02:17 +0100 Subject: [PATCH] When iDof = 0, equipartitionInternalEnergy will enter an infinite loop, adding a check and return. --- .../dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index ac3b625638..42a1ba7ea6 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -350,7 +350,7 @@ void Foam::DsmcCloud::collisions() scalar selectedPairs = collisionSelectionRemainder_[celli] - + 0.5*nC*(nC-1)*nParticle_*sigmaTcRMax*deltaT + + 0.5*nC*(nC - 1)*nParticle_*sigmaTcRMax*deltaT /mesh_.cellVolumes()[celli]; label nCandidates(selectedPairs); @@ -859,7 +859,11 @@ Foam::scalar Foam::DsmcCloud::equipartitionInternalEnergy { scalar Ei = 0.0; - if (iDof < 2.0 + SMALL && iDof > 2.0 - SMALL) + if (iDof < SMALL) + { + return Ei; + } + else if (iDof < 2.0 + SMALL && iDof > 2.0 - SMALL) { // Special case for iDof = 2, i.e. diatomics; Ei = -log(rndGen_.scalar01())*kb*temperature;