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

IncidentPhoton from_ace class broken #2421

Closed
yrrepy opened this issue Mar 10, 2023 · 2 comments · Fixed by #2433
Closed

IncidentPhoton from_ace class broken #2421

yrrepy opened this issue Mar 10, 2023 · 2 comments · Fixed by #2433

Comments

@yrrepy
Copy link
Contributor

yrrepy commented Mar 10, 2023

Update: These two problems are without a doubt coupled:
https://github.com/openmc-dev/data/issues/81
https://github.com/openmc-dev/openmc/issues/2421

It is likely the division errors in the from_ace routine

It appears to me that the IncidentPhoton from_ace class is broken.
https://github.com/openmc-dev/openmc/blob/develop/openmc/data/photon.py

I have tested it using eprdata14 with:
https://github.com/openmc-dev/data/blob/master/convert_mcnp71.py

I have some of my own scripts in a separate workflow, with both eprdata12 and eprdata14 I get the same error.

Only He, Li, Be and B appear to process correctly (in both workflows).
Seems to be some numpy math errors?


Versions:
Python 3.10
OpenMC version: 0.13.3-dev
H5PY version: 3.7.0
numpy version: 1.23.3
pandas version: 1.5.0


Converting: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.30t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.31t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.32t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.33t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.34t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.35t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.36t
Adding: /home/pyoung/Codes/MCNP620/MCNP_DATA/xdata/ENDF71SaB/zr-h.37t
Writing mcnp_endfb71/c_Zr_in_ZrH.h5...
Converting: 1000.14p
Writing mcnp_endfb71/photon/H.h5...
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:203: RuntimeWarning: divide by zero encountered in divide
*np.log(yi1/yi)))
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:203: RuntimeWarning: invalid value encountered in divide
np.log(yi1/yi)))
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:202: RuntimeWarning: invalid value encountered in multiply
y[contained] = (yi
np.exp(np.log(xk/xi)/np.log(xi1/xi)
Converting: 2000.14p
Writing mcnp_endfb71/photon/He.h5...
Converting: 3000.14p
Writing mcnp_endfb71/photon/Li.h5...
Converting: 4000.14p
Writing mcnp_endfb71/photon/Be.h5...
Converting: 5000.14p
Writing mcnp_endfb71/photon/B.h5...
Converting: 6000.14p
Writing mcnp_endfb71/photon/C.h5...
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:203: RuntimeWarning: divide by zero encountered in divide
*np.log(yi1/yi)))
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:203: RuntimeWarning: invalid value encountered in divide
np.log(yi1/yi)))
/home/pyoung/.local/lib/python3.10/site-packages/openmc/data/function.py:202: RuntimeWarning: invalid value encountered in multiply
y[contained] = (yi
np.exp(np.log(xk/xi)/np.log(xi1/xi)

@paulromano
Copy link
Contributor

I dug into this one today and found that what is happening is that the data in the ACE file contains zero cross sections for pair production and by default we treat them as log-log interpolated (makes sense where they are positive but obviously causes problems if there's a zero). In particular, the line that was resulting in this error is this one:

group.create_dataset('xs', data=self.xs(energy))

This was getting triggered on pair production cross sections, which have a 1.022 MeV threshold. I have a fix ready to go that I'll submit momentarily.

@yrrepy
Copy link
Contributor Author

yrrepy commented Mar 24, 2023

Great thanks y'all.
I'll be doing some testing of from_ACE files versus others in the coming weeks.

Friendly reminder that the data libraries will need to be updated.
https://openmc.org/lanl-data-libraries/
openmc-dev/data#81
ENDF7.0
ENDF7.1

I think all the other ACE derived libraries (LANL and Other) don't have photon data (JEFF32, JEFF33, ENDF80). Except for FENDL32 which seems to have been derived from FENDL32 ENDF files.

It's a little bit worrying, it seems no one ever used those ENDF7 libraries and saw the erroneous photon data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants