Cross Section File not specified

I have been trying to replicate the Exercise document “Modeling a Pin-Cell” from OpenMC examples. I have followd all the steps but now facing this error. How to solve this issue?

RuntimeError: No cross_sections.xml file was specified in materials.xml or in the OPENMC_CROSS_SECTIONS environment variable. OpenMC needs such a file to identify where to find data libraries.

There are other solutions regarding this topic but I am not sure how to set OPENMC_CROSS_SECTIONS to be an absolute path.

Either of the following will work:

  • Solution 1:

Execute the following in your terminal or add to your ~/.bashrc
export OPENMC_CROSS_SECTIONS= /home/silentstorm/path/to/NuclearData/OpenMC/endfb80_hdf5/cross_sections.xml

  • Solution 2

Add the following to materials.xml:
<cross_sections>/home/silentstorm/path/to/NuclearData/OpenMC/endfb80_hdf5/cross_sections.xml</cross_sections>

There’s probably a solution 3 where you can add it to the Python notebook.

I would also recommend looking through the user’s guide section on data configuration. In addition to the methods mentioned by @yrrepy, you can also use a runtime configuration, openmc.config, from Python.