How to use new features "filed base source" on OpenMC 0.12.1

Hi all,

I have seen the OpenMC update with the new features " Using a file-based source for fixed source simulations" on version 0.12.1 and seem like in OpenMC document didn’t update the info yet. So I want to know how to use this feature? and about the source file, what’s the present format of source.h5 file?

I have attached my .h5 file below here (created by python to convert the data from FLUKA output to .h5). Is this format still available?

my .h5 file (it’s too large to attached)

If anyone has an example of using this new feature or any suggestions, please let me know.

Thank you,
thanapong

2 Likes

Hi @billytnp,

To use a file-based source you can set the file attribute of an openmc.Source object

settings.source = openmc.Source(filename='source.10.h5')
settings.export_to_xml()

Where source.10.h5 should be replaced with the name of your own source file.

openmc.Source — OpenMC Documentation

Hope this helps!

-Patrick

Dear @pshriwise,

I’ve tried to fix my script and executed it, but this error appeared


In fact, my source file is not surface source type. It made from FLUKA which all of neutrons are coming from spallation process which have different direction and position, so it’s not rely on a surface (new source file format said need to define the surf_id).
Could this be the problem of this error? and Is it necessary to define surf_id on my problem, if not what should I define it?

Unset surface IDs shouldn’t be a problem. They don’t affect the source file read at this point in time. (The contributor for that feature intends to add capabilities for reading source particles from specific surfaces in the future.)

To make sure I understand correctly, you have a set of initial positions, directions, energies, etc. for neutrons generated by spallation from FLUKA that you’ve converted into the source.h5 format for OpenMC?

I’d first check to make sure that the source locations from the FLUKA model are also valid for the OpenMC model and make sure that the OpenMC model doesn’t have an error. I’m not sure about the reaction sampling error for Pb204 though. Not sure what your charged particle energies are for the spallation simulation, but do any of your source particle energies exceed the maximum energy supported by the data (20 MeV)?

Dear @pshriwise,

Thank you for your help after I changed the energy to below 20 MeV the error mentioned before has been solved, another error has occurred.

Maybe I should recheck my geometry again. Thank you.

Glad it got you one step closer!

We have a plotting tool that’s pretty useful for debugging geometry issues if you’d like to give it a try: https://github.com/openmc-dev/plotter