Create a depletion chain .xml file.

Hello everyone!

I have recently started using OpenMC. I have installed the 11-dev version, for running depletion calculations and I have used the simple-chain.xml file that came with the code. I would like to include some additional nuclides in the depletion chain, but I have not been able to understand how to create a new depletion chain using the python API. The documentation online is a bit too. Does anyone have some example code on how to do this?

Best Regards,
Sindre

Hi Sindre,

There are two scripts in the OpenMC repository for generating depletion chains. One is called openmc-make-depletion-chain and will construct a full depletion chain based on all available data in ENDF/B-VII.1. That is probably overkill for most applications since it will result in the chain having 1000s of nuclides. A more reasonable option is to use openmc-make-depletion-chain-casl which generates a depletion chain with 200-300 nuclides and is based on the chain that was developed in the CASL/VERA project. A few special notes that you should consider in getting accurate results:

  • By default, OpenMC will use the reaction Q values in the chain file for determining energy deposition. Since these don’t account for indirect energy deposition (from things like capture reactions), the Q values tend to be too small. This would result in a core depleting too fast since a higher reaction rate is needed to compensate for the lower Q value. You can set the Q values directly with the fission_q argument to Operator.
  • The CASL chain doesn’t include information about capture branching ratios. These can be modified by using the Chain.set_capture_branches method that was recently added.

For the next release, we will likely post a pre-generated depletion chain at openmc.org so that users don’t have to worry about this. Until then, let us know if you have questions.

Best regards,
Paul

Hi everyone,
I wish to understand how to generate a depletion chain. For this purpose, I downloaded from the National Nuclear Data Center the sub-libraries: Neutron Reaction, Neutron Induced Fission Product Yields, and Decay Reaction. I have them in three different folders along with the attached script to try to generate the depletion chain. When executing the script (not sure if it is correct), I am getting errors:


File “/home/javier/Documents/OpenMC/NuclearData/ENDFB7.1_Chain/create_dep_chain.py”, line 37, in
chain = openmc.deplete.Chain.from_endf(decay_files,fpy_files,neutron_files,progress=True)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/deplete/chain.py”, line 285, in from_endf
evaluation = openmc.data.endf.Evaluation(f)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/data/endf.py”, line 393, in init
fh = open(str(filename_or_obj), ‘r’)
FileNotFoundError: [Errno 2] No such file or directory: ‘n-095_Am_242.endf’


Please, any recommendations?
Thanks,
Javier
create_chain.py (1.4 KB)

Hi @Javier_Gonzalez

Hope you’re doing well!

Because Python method listdir() returns a list containing items in the directory not the path of those endf files.

import glob
decay_files = glob.glob('/path/to/ENDF-B-VII.1-decay/*endf')
fpy_files = glob.glob('/path/to/ENDF-B-VII.1-nfy/*endf')
neutron_files = glob.glob('/path/to/ENDF-B-VII.1-neutrons/*endf')

create_chain.py (1.4 KB)

Hey @Pranto, you are completely right, I was not indicating the specific ENDF files.

Another question. For instance, in my model, I have materials with nuclides such as U235, U238, O16, Si28, C0, Li6, Be9, F19, etc., and based on those nuclides I wish to generate a depletion chain. As above-mentioned, I have three folders that contain the sub-libraries: in the Neutron Reaction folder there are n files, in the FPY folder there are m files (m<n), and in the Decay folder there are k files (m<n<k).

There are nuclides for which I have files in the three folders (e.g., U235), however for other nuclides (e.g., O16) I do not have FPY files. My question is, what should I do in the latter case?

I imagine there will be an error when

openmc.deplete.Chain.from_endf(decay_file,fpy_file,neutron_file,progress=True)

is called because the fpy_file has not been indicated.

Thanks,
Javier

@Javier_Gonzalez You can use chain.reduce() method to reduce the size of the depletion chain.

import openmc.deplete
chain = openmc.deplete.Chain.from_xml('chain_casl_pwr.xml')
red = chain.reduce(['U235', 'U238', 'Si28'], 0) # you'll get a chain just containing U235, U238, Si28 only
red.export_to_xml('simple.xml')

You can use level to control your search.

red = chain.reduce(['U235', 'U238', 'Si28'], 2)

You can find more details here.

Hope this will help!

Hi @Pranto,

Thanks for the recommendation, unfortunately that is not answering my question. My intention is to use ENDF files from the TENDL or JEFF libraries, that’s why I wish to know how to use openmc.deplete.Chain.from_endf.

Thank you again,
Javier

You should not expect any errors because you are missing fission product yield (FPY) data for non-fissile isotopes like oxygen. The depletion chains built and provided via https://openmc.org/depletion-chains/ are built using a similar approach

Understood @andrewjohnson. I am trying with the script and ENDF files in this folder, and am getting the following error:

===============
Traceback (most recent call last):
File “/home/javier/Documents/OpenMC/NuclearData/ENDFB7.1_Chain/create_chain.py”, line 41, in
chain = openmc.deplete.Chain.from_endf(decay_file,fpy_file,neutron_file,progress=True)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/deplete/chain.py”, line 285, in from_endf
evaluation = openmc.data.endf.Evaluation(f)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/data/endf.py”, line 393, in init
fh = open(str(filename_or_obj), ‘r’)
FileNotFoundError: [Errno 2] No such file or directory: ‘n’

===============

Please, any recommendations?

Looking at that folder, I only see a single decay, FPY, and neutron file for U235. In general, you’ll need to have multiple ENDF files for each category (decay, FPY, neutron). Each of the decay_file, fpy_file, and neutron_file arguments should be a list of strings (indicating file paths of each ENDF file).

Hi @paulromano, I had included only 3 files in case someone wanted to try and I thought it was possible to do it with few files. Now I have uploaded the 3 folders (decay, FPY, and neutron), each with multiple ENDF files, and the updated script. Still getting this error:

===========================
File “/home/javier/Documents/OpenMC/NuclearData/ENDFB7.1_Chain/create_chain.py”, line 60, in
chain = openmc.deplete.Chain.from_endf(decay_file,fpy_file,neutron_file,progress=True)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/deplete/chain.py”, line 285, in from_endf
evaluation = openmc.data.endf.Evaluation(f)
File “/home/javier/anaconda3/lib/python3.8/site-packages/openmc/data/endf.py”, line 393, in init
fh = open(str(filename_or_obj), ‘r’)
FileNotFoundError: [Errno 2] No such file or directory: ‘ENDF-B-VII.1-neutron/n-001_H_001.endf’

===========================

Any recommendation is appreciated. Thanks.

The error mentions a ENDF-B-VII.1-neutron/ directory but it looks like you have a ENDF-B-VII.1-neutrons/ directory.

Yes @paulromano, you are completely right. Now it is working. Thanks for noticing it!