Hello,
I am relatively new to openmc. I have created a test pincell model. But i tried to account for the height of the pincell and this led to termination of the process with the following error message.
#error message
WARNING: After particle 251 crossed surface 511 it could not be located in any
cell and it did not leak.
WARNING: After particle 126 crossed surface 511 it could not be located in any
cell and it did not leak.
WARNING: After particle 626 crossed surface 511 it could not be located in any
WARNING: After particle 501 crossed surface 510 it could not be located in any…
import openmc
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
openmc.config.cross_sections = ‘/openmc/cross-sections/cross_sections.xml’
Define Materials
materials = openmc.Materials()
Active Fuel Material
uo2 = openmc.Material(name=‘uo2’)
uo2.set_density(‘g/cm3’, 10.66)
uo2.add_nuclide(‘U235’, 0.114313381)
uo2.add_nuclide(‘U238’, 0.761063318)
uo2.add_nuclide(‘U234’, 0.001758667)
uo2.add_nuclide(‘U236’, 0.002198334)
uo2.add_nuclide(‘O16’, 0.11839)
uo2.add_element(‘Al’, 0.000250000000)
uo2.add_element(‘C’, 0.000100000000)
uo2.add_element(‘Ca’, 0.000100000000)
uo2.add_element(‘Mg’, 0.000100000000)
uo2.add_element(‘Cl’, 0.000025000000)
uo2.add_element(‘Cr’, 0.000250000000)
uo2.add_element(‘Co’, 0.000100000000)
uo2.add_element(‘F’, 0.000015000000)
uo2.add_element(‘H’, 0.000001300000)
uo2.add_element(‘Fe’, 0.000500000000)
uo2.add_element(‘Ni’, 0.000250000000)
uo2.add_element(‘N’, 0.000075000000)
uo2.add_element(‘Si’, 0.000500000000)
uo2.add_element(‘Th’, 0.000010000000)
materials.append(uo2)
Fuel Clad/Zircaloy-4 Material
zr4 = openmc.Material(name=‘Zr4’)
zr4.set_density(‘g/cm3’, 6.5)
zr4.add_element(‘Zr’, 0.9792948)
zr4.add_element(‘Fe’, 0.0024000)
zr4.add_element(‘Cr’, 0.0013000)
zr4.add_element(‘Sn’, 0.0169999)
zr4.add_element(‘B’, 0.000002971)
zr4.add_element(‘B’, 0.0000006713)
zr4.add_element(‘He’, 0.000001652)
materials.append(zr4)
Moderator Material
h2o = openmc.Material(name=‘h20’)
h2o.set_density(‘g/cm3’, 0.99825)
h2o.add_nuclide(‘H1’, 0.111898)
h2o.add_nuclide(‘O16’, 0.888102)
h2o.add_s_alpha_beta(‘c_H_in_H2O’)
materials.append(h2o)
Export materials to XML
materials.export_to_xml()
Define Cylindrical Surfaces
fuel_outer_radius = openmc.ZCylinder(r=0.215)
clad_inner_radius = openmc.ZCylinder(r=0.215)
clad_outer_radius = openmc.ZCylinder(r=0.275)
water_inner_radius = openmc.ZCylinder(r=0.6192)
Define Z-Planes for height
z_min = -11.5 # cm
z_max = 11.5 # cm
z_top = openmc.ZPlane(z_max)
z_bottom = openmc.ZPlane(z_min)
Define Regions
fuel_region = -fuel_outer_radius & +z_bottom & -z_top
clad_region = +clad_inner_radius & -clad_outer_radius & +z_bottom & -z_top
Create Cells
fuel = openmc.Cell(name=‘fuel’)
fuel.fill = uo2
fuel.region = fuel_region
clad = openmc.Cell(name=‘clad’)
clad.fill = zr4
clad.region = clad_region
pitch = 0.6192 *2
left = openmc.XPlane(-pitch/2, boundary_type=‘reflective’)
right = openmc.XPlane(pitch/2, boundary_type=‘reflective’)
bottom = openmc.YPlane(-pitch/2, boundary_type=‘reflective’)
top = openmc.YPlane(pitch/2, boundary_type=‘reflective’)
Update water_region to use boundary conditions
water_region = +left & -right & +bottom & -top & +clad_outer_radius & +z_bottom & -z_top
moderator = openmc.Cell(name=‘moderator’)
moderator.fill = h2o
moderator.region = water_region
Define Root Universe
root_universe = openmc.Universe(cells=[fuel, clad, moderator])
Define Geometry
geometry = openmc.Geometry()
geometry.root_universe = root_universe
Export geometry to XML
geometry.export_to_xml()
Define Source
source = openmc.Source()
source.space = openmc.stats.Box(
lower_left=[-11.5, -11.5, -11.5],
upper_right=[11.5, 11.5, 11.5]
)
source.strength = 1.0 # Normalized value or based on empirical data
Define Settings
settings = openmc.Settings()
settings.batches = 100
settings.inactive = 10
settings.particles = 1000
settings.run_mode = ‘eigenvalue’
Define Tally
tally = openmc.Tally()
tally.filters = [openmc.CellFilter([fuel.id, clad.id, moderator.id])]
energy_filter = openmc.EnergyFilter([1e-5, 0.625, 0.825, 20.0])
tally.filters.append(energy_filter)
tally.scores = [‘flux’]
Add Tally to Tallies Collection
tallies = openmc.Tallies([tally])
tallies.export_to_xml()
settings.export_to_xml()
Run the simulation
openmc.run()
please note that the code runs without any error when i remove the height variable that defines the height of the cylinder.
please suggestions on how to resolve this will be appreciated.
Thank you.