The error “Particle # could not be located after crossing a boundary of lattice #” kept appearing when I try to run a basic simulation, I am guessing it has something to do with the lattice definition as the error indicates, I will include my full code as plain text and as a .py file.
import os
os.environ[‘OPENMC_CROSS_SECTIONS’] = ‘/home/eastdusty/openmc_env/share/data/endfb80/endfb-viii.0-hdf5/cross_sections.xml’
import openmc as openmc
U3Si2Al = openmc.Material(name=‘U3Si2Al’)
U3Si2Al.add_nuclide(‘U238’, 3 * 0.8025)
U3Si2Al.add_nuclide(‘U235’, 3 * 0.1975)
U3Si2Al.add_nuclide(‘Si28’, 2 * 0.922545)
U3Si2Al.add_nuclide(‘Si29’, 2 * 0.04672)
U3Si2Al.add_nuclide(‘Si30’, 2 * 0.030735)
U3Si2Al.add_nuclide(‘Al27’, 1)
U3Si2Al.set_density(‘g/cm3’, 5.55)
Al6061 = openmc.Material(name=‘Al6061’)
Al6061.add_nuclide(‘Al27’, 1)
Al6061.set_density(‘g/cm3’, 2.7)
water = openmc.Material(name=‘Water’)
water.add_nuclide(‘H1’, 0.111877)
water.add_nuclide(‘H2’, 0.000013)
water.add_nuclide(‘O16’, 0.88811)
water.set_density(‘g/cm3’, 1.0)
vacuum = openmc.Material(name=‘Vacuum’)
vacuum.add_nuclide(‘H1’, 1.0e-100) # Practically zero density
vacuum.set_density(‘g/cm3’, 1.0e-100)
materials = openmc.Materials([U3Si2Al, Al6061, water, vacuum])
materials.export_to_xml()
fuel_top = openmc.ZPlane(z0=30)
fuel_bottom = openmc.ZPlane(z0=-30)
fuel_right = openmc.XPlane(x0=2.98)
fuel_left = openmc.XPlane(x0=-2.98)
fuel_front = openmc.YPlane(y0=0.0255)
fuel_back = openmc.YPlane(y0=-0.0255)
fuel_region = +fuel_bottom & -fuel_top & +fuel_left & -fuel_right & -fuel_front & +fuel_back
fuel_cell = openmc.Cell(region=fuel_region, fill=U3Si2Al)
clad_top = openmc.ZPlane(z0=32.55)
clad_bottom = openmc.ZPlane(z0=-32.55)
clad_right = openmc.XPlane(x0=3.615)
clad_left = openmc.XPlane(x0=-3.615)
clad_front = openmc.YPlane(y0=0.0635)
clad_back = openmc.YPlane(y0=-0.0635)
for surf in [clad_top, clad_bottom, clad_right, clad_left]:
surf.boundary_type = ‘vacuum’
clad_region = +clad_bottom & -clad_top & +clad_left & -clad_right & -clad_front & +clad_back & ~fuel_region
clad_cell = openmc.Cell(region=clad_region, fill=Al6061)
coolant_front = openmc.YPlane(y0=0.2045)
coolant_back = openmc.YPlane(y0=-0.2045)
coolant_region = -clad_top & + clad_bottom & -coolant_front & +coolant_back & +clad_left & -clad_right & ~clad_region & ~ fuel_region
coolant_cell = openmc.Cell(region=coolant_region, fill=water)
infinite_water = openmc.Cell(fill= water)
infinite_water_universe = openmc.Universe(cells=[infinite_water])
fuel_plate = openmc.Universe(cells=[fuel_cell, clad_cell, coolant_cell])
fuel_assembly = openmc.RectLattice(name = ‘fuel assembly’)
fuel_assembly.lower_left = (-3.615, -2.863)
fuel_assembly.pitch = (7.23, 0.409)
fuel_assembly.universes = [[fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate], [fuel_plate]]
fuel_assembly.outer = infinite_water_universe
fuel_assembly_cell = openmc.Cell()
fuel_assembly_cell.fill = fuel_assembly
fuel_assembly_universe = openmc.Universe()
fuel_assembly_universe.add_cell(fuel_assembly_cell)
‘’’
front_boundary = openmc.YPlane(y0=20.8644, boundary_type = ‘reflective’)
back_boundary = openmc.YPlane(y0=-20.8644, boundary_type = ‘reflective’)
upper_boundary = openmc.ZPlane(z0=20.8644, boundary_type = ‘reflective’)
lower_boundary = openmc.ZPlane(z0=-20.8644, boundary_type = ‘reflective’)
right_boundary = openmc.XPlane(x0=20.8644, boundary_type = ‘reflective’)
left_boundary = openmc.XPlane(x0=-20.8644, boundary_type = ‘reflective’)
‘’’
geometry = openmc.Geometry(root=fuel_assembly_universe)
geometry.export_to_xml()
colors = {1: ‘tomato’, 2: ‘silver’, 3: ‘blue’}
xy_plot = openmc.Plot()
xy_plot.basis = ‘xy’
xy_plot.origin = [0, 0, 0]
xy_plot.width = [8.43, 6.826]
xy_plot.pixels = [500, 500]
xy_plot.filename = ‘Geometry (XY)’
xy_plot.color_by = ‘material’
xy_plot.colors = colors
xz_plot = openmc.Plot()
xz_plot.basis = ‘xz’
xz_plot.origin = [0, 0, 0]
xz_plot.width = [8.43, 65]
xz_plot.pixels = [500, 500]
xz_plot.filename = ‘Geometry (XZ)’
xz_plot.color_by = ‘material’
xz_plot.colors = colors
yz_plot = openmc.Plot()
yz_plot.basis = ‘yz’
yz_plot.origin = [0, 0, 0]
yz_plot.width = [6.826, 65]
yz_plot.pixels = [500, 500]
yz_plot.filename = ‘Geometry (YZ)’
yz_plot.color_by = ‘material’
yz_plot.colors = colors
plots = openmc.Plots([xy_plot, xz_plot, yz_plot])
plots.export_to_xml()
openmc.plot_geometry()
space = openmc.stats.Point((0.0, 0.0, 0.0))
source = openmc.IndependentSource(space=space)
settings = openmc.Settings()
settings.source = source
settings.batches = 10
settings.inactive = 2
settings.particles = 10000
settings.export_to_xml()
openmc.run()
main code.py (4.5 KB)