openmc-dev/openmc

Improved error message when nuclear data temperature does not exist

Closed this issue · 4 comments

Description

currently if a material is made with a temperature set and that temperature is not found in the nuclear data h5 file then we get this error message

RuntimeError: Nuclear data library does not contain cross sections for H2 at or near 800.000000 K.

It would be useful to include in this error message the temperatures that are available in the nuclear data file. Perhaps the error message could be changed to:

RuntimeError: Nuclear data library does not contain cross sections for H2 at or near 800.000000 K. Available temperatures are 200, 300, 600 K

this will help the user correct the error quickly by setting the temperature to something acceptable or looking for other nuclear data with more temperature offerings.

the file that needs changing would be the openmc/src/nuclide.cpp

openmc/src/nuclide.cpp

Lines 161 to 163 in 9d9b2da

fatal_error(
"Nuclear data library does not contain cross sections for " + name_ +
" at or near " + std::to_string(T_desired) + " K.");

Alternatives

leave it as is

Compatibility

compatibility remains the same as this is just an improved error message

I'd just be careful of making a new user think that another temperature is fine for their problem. If they ask for 800 K, it might not be appropriate to use, say 200 (or even 600). There could be a case where they ask for 1000 K but the only available data is room temp or 2500 K. The solution is probably to have them switch their mode to interpolation or get the data for the temperature they need.

Ah yes good point. I've over simplified this. what do you thing @lewisgross1296 should we close this issue or reword the error message to something like ...

RuntimeError: Nuclear data library does not contain cross sections for H2 at or near 800.000000 K. Available temperatures are 200, 300, 600 K consider making use of openmc.Settings.temperature to specify how intermediate temperatures are treated.

I'm open to other's opinions on this too. Maybe leave the issue open for a bit to see if anyone else has thoughts? My vote is to leave the error message as is.

Many thanks @lewisgross1296 and @zoeprieto for tracking and closing out this issue. Much appreciated