openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Error with Universe.plot in 0.13.1dev version

Open SteSeg opened this issue 3 years ago • 1 comments

While trying to plot models geometry using universe.plot with the 13.1dev version I get the following error:

"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. Please consult the user's guide at https://docs.openmc.org/ for information on how to set up data libraries."

Additional info:

  • I don't have an OPENMC_CROSS_SECTIONS env variable, I use materials.cross_sections instead, directly in the model materials definition
  • Commenting out the universe.plot lines the rest of the simulation runs fine
  • The same model with the 0.13.0 version runs fine and plots the geometry
  • The error appears with all the models

SteSeg avatar Aug 23 '22 18:08 SteSeg

I'm working on a better solution for this, but in the meantime as a workaround, the following should work:

import os

os.environ['OPENMC_CROSS_SECTIONS'] = material.cross_sections
...
universe.plot(...)

paulromano avatar Aug 31 '22 21:08 paulromano

The proper solution for this now is to use openmc.config, which was introduced in version 0.13.2.

paulromano avatar Dec 08 '22 17:12 paulromano