I have really enjoyed building nuclear reactors in the past 3 years with openmc, however in my latest build I have had issues with some neutrons getting stuck in the middle of materials at the same coordinate and orientation forever (found this by tracking the neutrons), massively slowing down my simulation and giving off this warning: WARNING: Particle 61 underwent maximum number of events.
I couldn’t find anything wrong with my geometry or material definition, but after much trial and error, I managed to fix this by applying a “rotation” to all my cells, like this:
rotated_cells = []
for cell in cells:
region = cell.region
region = region.rotate((0, 0, 0))
cell.region = region
rotated_cells.append(cell)
universe = openmc.Universe(cells=rotated_cells)
Not sure why this fixed my problem, but I wanted to share this because I was getting quite desperate.
That is almost always a geometry error. Otherwise, do you have coincident surfaces in your model? This can cause some particles to get stuck or lost in a technically “valid” geometry.
With the fake-rotation, do Particle 61 and the other stuck particles have the same histories up to the points where they got stuck? Without the rotation, do particles get stuck in the same places with different random seeds?
Hi tjlaboss, update on my issue. I eliminated it completely by setting surface_precision = 2 when defining my geometry object. Definitely pretty rough, but my issue was probably caused by the fact that I often didn’t reuse surfaces for different object, causing the creation of coincident surfaces that would cause the particles to be lost.
That definitely sounds like it could have been the issue. Have you read this support page from before?
Every time the particle passes a boundary it would count as an interaction, so if you have a lot of boundaries stacked your reasoning makes sense that you would reach the max number of interactions (1 million) faster as it is passing 2 boundaries every time it changing cells. For the future I would just make sure you’re using the same surface for coinciding cells as this would prevent this issue, as well as general particle loss issues you might experience in more complicated geometries as the cells don’t align.
I was running it in debug mode, but it did not tell me that any cell were coincident unfortunately. The issue also seems independent from the number of coincident surfaces I had in my problem, as I was able to simplify my model to a great extent and still encounter the problem. To be honest even today I am not completely sure that I have really identified the core of the issue.
Also note that the reason particles were lost is that they got stuck in the same position for hundreds of thousand of steps.