DataError:Cross sections were not specified

Hello,
I am new in OpenMC and need some help.
First of all, I successfully downloaded openmc from source, and set up OPENMC_CROSS_SECTIONS environment variable in bashrc file.
However,when I runned the “examples/pincell_depletion/run_depletion.py” on Ubuntu, an error occured:
"Cross sections were not specified in Model.materials and "
openmc.exceptions.DataError: Cross sections were not specified in Model.materials and openmc.config[‘cross_sections’] is not set.

I hope you can help me !

Hi @Zhang! Welcome to the forum!

Sorry to hear you’re having trouble with the depletion run. Does a normal run of OpenMC work for you? The one in examples/pincell/, say?

Hello,

I have the very same problem as @Zhang, I downloaded OpenMC from source and add the OPENMC_CROSS_SECTIONS=/home/user/openmc/data/cross_sections.xml line in my .bashrc.
i have the same problem with the run_depletion.py on Ubuntu so i tried your answer to see if it could help me too.
i got teh followwing error messages:
Traceback (most recent call last):
File “plot_spectrum.py”, line 6, in
with openmc.StatePoint(‘statepoint.100.h5’) as sp:
File “/home/choclocklate/.local/lib/python3.8/site-packages/openmc/statepoint.py”, line 127, in init
self._f = h5py.File(filename, ‘r’)
File “/home/choclocklate/.local/lib/python3.8/site-packages/h5py/_hl/files.py”, line 533, in init
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
File “/home/choclocklate/.local/lib/python3.8/site-packages/h5py/_hl/files.py”, line 226, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File “h5py/_objects.pyx”, line 54, in h5py._objects.with_phil.wrapper
File “h5py/_objects.pyx”, line 55, in h5py._objects.with_phil.wrapper
File “h5py/h5f.pyx”, line 106, in h5py.h5f.open
FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = ‘statepoint.100.h5’, errno = 2, error message = ‘No such file or directory’, flags = 0, o_flags = 0)

I could add taht for the depletion problem i tried another solution that was suggested here How to indicate cross section data - #15 by neonnuke . But it didn’t help either =, python still retrun the same error “openmc.exceptions.DataError: Cross sections were not specified in Model.materials and openmc.config[‘cross_sections’] is not set.”.

i hope you can help me.
(a little bit of precision, i’m new to the Ubuntu environnement).
Best regards

You can set the cross section source by setting openmc.config['cross_sections'] as the error message suggests:

import openmc

openmc.config['cross_sections'] = '/path/to/cross_sections.xml'
...

This should hopefully fix the DataError that you’re running into. More info on configuring data sources can be found in the user’s guide.

1 Like