arfc / saltproc

Online reprocessing for molten salt reactors
Other
19 stars 16 forks source link

[Bug]: `DepcodeSerpent.get_nuc_name()` fails with MCNP-style metastable nuc-codes. #171

Closed yardasol closed 1 year ago

yardasol commented 2 years ago

Expected behavior

DepcodeSerpent.get_nuc_name() should be able to run no matter what kind of cross section library the user is using.

Describe the bug

When using ENDF/B VII.1 library with MCNP-style naming, DepcodeSerpent.get_nuc_name() throws an error when it processes a metastable nuclide.

To Reproduce

Steps to reproduce the behavior:

  1. Install SaltProc using this script.
  2. Checkout the openmc-msbr-model branch
  3. Run SaltProc using the msbr_endfb71_main.json

Supporting Informatioon

Interactive debugger output:

$ python -m pdb -m saltproc -i msbr_endfb71_main.json -d 12
> /home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/__main__.py(1)<module>()
-> from saltproc import app
(Pdb) c
Initiating Saltproc:
    Restart = False
    Template File Path  = /home/ooblack/projects/saltproc/examples/msbr/msbr_endfb71.serpent
    Output HDF5 database Path = /home/ooblack/projects/saltproc/examples/msbr/data/msbr_kl_100_saltproc.h5

Previous run output files were deleted.

Step #1 has been started
Running serpent
Finished Serpent2 Run
Traceback (most recent call last):
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/pdb.py", line 1724, in main
    pdb._runmodule(mainpyfile)
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/pdb.py", line 1560, in _runmodule
    self.run(code)
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/bdb.py", line 580, in run
    exec(cmd, globals, locals)
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/__main__.py", line 1, in <module>
    from saltproc import app
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/app.py", line 51, in run
    mats = depcode.read_dep_comp(False)
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/depcode.py", line 776, in read_dep_comp
    self.create_nuclide_name_map_zam_to_serpent()
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/depcode.py", line 703, in create_nuclide_name_map_zam_to_serpent
    iname, zzaaam = self.get_nuc_name(line[2])
  File "/home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/depcode.py", line 645, in get_nuc_name
    zz = pyname.znum(nuc_code)
  File "nucname.pyx", line 241, in pyne.nucname.znum
RuntimeError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/ooblack/projects/saltproc/examples/msbr/nucname.pyx(241)pyne.nucname.znum()
(Pdb) u
> /home/ooblack/miniconda3/envs/saltproc-env/lib/python3.9/site-packages/saltproc/depcode.py(645)get_nuc_name()
-> zz = pyname.znum(nuc_code)
(Pdb) p nuc_code
274580000

System Specifications:

How can this issue be closed?

This issue can be closed when a PR exists that fixes this issue. One possible approach may be to add machinery that allows a user to specify what naming convention their cross-section library is using in the input file (nndc, mcnp, or legacy (using a 3 to indicate metastable states)). Then we could add control flow in the appropriate functions that handle the incoming nuclide codes appropriately.