OpenMC/examples/custom_source
Paul Romano b41e22f68b
Refactor ParticleType to use PDG Monte Carlo numbering scheme (#3756)
Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
Co-authored-by: Amanda Lund <alund1187@gmail.com>
2026-02-03 07:23:24 +00:00
..
build_xml.py Add RectangularPrism and HexagonalPrism composite surfaces (#2739) 2023-11-01 09:13:40 -05:00
CMakeLists.txt Implement policy for Python, C++, and CMake versions (#3035) 2024-06-17 16:00:45 -05:00
README.md Update README for custom source example, moving comment from show_flux.py 2020-03-19 13:34:49 -05:00
show_flux.py Update README for custom source example, moving comment from show_flux.py 2020-03-19 13:34:49 -05:00
source_ring.cpp Refactor ParticleType to use PDG Monte Carlo numbering scheme (#3756) 2026-02-03 07:23:24 +00:00

Building a Custom Source

To run this example, you first need to compile the custom source library, which requires headers from OpenMC. A CMakeLists.txt file has been set up for you that will search for OpenMC and build the custom library. To build the source library, you can run:

mkdir build && cd build
OPENMC_ROOT=<path_to_openmc_install> cmake ..
make

After this, you can build the model by running python build_xml.py. In the XML files that are created, you should see a reference to build/libsource.so, the custom source library that was built by CMake. The model is also set up with a mesh tally of the flux, so once you run openmc, you will get a statepoint file with the tally results in it. Running python show_flux.py will pull in the results from the statepoint file and display them. If all worked well, you should see a ring "imprint" as well as a higher flux to the right side (since the custom source has all particles moving in the positive x direction).