I have a reactor model that is very large and to reduce the computational cost, I’d like to reduce down to a 1/8th symmetrical slice, but I’m running into the “95% of of external source sites sampled were rejected” error. I think I’m making a fairly obvious mistake in here somewhere. Here’s a very simplified version of what I’m trying to do:
m_core = openmc.Material()
m_core.set_density('g/cm3', 10.0)
m_core.temperature = 1000
m_core.add_nuclide('U235', 0.7, 'ao')
m_core.add_nuclide('U238', 100, 'ao')
m_core.add_element('C', 100, 'ao')
m_outside = openmc.Material()
m_outside.set_density('g/cm3', 0.001225)
m_outside.temperature = 298
m_outside.add_element('N', 1, 'ao')
s_core = openmc.ZCylinder(r=15)
c_core = openmc.Cell(fill=b, region=-a)
c_outside = openmc.Cell(fill=v, region=+a)
u_fullcore = openmc.Universe(cells=[c,c2])
s_vertical = openmc.XPlane(x0=0, boundary_type='reflective')
s_diagonal = openmc.Plane(a=cos(pi/4), b=-sin(pi/4), boundary_type='reflective')
s_top = openmc.ZPlane(z0=50, boundary_type='vacuum')
s_bottom = openmc.ZPlane(z0=-50, boundary_type='vacuum')
u_slice = openmc.Universe(cells=[openmc.Cell(fill=d, region=+s_bottom & -s_top & +s_vertical & -s_diagonal)])
geom = openmc.Geometry(u_slice )
geom.export_to_xml()
mats = openmc.Materials(list(geom.get_all_materials().values()))
mats.export_to_xml()
settings = openmc.Settings()
settings.run_mode = 'eigenvalue'
settings.particles = 1000
settings.batches = 25
settings.inactive = 10
Here’s a plot of u_slice
Clearly, there are source locations being sampled that are outside of the slice, which is probably why I’m getting the error. So I attempted to add a cylindrical source with the proper angle.
r = openmc.stats.Uniform(0,15)
phi = openmc.stats.Uniform(0,pi/4)
z = openmc.stats.Uniform(-50,50)
source = openmc.Source()
source.space = openmc.stats.CylindricalIndependent(r, phi, z)
source.angle = openmc.stats.Isotropic()
which resulted in the same error. I also tried adding a cell that defined the area outside of the source, so
u_slice = openmc.Universe(cells=[openmc.Cell(fill=d, region=+s_bottom & -s_top & +s_vertical & -s_diagonal),
openmc.Cell(fill=v, region=~(+s_bottom & -s_top & +s_vertical & -s_diagonal))])
But this resulted in a SIGSEV (regardless of whether the source was defined or not).
Any clarification on what I’m doing wrong would be greatly appreciated.
Thanks,
Sourena