Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
2afd807f
Commit
2afd807f
authored
Jan 23, 2019
by
Mark OLESEN
Browse files
STYLE: avoid floating point comparison with uint8_t in DSMCCloud
parent
688ff626
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C
View file @
2afd807f
...
...
@@ -997,35 +997,32 @@ Foam::scalar Foam::DSMCCloud<ParcelType>::equipartitionInternalEnergy
direction
iDof
)
{
scalar
Ei
=
0
.
0
;
if
(
iDof
<
SMALL
)
if
(
iDof
==
0
)
{
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;
Ei
=
-
log
(
rndGen_
.
sample01
<
scalar
>
())
*
physicoChemical
::
k
.
value
()
*
temperature
;
return
(
-
log
(
rndGen_
.
sample01
<
scalar
>
())
*
physicoChemical
::
k
.
value
()
*
temperature
);
}
else
{
scalar
a
=
0
.
5
*
iDof
-
1
;
scalar
energyRatio
;
scalar
P
=
-
1
;
do
{
energyRatio
=
10
*
rndGen_
.
sample01
<
scalar
>
();
P
=
pow
((
energyRatio
/
a
),
a
)
*
exp
(
a
-
energyRatio
);
}
while
(
P
<
rndGen_
.
sample01
<
scalar
>
());
Ei
=
energyRatio
*
physicoChemical
::
k
.
value
()
*
temperature
;
}
const
scalar
a
=
0
.
5
*
iDof
-
1
;
scalar
energyRatio
=
0
;
scalar
P
=
-
1
;
do
{
energyRatio
=
10
*
rndGen_
.
sample01
<
scalar
>
();
P
=
pow
((
energyRatio
/
a
),
a
)
*
exp
(
a
-
energyRatio
);
}
while
(
P
<
rndGen_
.
sample01
<
scalar
>
());
return
Ei
;
return
energyRatio
*
physicoChemical
::
k
.
value
()
*
temperature
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment