openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Automatically try "cross_sections.xml"

Open tjlaboss opened this issue 1 year ago • 0 comments

Description

A minor usability enhancement and a potential "Good First Issue".

The cross sections file is usually named cross_sections.xml. If a user sets the OPENMC_CROSS_SECTIONS environment variable to a directory, automatically try cross_sections.xml, and optionally warn the user.

Current behavior:

$  OPENMC_CROSS_SECTIONS=/path/to/folder/  openmc
 . . .
 Reading settings XML file...
 Reading cross sections XML file...
 ERROR: Error processing cross_sections.xml file.

Desired behavior:

$  OPENMC_CROSS_SECTIONS=/path/to/folder/  openmc
 . . .
 Reading settings XML file...
 Reading cross sections XML file...
 WARNING: Found cross sections file: /path/to/folder/cross_sections.xml
 Reading materials XML file...
 Reading geometry XML file...
 Reading U235 from /path/to/folder/U235.h5
 . . .

This is something that bites new users regularly, especially those coming from MCNP who are used to just setting DATAPATH to a directory.

Alternatives

Just remind the user to set the environment variable to the cross sections XML

$  OPENMC_CROSS_SECTIONS=/path/to/folder/  openmc
 . . .
 Reading settings XML file...
 Reading cross sections XML file...
 ERROR: "/path/to/folder/" is a directory. OPENMC_CROSS_SECTIONS must be set to a cross_sections.xml file.

Compatibility

Adds something new

tjlaboss avatar Jun 19 '24 22:06 tjlaboss