mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: avoid floating point comparison with uint8_t in DSMCCloud
This commit is contained in:
@ -997,35 +997,32 @@ 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>())
|
(
|
||||||
*physicoChemical::k.value()*temperature;
|
-log(rndGen_.sample01<scalar>())
|
||||||
|
*physicoChemical::k.value()*temperature
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
const scalar a = 0.5*iDof - 1;
|
||||||
|
scalar energyRatio = 0;
|
||||||
|
scalar P = -1;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
scalar a = 0.5*iDof - 1;
|
energyRatio = 10*rndGen_.sample01<scalar>();
|
||||||
scalar energyRatio;
|
P = pow((energyRatio/a), a)*exp(a - energyRatio);
|
||||||
scalar P = -1;
|
} while (P < rndGen_.sample01<scalar>());
|
||||||
|
|
||||||
do
|
return energyRatio*physicoChemical::k.value()*temperature;
|
||||||
{
|
|
||||||
energyRatio = 10*rndGen_.sample01<scalar>();
|
|
||||||
P = pow((energyRatio/a), a)*exp(a - energyRatio);
|
|
||||||
} while (P < rndGen_.sample01<scalar>());
|
|
||||||
|
|
||||||
Ei = energyRatio*physicoChemical::k.value()*temperature;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ei;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user