Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed float decimals v3 #1283

Merged
merged 6 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions armi/reactor/converters/meshConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from armi import runLog
from armi.reactor import grids
from armi.utils import units
keckler marked this conversation as resolved.
Show resolved Hide resolved


class MeshConverter:
Expand Down Expand Up @@ -286,9 +287,11 @@ class not only looks at the block flags axially, but will add new mesh points fo

# Neglect any zero mesh points as zero points are implicit
if b.p.zbottom != 0.0:
meshes.append(round(b.p.zbottom, 8))
meshes.append(
round(b.p.zbottom, units.FLOAT_DIMENSION_DECIMALS)
)
if b.p.ztop != 0.0:
meshes.append(round(b.p.ztop, 8))
meshes.append(round(b.p.ztop, units.FLOAT_DIMENSION_DECIMALS))
axialMeshCoordinates[a].add(min(meshes))
axialMeshCoordinates[a].add(max(meshes))
self.axialMesh = sorted(set(itertools.chain(*axialMeshCoordinates.values())))
Expand Down
4 changes: 2 additions & 2 deletions armi/reactor/reactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,10 +1835,10 @@ def findAllMeshPoints(self, assems=None, applySubMesh=True):
axisVal = float(base[axis]) # convert from numpy.float64
step = float(top[axis] - axisVal) / subdivisions
for _subdivision in range(subdivisions):
collection.add(round(axisVal, 8))
collection.add(round(axisVal, units.FLOAT_DIMENSION_DECIMALS))
axisVal += step
# add top too (only needed for last point)
collection.add(round(axisVal, 8))
collection.add(round(axisVal, units.FLOAT_DIMENSION_DECIMALS))

iMesh, jMesh, kMesh = map(sorted, (iMesh, jMesh, kMesh))

Expand Down
2 changes: 1 addition & 1 deletion armi/utils/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
MIN_FUEL_HM_MOLES_PER_CC = 1e-10

# More than 10 decimals can create floating point comparison problems in MCNP and DIF3D
FLOAT_DIMENSION_DECIMALS = 10
FLOAT_DIMENSION_DECIMALS = 8
EFFECTIVELY_ZERO = 10.0 ** (-1 * FLOAT_DIMENSION_DECIMALS)
keckler marked this conversation as resolved.
Show resolved Hide resolved

#
Expand Down
1 change: 1 addition & 0 deletions doc/release/0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ What's new in ARMI

Bug fixes
---------
#. Changed units.FLOAT_DIMENSION_DECIMALS from 10 to 8 (`PR#1183 <https://github.com/terrapower/armi/pull/1183>`_)
#. Fixed a bug in the ISOTXS file name used for snapshots. (`PR#1277 <https://github.com/terrapower/armi/pull/1277>`_)


Expand Down