# Issue in a depletion analysis

**URL:** <https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138>\
**Category:** User Support\
**Created:** [April 15, 2021, 4:06pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138 "2021-04-15T16:06:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/javier_gonzalez/32/1095_2.png) [@Javier\_Gonzalez](https://openmc.discourse.group/u/Javier_Gonzalez)\
**Post date:** [April 15, 2021, 4:06pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/1 "2021-04-15T16:06:06Z")

</div>

Hi all

I am having an issue in a depletion analysis. I created a library from random ENDF files (taken from [TENDL](https://tendl.web.psi.ch/tendl_2017/tendl2017.html)). 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](https://drive.google.com/drive/folders/1U56PEHJAEr2N3GoDRtgGrrPDMq7qEYKP?usp=sharing)

Any idea why this is happening?

Thanks,  
Javier

---

<div class="post-metadata">

**Author:** ![gridley](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/gridley/32/1064_2.png) [@gridley](https://openmc.discourse.group/u/gridley)\
**Post date:** [April 16, 2021, 2:55pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/2 "2021-04-16T14:55:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/javier_gonzalez/32/1095_2.png) [@Javier\_Gonzalez](https://openmc.discourse.group/u/Javier_Gonzalez)\
**Post date:** [April 16, 2021, 3:01pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/3 "2021-04-16T15:01:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/javier_gonzalez/32/1095_2.png) [@Javier\_Gonzalez](https://openmc.discourse.group/u/Javier_Gonzalez)\
**Post date:** [April 16, 2021, 3:03pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/4 "2021-04-16T15:03:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [April 19, 2021, 12:06pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/5 "2021-04-19T12:06:36Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/javier_gonzalez/32/1095_2.png) [@Javier\_Gonzalez](https://openmc.discourse.group/u/Javier_Gonzalez)\
**Post date:** [April 19, 2021, 2:57pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/6 "2021-04-19T14:57:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [April 19, 2021, 3:43pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/7 "2021-04-19T15:43:03Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/javier_gonzalez/32/1095_2.png) [@Javier\_Gonzalez](https://openmc.discourse.group/u/Javier_Gonzalez)\
**Post date:** [April 19, 2021, 3:44pm UTC](https://openmc.discourse.group/t/issue-in-a-depletion-analysis/1138/8 "2021-04-19T15:44:44Z")

</div>

Okay, will try that way.
