Repository navigation
Avoid writing subnormal nuclide densities to XML - #3144
Conversation
|
This looks good to me and solves the issue. Slightly related question, why do we write out these zero value nuclides at all. Would another approach be to not write out a nuclide if the value is zero. Are we reading in h5 cross sections that are not needed? |
|
@shimwell That's a very good point. Perhaps this is something we should intercept at the time |
|
Would removal of these up front in |
|
@pshriwise yeah, there are possibly situations where it could cause weirdness, so I'd like us to think through them more (and as part of a separate issue/PR). The change here is strictly to ensure that OpenMC doesn't crash but otherwise doesn't meaningfully change current behavior. |
pshriwise
left a comment
There was a problem hiding this comment.
LGTM. Thanks @paulromano
Description
Sometimes depleting a model can result in extremely low nuclide densities that are represented as subnormal floating point values. If these end up getting written to XML, OpenMC crashes trying to read them in because
std::stodwill throw an exception on a subnormal float. This PR fixes this by explicitly converting subnormal values to zero when exporting XML.Checklist
I have run clang-format (version 15) on any C++ source files (if applicable)I have made corresponding changes to the documentation (if applicable)