Import custom h5 source file

Hi all,

I am looking to convert external source data I have to an .h5 file and later load in later as a point source. My model is unable to run, hoping someone is able sense check my process and see where I am going wrong.

The source data I am looking to use are those provided by this fispact database, all are in the form for a .txt file. Reference input spectra - FISPACT-II Wiki.

image

Parsing the text, ive obtained the energy and flux values. No other properties are provided by the data.
The next step I believe is to generate a list of source particles and use openmc.write_source_file to export as an .h5 file.

Screenshot 2023-12-13 092352

By importing this .h5 file. The format of the source is shown with:

source_file = h5py.File(‘file location’)
particles = source_file[‘source_bank’][()]
print(particles)

To assign this source to a model I have then used

settings.source = openmc.FileSource(‘location of source.h5’)

However when running I get this error. Is this due to the formatting of the h5 or am I importing it incorrectly?

Thank you for your help!

Just looking at your data, It’s possible that your source energies exceed the maximum energy available from the cross section library. Namely, many libraries cut off at 20 MeV whereas in your data, it looks like you have particles up to at least 30 MeV.

One thing you should try is to go to a terminal and run openmc to see what output it gives (this is effectively what model.run(...) is doing under the hood).