# Openmc aborted unexpectedly..how do i solve this?

**URL:** <https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244>\
**Category:** User Support\
**Created:** [June 10, 2021, 7:02am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244 "2021-06-10T07:02:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 10, 2021, 7:02am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/1 "2021-06-10T07:02:21Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![Pranto](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pranto/32/489_2.png) [@Pranto](https://openmc.discourse.group/u/Pranto)\
**Post date:** [June 10, 2021, 8:38am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/2 "2021-06-10T08:38:31Z")

</div>

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

```bash
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

---

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 10, 2021, 8:20pm UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/3 "2021-06-10T20:20:26Z")

</div>

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! 😃

---

<div class="post-metadata">

**Author:** ![Pranto](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pranto/32/489_2.png) [@Pranto](https://openmc.discourse.group/u/Pranto)\
**Post date:** [June 11, 2021, 4:56am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/4 "2021-06-11T04:56:15Z")

</div>

That’s great @Mashaba I prepared a [google collaboratory notebook](https://colab.research.google.com/drive/1yudWQZSjPJT1fO_eoukDgbVrPESX09-D?usp=sharing) a couple of minutes ago that will install `openmc-0.12.0` and run your code on Google computers.

Have a good day!

---

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 14, 2021, 12:00am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/5 "2021-06-14T00:00:29Z")

</div>

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!!! 🙂  
I wish you a good day too!  
Best,  
Mashaba

---

<div class="post-metadata">

**Author:** ![Pranto](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pranto/32/489_2.png) [@Pranto](https://openmc.discourse.group/u/Pranto)\
**Post date:** [June 16, 2021, 4:47pm UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/6 "2021-06-16T16:47:40Z")

</div>

> [@Mashaba](#):
>
> i tried to run the notebook yiou provided me but it crashed for some reason

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!

---

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 18, 2021, 10:26pm UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/7 "2021-06-18T22:26:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 18, 2021, 10:33pm UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/8 "2021-06-18T22:33:12Z")

</div>

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:

> <https://gist.github.com/paulromano/5c7e030c7d3c96ac30dede377131c7d8>

---

<div class="post-metadata">

**Author:** ![Pranto](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pranto/32/489_2.png) [@Pranto](https://openmc.discourse.group/u/Pranto)\
**Post date:** [June 19, 2021, 7:37am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/9 "2021-06-19T07:37:31Z")

</div>

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.

```python
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](https://colab.research.google.com/drive/1yudWQZSjPJT1fO_eoukDgbVrPESX09-D?usp=sharing) file so that you can try it one more time on Google Colab.

Best  
pranto

---

<div class="post-metadata">

**Author:** ![Mashaba](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/mashaba/32/1328_2.png) [@Mashaba](https://openmc.discourse.group/u/Mashaba)\
**Post date:** [June 19, 2021, 9:10am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/10 "2021-06-19T09:10:18Z")

</div>

IT WORKED! Thank you so much! @Pranto 😃

Best,  
Mashaba

---

<div class="post-metadata">

**Author:** ![Pranto](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pranto/32/489_2.png) [@Pranto](https://openmc.discourse.group/u/Pranto)\
**Post date:** [June 19, 2021, 10:54am UTC](https://openmc.discourse.group/t/openmc-aborted-unexpectedly-how-do-i-solve-this/1244/11 "2021-06-19T10:54:37Z")

</div>

> [@Mashaba](#):
>
> the power of the reference reactor is 200MW…when i use this as the power the kernel dies

@Mashaba My guess, you’re running out of memory when data is being loaded. [triso-burnup notebook file](https://colab.research.google.com/drive/1ryj4dg4BsXXtgxILY-JGB3XWoIQHEgXQ?usp=sharing)

> [@Mashaba](#):
>
> but i am still getting those negative densities as given bellow for many isotopes…

Paul already answered this question in another post.

> [@Warning while reading from ENDF/B-VII.1](https://openmc.discourse.group/t/warning-while-reading-from-endf-b-vii-1/1039/3):
>
> These are both data-related issues. Probability tables are used for unresolved resonance region cross sections to account for energy self-shielding effects. These tables are generated by NJOY and should not have negative probabilities, but this does sometimes occur. OpenMC will zero out those values, but it is telling you that the data produced by NJOY may be suspect. The second message about the maximum neutron energy is due to an erroneous evaluation of Be7 in ENDF/B-VII.1 that has an upper l…

Hope this will help!
