Hi openMC group!
I am new to openMc and currently going through the modeling fuel pin example. All seemed to working well until the “openmc.run()” command and I get the openmc’ died with <Signals.SIGSEGV: 11> error and can’t run the k eigenvalue simulation. Here is what I had In my code:
%matplotlib inline
import openmc
u02 = openmc.Material(1, “u02”) # defining a material. Within parenthesis, (material ID number, name)
print(u02)
help(u02.add_nuclide) # This shows you the parameters you need to add to define material
#So lets add the info(nuclides) to u02. Starting off with ATOM FRACTION
u02.add_nuclide(‘U235’, 0.03)
u02.add_nuclide(‘U238’, 0.97)
u02.add_nuclide(‘O16’, 2.0)
u02.set_density(‘g/cm3’, 10.0)
zirconium = openmc.Material(2, “zirconium”)
zirconium.add_element(‘Zr’, 1.0)
zirconium.set_density(‘g/cm3’, 6.6)
#Coolant
water = openmc.Material(3, “h2o”)
water.add_nuclide(‘H1’, 2.0)
water.add_nuclide(‘O16’, 1.0)
water.set_density(‘g/cm3’, 1.0)
#Make sure that the bound atom cross sections is used at thermal energies
water.add_s_alpha_beta(‘c_H_in_H2O’)
#instantiate a materials collection to export to XML
mats = openmc.Materials([u02, zirconium, water])
mats = openmc.Materials()
mats.append(u02)
mats += [zirconium, water]
isinstance(mats, list)
#Creates the XML file
mats.cross_sections = r"/Users/jomnganal/Desktop/OpenMC Fusion Project/mcnp_endfb70/cross_sections.xml"
mats.export_to_xml()
!cat materials.xml
#ENRICHMENT
#lets make 3% enriched u02
u02_three = openmc.Material()
u02_three.add_element(‘U’, 1.0, enrichment=3.0)
u02_three.add_element(‘O’, 2.0)
u02_three.set_density(‘g/cc’, 10.0)
#MIXTURES
#Can define materials by mixing existing materials
#Example if want to mix U02(97%) and Pu02(3%)
pu02 = openmc.Material()
pu02.add_nuclide(‘Pu239’, 0.94)
pu02.add_nuclide(‘Pu240’, 0.06)
pu02.add_nuclide(‘O16’, 2.0)
pu02.set_density(‘g/cm3’, 11.5)
#Create Mixture
mox = openmc.Material.mix_materials([u02, pu02], [0.97, 0.03], ‘wo’) #wo specifies they are weight fractions
#DEFINING GEOMETRY
#Start off with a sphere
sph = openmc.Sphere(r=1.0)
#Lets define our sphere spacially, creating half spaces
inside_sphere = -sph
outside_sphere = +sph
#Now to check
print((0,0,0) in inside_sphere, (0,0,2) in inside_sphere)
print((0,0,0) in outside_sphere, (0,0,2) in outside_sphere)
#Now we can make more complex volumes by combining half spaces and boolean operators
z_plane = openmc.ZPlane(z0=0) # We create a plane directly in the middle of our sphere
northern_hemisphere = -sph & +z_plane # define the top part of the sphere and plane is northern hemisphere
northern_hemisphere.bounding_box
cell = openmc.Cell()
cell.region = northern_hemisphere
cell.fill = water
universe = openmc.Universe()
universe.add_cell(cell)
#to show universe on plot
universe.plot(width=(2.0, 2.0))
#The plot shows on an x-y plane on default. We can change with a basis argument:
universe.plot(width=(2.0, 2.0), basis=‘xz’)
universe.plot(width=(2.0, 2.0), basis=‘xz’, colors={cell: ‘pink’})
fuel_or = openmc.ZCylinder(r=0.39)
clad_ir = openmc.ZCylinder(r=0.40)
clad_or = openmc.ZCylinder(r=0.46)
fuel_region = -fuel_or # boundary of fuel is everything less than fuel outer radius
gap_region = +fuel_or & -clad_ir # boundary of gap is outside fuel but inside clad inner radius
clad_region = +clad_ir & -clad_or
#Now we can assign materials to those regions
fuel = openmc.Cell(1, ‘fuel’)
fuel.fill = u02
fuel.region = fuel_region
gap = openmc.Cell(2, ‘air gap’)
gap_region = gap_region
clad = openmc.Cell(3, ‘clad’)
clad.fill = zirconium
clad_region = clad_region
pitch = 1.26
left = openmc.XPlane(x0=-pitch/2, boundary_type=‘reflective’)
right = openmc.XPlane(x0=-pitch/2, boundary_type=‘reflective’)
bottom = openmc.YPlane(y0=-pitch/2, boundary_type=‘reflective’)
top = openmc.YPlane(y0=-pitch/2, boundary_type=‘reflective’)
water_region = +left & -right & +bottom & -top & +clad_or
moderator = openmc.Cell(4, ‘moderator’)
moderator.fill = water
moderator.region = water_region
box = openmc.rectangular_prism(width=pitch, height=pitch,
boundary_type=‘reflective’)
type(box)
water_region = box & +clad_or
root = openmc.Universe(cells=(fuel, gap, clad, moderator))
geom = openmc.Geometry()
geom.root_universe = root
#or
geom = openmc.Geometry(root)
geom.export_to_xml()
!cat geometry.xml
#STARTING SOURCE AND SETTINGS
point = openmc.stats.Point((0,0,0))
src = openmc.Source(space=point)
#Now to add the settings to how many batches and particles we want
settings = openmc.Settings()
settings.source = src
settings.batches = 100
settings.inactive = 10
settings.particles = 100
settings.export_to_xml()
!cat settings.xml
#USER DEFINED TALLIES
#tally the total, fission, absorbption, and neutron/gamma reaction rates in the cell containing the fuel
#Create a tally specifying the fuel cell
cell_filter = openmc.CellFilter(fuel)
t = openmc.Tally(1)
t.filters = [cell_filter]
#We can use nuclide attribute to name specific nuclides we are interested in
t.nuclides = [‘U235’]
t.scores = [‘total’, ‘fission’, ‘absorption’, ‘(n,gamma)’]
#similar to others, we need tallies collection and export to xml
tallies = openmc.Tallies([t])
tallies.export_to_xml()
!cat tallies.xml
openmc.run()
After running, this is the error I get:
CalledProcessError Traceback (most recent call last)
in
1 #RUNNING OPENMC
2
----> 3 openmc.run()
~/opt/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/executor.py in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based)
216 args = mpi_args + args
217
→ 218 _run(args, output, cwd)
~/opt/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/executor.py in _run(args, output, cwd)
26 # Raise an exception if return status is non-zero
27 if p.returncode != 0:
—> 28 raise subprocess.CalledProcessError(p.returncode, ’ '.join(args),
29 ‘’.join(lines))
30
CalledProcessError: Command ‘openmc’ died with <Signals.SIGSEGV: 11>.
Would love help debugging!