Hi All,
I would like to inspect a custom source file that was previously generated through the “Settings.surf_source_write” attribute, storing particles hitting a specified surface.
I can open it as “openmc.Source(filename=‘surface_source.h5’)”, but neither energy nor spatial particles information are stored in it.
Is anyone familiar with these source files?
Thank you.
Lorenzo
Hi @lorenzo. At the moment we don’t have a direct way in the Python API to look at source particles written to a source file, but you can still get at this information pretty easily using h5py. For example, if you wanted to get the energies and positions of the source particles:
import h5py
source_file = h5py.File('surface_source.h5')
particles = source_file['source_bank'][()]
print(particles['E']) # <-- Array of all particle energies
print(particles['r']) # <-- 2D array of all particle positions
print(particles['r']['x'] # <-- Array of all x coordinates
A description of the source file format can be found here.
1 Like