Openmc aborted unexpectedly..how do i solve this?

Can anyone tell me why openmc is aborting and how do i fix this?

RuntimeError Traceback (most recent call last)
in
177
178 settings_file.export_to_xml()
→ 179 openmc.run()

~/miniconda3/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)
225 args = mpi_args + args
226
→ 227 _run(args, output, cwd)

~/miniconda3/lib/python3.9/site-packages/openmc/executor.py in _run(args, output, cwd)
36 error_msg = ’ '.join(error_msg.split())
37
—> 38 raise RuntimeError(error_msg)
39
40

RuntimeError: OpenMC aborted unexpectedly.

The code is given below

%matplotlib inline
import openmc
import math
import openmc.deplete
###############################################################################
#Simulation Input File Parameters

###############################################################################
#OpenMC simulation parameters

batches = 100
inactive = 10
particles = 1000

###############################################################################
#Exporting to OpenMC materials.xml file

###############################################################################
#Instantiate some Materials and register the appropriate Nuclides

#uranium oxycarbide composition
uco=openmc.Material()
uco.add_nuclide( ‘U235’,13.86, ‘wo’)
uco.add_nuclide(‘U238’,75.59,‘wo’)
uco.add_nuclide(‘C12’,5.275,‘wo’)
uco.add_nuclide(‘O16’,5.275,‘wo’)
uco.set_density(‘g/cm3’, 10.4)
uco.deplete = True
uco.volume = 4.02e-5

#uraniom dioxide composition
uo2=openmc.Material()
uo2.add_nuclide(‘U235’,13.66,‘wo’)
uo2.add_nuclide(‘U238’,74.47,‘wo’)
uo2.add_nuclide(‘O16’,11.87, ‘wo’)
uo2.set_density(‘g/cm3’, 10.4)
uo2.deplete = True
uo2.volume = 4.02e-5

#buffer composition
buffer = openmc.Material()
buffer.add_element(‘C’, 1.0)
buffer.set_density(‘g/cm3’, 1.05)
buffer.temperature=297.0
buffer.add_s_alpha_beta(‘c_Graphite’)

#pyrolytic carbon layer composition
PyC = openmc.Material()
PyC.add_element(‘C’, 1.0)
PyC.set_density(‘g/cm3’, 1.9)
PyC.temperature=297.0
PyC.add_s_alpha_beta(‘c_Graphite’)

#silicon carbide composition
SiC = openmc.Material()
SiC.add_element(‘Si’, 1.0)
SiC.add_element(‘C’, 1.0)
SiC.set_density(‘g/cm3’, 3.2)

#helium gas coolant composition
helium = openmc.Material()
helium.add_element(‘He’, 1.0)
helium.set_density(‘g/cm3’, 0.000178)

#graphite moderator composition
graphite = openmc.Material(name=‘Graphite’)
graphite.add_element(‘C’, 1.0)
graphite.set_density(‘g/cm3’, 5)
graphite.temperature=297.0
graphite.add_s_alpha_beta(‘c_Graphite’)

materials_file = openmc.Materials([uco, uo2, buffer, PyC, SiC, helium,graphite])
materials_file.export_to_xml()
###############################################################################
#Exporting to OpenMC geometry.xml file

###############################################################################

#Instantiate fuel spheres
kernel_sph = openmc.Sphere(r=212.5e-4)
buffer_sph = openmc.Sphere(r=312.5e-4)
IPyC = openmc.Sphere(r=352.5e-4)
siC = openmc.Sphere(r=387.5e-4)
OPyC = openmc.Sphere(r=427.5e-4)
#Instantiate Cells
#Use surface half-spaces to define regions
#Register Materials with Cells

kernel = openmc.Cell(fill = uco,region = -kernel_sph)
buffer = openmc.Cell(fill = buffer,region = +kernel_sph & -buffer_sph)
innerPyC = openmc.Cell(fill = PyC,region = +buffer_sph & -IPyC)
siliconCarbide = openmc.Cell(fill = SiC,region = +IPyC & -siC)
outerPyC = openmc.Cell(fill= PyC,region = +siC & -OPyC)
#Instantiate Universe

triso_universe = openmc.Universe()
#Register Cells with Universe

triso_universe.add_cells([kernel,buffer,innerPyC,siliconCarbide,outerPyC])

triso_colors = {kernel: ‘white’, buffer: ‘gray’, innerPyC: ‘black’, siliconCarbide: ‘turquoise’, outerPyC: ‘black’}
triso_universe.plot(width = (0.1, 0.1), colors = triso_colors)
#Generating TRISO particle sphere in spherical pin cell

particleSurf = openmc.Sphere(r=2.75)

triso_outer_radius = 427.5e-4
centers = openmc.model.pack_spheres(radius=triso_outer_radius, region=-particleSurf, pf=0.0714)

triso_particles = [openmc.model.TRISO(triso_outer_radius, fill=triso_universe, center=c) for c in centers]

len(triso_particles)

lattice_cell = openmc.Cell(region=-particleSurf)
lower_left, upp_right = lattice_cell.region.bounding_box
shape = (4, 4, 4)
pitch = (upp_right - lower_left)/shape
triso_latt = openmc.model.create_triso_lattice(triso_particles, lower_left, pitch, shape, graphite)
lattice_cell.fill = triso_latt

lattice_universe = openmc.Universe(cells=[lattice_cell])

#lattice_universe.plot(width=(7,7), color_by=‘material’, colors = {graphite: (0.08, 0.09, 0.26)})
sphereSurf = openmc.Sphere(r=3.0)
outer_pin_cell = openmc.Cell(fill=graphite, region = +particleSurf & -sphereSurf)
left = openmc.XPlane(x0=-5, boundary_type=‘reflective’)
right = openmc.XPlane(x0=5, boundary_type=‘reflective’)
top = openmc.YPlane(y0=-5, boundary_type=‘reflective’)
bottom = openmc.YPlane(y0=5, boundary_type=‘reflective’)
front = openmc.ZPlane(z0=-5, boundary_type=‘reflective’)
back = openmc.ZPlane(z0=5, boundary_type=‘reflective’)
region = +left & -right & +top & -bottom & +front & -back
coolant = openmc.Cell(fill=helium, region = region & +sphereSurf)

pin_cell_universe = openmc.Universe(cells=[lattice_cell, outer_pin_cell,coolant])

pin_cell_universe.plot(width=(7, 7), color_by=‘cell’, colors = {outer_pin_cell: (0.08, 0.09, 0.26), coolant:‘orange’})

geom = openmc.Geometry(pin_cell_universe)
geom.export_to_xml()
###############################################################################
#Exporting to OpenMC plots.xml file

###############################################################################

plot_xy = openmc.Plot()
plot_xy.basis =‘xz’
plot_xy.origin = [0, 0, 0]
plot_xy.width = [7, 7]
plot_xy.pixels = [300, 300]
plot_xy.color_by=‘material’
plot_xy.colors={graphite: ‘black’, helium:‘orange’}
#Instantiate a Plots collection, add plots, and export to XML

plot_file = openmc.Plots()
plot_file.append(plot_xy)
plot_file.export_to_xml()
#OpenMC simulation parameters

###############################################################################
#Exporting to OpenMC settings.xml file

###############################################################################
#Instantiate a Settings object, set all runtime parameters, and export to XML

settings_file = openmc.Settings()
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
settings_file.temperature = {‘method’:‘interpolation’}
settings_file.output = {‘tallies’: True}
#Create an initial uniform spatial source distribution over fissionable zones

bounds = [-5, -5, -5, 5, 5, 5]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings_file.source = openmc.Source(space=uniform_dist)

settings_file.export_to_xml()
openmc.run()

@Mashaba Did you try with an older version of openmc? perhaps openmc-0.12.0 will be better.

conda create --name openmc12 python=3.9 openmc=0.12.0 jupyterlab -y
conda activate openmc12

Give it a try, hope you’ll not see the previous error anymore.

Best
pranto

1 Like

hello @Pranto
i did what u said but wasnt doing it on a seperate notebook…so it was still aborting… now it is working!
Pardon me for my mistakes…im still new to both openmc and terminal. I really appreciate everyone helping me out.
Thank you for helping me out! :smiley:

That’s great @Mashaba I prepared a google collaboratory notebook a couple of minutes ago that will install openmc-0.12.0 and run your code on Google computers.

Have a good day!

1 Like

Sorry for late reply @Pranto…i tried to run the notebook yiou provided me but it crashed for some reason…Never mind my work is continuing properly with your previous solution. However thank you so much for effort!!! :slight_smile:
I wish you a good day too!
Best,
Mashaba

Actually after miniconda install, It’ll restart the kernel. You can run the rest of the code cell.

Let me know If there’s a problem!

1 Like

Thank you @Pranto as i said earlier it has stopped aborting…i ran the depletion command and im getting negative densities…
the power of the reference reactor is 200MW…when i use this as the power the kernel dies…so i calculated the volume of fuel in a single pebble and multiplied it with the average power density of the reactor…now the kernel doesnt die… but i am still getting those negative densities as given bellow for many isotopes…

WARNING: Negative value(s) found on probability table for nuclide Hf181 at 250K
WARNING: Negative value(s) found on probability table for nuclide Hf181 at 294K
WARNING: Negative value(s) found on probability table for nuclide Hf181 at 600K
WARNING: Negative value(s) found on probability table for nuclide Hf181 at 900K
WARNING: Negative value(s) found on probability table for nuclide Hf181 at
1200K
WARNING: Negative value(s) found on probability table for nuclide Hf181 at
2500K
I am using Simplified chain file of PWR spectrum

and i want to tally a flux spectrum…i had been following an example given by paul romano in a previous topic which is not working fo me…i dont really understand how this works…can you tell me where am i going wrong?
the code is given below
lattice_cell.tallies

Create equal-lethargy energies to put in filter

energies = np.logspace(np.log10(1e-5), np.log10(20.0e6), 501)
e_filter = openmc.EnergyFilter(energies)

Create tally with energy filter

tally = openmc.Tally()
tally.filters = [e_filter]
tally.scores = [‘flux’]

AttributeError: ‘Cell’ object has no attribute ‘tallies’

Set pin cell universe tallies

lattice_cell.tallies = [tally]
t = sp.tallies[tally.id]
flux = t.mean.ravel()
flux_unc = t.std_dev.ravel()

plt.loglog(energies[:-1], flux)
plt.grid()
plt.xlabel(‘Energy [eV]’)
plt.ylabel(‘Flux [n/cm-src]’)

the link to the example i followed is also provided below:

If you’re getting Your session crashed for an unknown reasons message, just ignore it. Everything will work fine.

You are close except lattice_cell.tallies one.

Here’s the correct code.

import numpy as np

# Create equal-lethargy energies to put in filter
energies = np.logspace(np.log10(1e-5), np.log10(20.0e6), 501)
e_filter = openmc.EnergyFilter(energies)

# Create tally with energy filter
tally = openmc.Tally()
tally.filters = [e_filter]
tally.scores = ['flux']

# Instantiate a Tallies object
tallies = openmc.Tallies([tally])
tallies.export_to_xml()

I have also attached this in notebook file so that you can try it one more time on Google Colab.

Best
pranto

1 Like

IT WORKED! Thank you so much! @Pranto :smiley:

Best,
Mashaba

@Mashaba My guess, you’re running out of memory when data is being loaded. triso-burnup notebook file

Paul already answered this question in another post.

Hope this will help!

1 Like