Commit 2afd807f authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: avoid floating point comparison with uint8_t in DSMCCloud

parent 688ff626
...@@ -997,23 +997,23 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy ...@@ -997,23 +997,23 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy
direction iDof direction iDof
) )
{ {
scalar Ei = 0.0; if (iDof == 0)
if (iDof < SMALL)
{ {
return Ei; return 0;
} }
else if (iDof < 2.0 + SMALL && iDof > 2.0 - SMALL) else if (iDof == 2)
{ {
// Special case for iDof = 2, i.e. diatomics; // Special case for iDof = 2, i.e. diatomics;
Ei = return
(
-log(rndGen_.sample01<scalar>()) -log(rndGen_.sample01<scalar>())
*physicoChemical::k.value()*temperature; *physicoChemical::k.value()*temperature
);
} }
else
{
scalar a = 0.5*iDof - 1; const scalar a = 0.5*iDof - 1;
scalar energyRatio; scalar energyRatio = 0;
scalar P = -1; scalar P = -1;
do do
...@@ -1022,10 +1022,7 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy ...@@ -1022,10 +1022,7 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy
P = pow((energyRatio/a), a)*exp(a - energyRatio); P = pow((energyRatio/a), a)*exp(a - energyRatio);
} while (P < rndGen_.sample01<scalar>()); } while (P < rndGen_.sample01<scalar>());
Ei = energyRatio*physicoChemical::k.value()*temperature; return energyRatio*physicoChemical::k.value()*temperature;
}
return Ei;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment