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

chain_simple.xml missing Cs136 <nuclide> entry #15

Closed
lewisgross1296 opened this issue Aug 29, 2023 · 6 comments
Closed

chain_simple.xml missing Cs136 <nuclide> entry #15

lewisgross1296 opened this issue Aug 29, 2023 · 6 comments

Comments

@lewisgross1296
Copy link
Contributor

lewisgross1296 commented Aug 29, 2023

I recently attempted to run the depletion.ipynb, but got an error

Creating state point openmc_simulation_n0.h5...
Traceback (most recent call last):
  File "/home/lgross/gcmr/depletion/test_notebook/depletion.py", line 46, in <module>
    integrator.integrate()
  File "/home/lgross/openmc/openmc/deplete/abc.py", line 809, in integrate
    proc_time, conc_list, res_list = self(conc, res.rates, dt, source_rate, i)
  File "/home/lgross/openmc/openmc/deplete/integrators.py", line 56, in __call__
    proc_time, conc_end = self._timed_deplete(conc, rates, dt)
  File "/home/lgross/openmc/openmc/deplete/abc.py", line 704, in _timed_deplete
    results = deplete(
  File "/home/lgross/openmc/openmc/deplete/pool.py", line 66, in deplete
    x_result = list(pool.starmap(func, inputs))
  File "/home/lgross/.pyenv/versions/3.10.5/lib/python3.10/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/home/lgross/.pyenv/versions/3.10.5/lib/python3.10/multiprocessing/pool.py", line 475, in _map_async
    iterable = list(iterable)
  File "/home/lgross/openmc/openmc/deplete/chain.py", line 679, in form_matrix
    k = self.nuclide_dict[target]
KeyError: 'Cs136'

With help from @pshriwise, we realized that #11 added nuclear data to chain_simple.xml that was not initially present when depletion.ipynb was run. Essentially what happened was that data for Cs137 was added with a reaction pathway for Cs136 without adding a Cs136 <nuclide> entry in the XML file. Thus, data for Cs136 is never loaded into the nuclide_dict, despite being produced from Cs137, causing the error.

I will fix this in a PR by creating a new chain file from the API that will allow depltion.ipynb to run without breaking gamma-detector.ipynb.

@pshriwise
Copy link
Contributor

And I will ensure that this is fixed by making sure CI runs properly 😄

@lewisgross1296
Copy link
Contributor Author

@paulromano @cfichtlscherer I see two commits that touched chain_simple.xml involving you both. Now that CI is running, the depletion notebook is one that is failing. I was about to open a PR to add a working chain file, but wanted to know a little bit more about the requirements of the gamma-detector.ipynb.

Using this chain file, the depletion notebook works locally for me, but I think pushing that will break Christopher's contribution in #11, due to lack of Cs137. I attempted to make a simplified chain containing all the depletion.ipynb isotopes plus Cs137 using openmc.deplete.Chain.reduce(), but it produced something 1800+ lines long (which I would not call a simple chain 😄). See below

import openmc
import openmc.deplete

simple_chain = openmc.deplete.Chain().from_xml("casl_chain.xml")
simple_chain.reduce(['I135','Xe135','Xe136','Cs135','Cs137','Gd157','Gd156','U234','U235','U238'],level=1)
simple_chain.export_to_xml("chain_simple.xml")

Is the original chain file made using reduce, or was it specially constructed? The best solution may be to manually add nuclide entries for all reaction targets in the current file, but if it could be automated, that would be better.

@cfichtlscherer
Copy link

Hi Lewis,

I am sorry, I should habe checked all the other notebooks after changing the chain_simple.xml that was my misstake.

I changed the chain_simple.xml by manually, meaning I copied the needed parts for Cs137, Ba137 and Ba137m from the big depletion chain. I thought this would be enough. I now see that the problem was, that we, by adding Cs137, also have reactions that lead to isotopes not presented in the chain.

As a solution we could add these missing isotopes (Cs136, Xe137, I134, Cs138, Cs138m, Ba136, Ba135, Ba138, Xe134) without any data as it was done already for Cs135 as an example:

<nuclide name="Cs135" decay_modes="0" reactions="0" />

Another option would be to remove the reactions from Cs137.

Anyway both of these solutions would manipulate the chain manually. Maybe it is better to look into the openmc.deplete.Chain.reduce() function.

Let me know what you think.

@pshriwise
Copy link
Contributor

No worries about checking the other notebooks, @cfichtlscherer! CI is supposed to be doing that for us but we recently discovered that the workflow was disabled due to inactivity. It should be up and running again now.

@lewisgross1296 it seems the quickest solution might be to add these "termination nuclides" to chain_simple.xml manually for now since this chain is a special case.

@lewisgross1296
Copy link
Contributor Author

Hi Lewis,

I am sorry, I should habe checked all the other notebooks after changing the chain_simple.xml that was my misstake.

I changed the chain_simple.xml by manually, meaning I copied the needed parts for Cs137, Ba137 and Ba137m from the big depletion chain. I thought this would be enough. I now see that the problem was, that we, by adding Cs137, also have reactions that lead to isotopes not presented in the chain.

As a solution we could add these missing isotopes (Cs136, Xe137, I134, Cs138, Cs138m, Ba136, Ba135, Ba138, Xe134) without any data as it was done already for Cs135 as an example:

<nuclide name="Cs135" decay_modes="0" reactions="0" />

Another option would be to remove the reactions from Cs137.

Anyway both of these solutions would manipulate the chain manually. Maybe it is better to look into the openmc.deplete.Chain.reduce() function.

Let me know what you think.

Thanks for listing the isotopes needed and providing an example line! I've just opened a PR, so we can transfer discussion to #16. I don't think I can request review fsr, but @cfichtlscherer I'm looking for your feedback on one small thing there.

@pshriwise
Copy link
Contributor

Resolved by #22

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.

3 participants