Segmentation Fault Mid-Simulation

Hi all,

I’m trying to run a very simple fixed source simulation on a toroidal shell model (I can’t upload since I’m a new user but I’ll append the script to the end of this post; it’s rather short). However, I’m getting a segmentation fault after a few batches. I know there have been quite a few segmentation fault posts in this group but I couldn’t find any very similar to mine since upon debugging, I see this block:

Thread 6 "openmc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff399f700 (LWP 1341917)]
0x00007ffff7e61e06 in openmc::Particle::cross_surface() () from /home/camoreno/.local/lib/
(gdb) backtrace
#0 0x00007ffff7e61e06 in openmc::Particle::cross_surface() () from /home/camoreno/.local/lib/
#1 0x00007ffff7e62a02 in openmc::Particle::event_cross_surface() () from /home/camoreno/.local/lib/
#2 0x00007ffff7ea3a45 in openmc::transport_history_based_single_particle(openmc::Particle&) ()
from /home/camoreno/.local/lib/
#3 0x00007ffff7ea3c7b in openmc::transport_history_based() [clone ._omp_fn.0] () from /home/camoreno/.local/lib/
#4 0x00007ffff68c5de6 in ?? () from /usr/lib/x86_64-linux-gnu/
#5 0x00007ffff75a1ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6 0x00007ffff7a3bdef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I’m really not sure what’s going on here. Any thoughts?


import openmc
import numpy as np

absorber = openmc.Material(name = 'absorber')
absorber.add_element('Fe', 1.0)
absorber.set_density('g/cm3', 7.9)

mat = openmc.Materials([absorber])

inner_torus = openmc.ZTorus(a = 1230, b = 210, c = 210)
outer_torus = openmc.ZTorus(a = 1230, b = 310, c = 310)
outer_torus.boundary_type = 'vacuum'

plasma = openmc.Cell(region = -inner_torus)
shell = openmc.Cell(fill = absorber, region = +inner_torus & -outer_torus)

universe = openmc.Universe(cells = [plasma, shell])
geometry = openmc.Geometry(root = universe)

settings = openmc.Settings()
settings.run_mode = 'fixed source'
settings.particles = 1000
settings.batches = 30

src = openmc.Source()
r = openmc.stats.Discrete([1230.0], [1.0])
phi = openmc.stats.Uniform(0.0, 2*np.pi)
z = openmc.stats.Discrete([0.0], [1.0]) = openmc.stats.CylindricalIndependent(r, phi, z)
src.angle = openmc.stats.Isotropic() = openmc.stats.Discrete([14.1e6], [1.0])

settings.source = src

@camoreno There was a bug in the torus distance calculation in the current release that has since been fixed on the latest developmental branch. This fix will appear in the next release of OpenMC. I’ve confirmed that with the fix in place, your model runs without segfaulting.

Got you. Thanks, Paul!