Issue in a depletion analysis

Hi all

I am having an issue in a depletion analysis. I created a library from random ENDF files (taken from TENDL). When I run the model without the depletion, it works perfectly. However, when I include the depletion part, I get the error “No cross_sections.xml specified in materials”, although the path to the cross sections is explicitly indicated in materials.xml.

https://drive.google.com/drive/folders/1U56PEHJAEr2N3GoDRtgGrrPDMq7qEYKP?usp=sharing

Any idea why this is happening?

Thanks,
Javier

Have you tried putting the full file path for cross_sections.xml in your python script? It seems you have:

materials.cross_sections = 'Data000/cross_sections.xml'

Maybe something like materials.cross_sections=/home/Javier/Data000/cross_sections.xml would do the trick.

Yes @gridley I have tried that way, and get the same error. Did you try with the files I shared?

I could solve it by exporting the cross sections environment variable, but as I am interested in running different simulations (~150) each with a different nuclear library (Data000, Data001,…Data150), I wish to have the path in the materials.xml

Hi @Javier_Gonzalez. The problem is that when you are running a depletion simulation, the materials.xml file is automatically generated by the Operator class, so even if you write one beforehand, it will get overwritten. As a workaround, I would suggest setting:

settings = openmc.Settings()
settings.cross_sections = ...

which is officially deprecated but still works. As your use case illustrates, it would be nice to have an official option where the cross sections could be set from an depletion operator, or something equivalent.

Thanks @paulromano. I included the line below in the shared python script, but I am still getting the same error.

settings.cross_sections = ‘Data000/cross_sections.xml’

Any other recommendation?

Hmm, yes I see now that using settings.xml won’t work. Here’s another idea — try setting the OPENMC_CROSS_SECTIONS environment variable from the Python script:

import os

os.environ['OPENMC_CROSS_SECTIONS'] = 'Data000/cross_sections.xml'

The Operator class relies on that when it is instantiated, so if you want to run a bunch of depletion simulations from the same script, you’ll have to change os.environ and create a new instance of Operator each time.

Okay, will try that way.