Error in cross-section

I have made a simple code to find transmission and back scattered neutrons after interacting with a rock wall stacked together with water wall. I have error processing the cross-section. this is the code. import openmc

import numpy as np

import openmc.data

import os

os.environ[“OPENMC_CROSS_SECTIONS”] = “/home/harriet/OPENMC/nndc_hdf5_v8/nndc_hdf5/cross_sections.xml”

print(os.environ[“OPENMC_CROSS_SECTIONS”])

Create materials

rock = openmc.Material(name=‘Rock’)

rock.add_element(‘Si’, 0.277)

rock.add_element(‘O’, 0.622)

rock.add_element(‘Al’, 0.101)

rock.set_density(‘g/cm3’, 2.65)

water = openmc.Material(name=‘Water’)

water.add_element(‘H’, 2)

water.add_element(‘O’, 1)

water.set_density(‘g/cm3’, 1.0)

water.add_s_alpha_beta(‘c_H_in_H2O’)

Create surfaces

rock_surface = openmc.ZCylinder(R=0.5)

water_surface = openmc.ZCylinder(R=0.5)

Create cells

rock_cell = openmc.Cell(fill=rock, region=-rock_surface)

water_cell = openmc.Cell(fill=water, region=+rock_surface & -water_surface)

Create universe

universe = openmc.Universe(cells=[rock_cell, water_cell])

Create geometry

geom = openmc.Geometry(universe)

Create settings

settings = openmc.Settings()

settings.particles = 1000

settings.batches = 10

settings.inactive = 5

Create a point source emitting neutrons with 14 MeV energy

source_energy = openmc.stats.Discrete([14e6], [1.0])

source = openmc.Source(space=openmc.stats.Point(), energy=source_energy)

settings.source = source

Create a tally for neutrons transmitted through water

tally_transmitted = openmc.Tally(name=‘transmitted’)

tally_transmitted.filters.append(openmc.CellFilter([water_cell]))

tally_transmitted.scores.append(‘flux’)

Create a tally for neutrons backscattered from rock

tally_backscattered = openmc.Tally(name=‘backscattered’)

tally_backscattered.filters.append(openmc.CellFilter([rock_cell]))

tally_backscattered.scores.append(‘flux’)

Create a simulation model

Create a simulation model

model = openmc.model.Model(geometry=geom, settings=settings, tallies=[tally_transmitted, tally_backscattered])

Run the simulation

output = model.run()

Extract results

results_transmitted = output.get_tally(name=‘transmitted’)

results_backscattered = output.get_tally(name=‘backscattered’)

Plot the geometry

openmc.plot_geometry(geom)

openmc.plot_geometry(geom, filename=‘geometry_plot.png’)

Print results

print(“Number of neutrons transmitted through water:”, results_transmitted.mean)

print(“Number of neutrons backscattered from rock:”, results_backscattered.mean).

and this is the error.

“”
{
“name”: “RuntimeError”,
“message”: “Could not find nuclide O18 in the nuclear data library. -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------”,
“stack”: "---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[2], line 67
63 model = openmc.model.Model(geometry=geom, settings=settings, tallies=[tally_transmitted, tally_backscattered])
66 # Run the simulation
—> 67 output = model.run()
69 # Extract results
70 results_transmitted = output.get_tally(name=‘transmitted’)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/model/model.py:711, in Model.run(self, particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, export_model_xml, **export_kwargs)
709 else:
710 self.export_to_xml(**export_kwargs)
→ 711 openmc.run(particles, threads, geometry_debug, restart_file,
712 tracks, output, Path(‘.’), openmc_exec, mpi_args,
713 event_based)
715 # Get output directory and return the last statepoint written
716 if self.settings.output and ‘path’ in self.settings.output:

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:314, in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, path_input)
261 """Run an OpenMC simulation.
262
263 Parameters
(…)
305
306 """
308 args = _process_CLI_arguments(
309 volume=False, geometry_debug=geometry_debug, particles=particles,
310 restart_file=restart_file, threads=threads, tracks=tracks,
311 event_based=event_based, openmc_exec=openmc_exec, mpi_args=mpi_args,
312 path_input=path_input)
→ 314 _run(args, output, cwd)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:125, in _run(args, output, cwd)
122 error_msg = ‘OpenMC aborted unexpectedly.’
123 error_msg = ’ '.join(error_msg.split())
→ 125 raise RuntimeError(error_msg)

RuntimeError: Could not find nuclide O18 in the nuclear data library. -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------"
}
“”

how can I solve this?

It looks like the important part of this error message is …

Could not find nuclide O18 in the nuclear data library.

It looks like your cross_sections.xml file located at “/home/harriet/OPENMC/nndc_hdf5_v8/nndc_hdf5/cross_sections.xml” does not contain contain a line for O18.

You could download some more nuclear data from one of these

https://openmc.org/data-libraries/

or you could change the material to just include the minor nuclides of Oxygen if you want a quick fix

these two lines could be changed

rock.add_element(‘O’, 0.622)
water.add_element(‘O’, 1)

to

rock.add_nuclide(‘O16’, 0.622)
water.add_nuclide(‘O16’, 1)

thank you I was able to solve this but I still get this error.

“”
{
“name”: “RuntimeError”,
“message”: “HDF5 data format uses version 1.0 whereas your installation of OpenMC expects version 3.x data. -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------”,
“stack”: "---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[9], line 75
71 model = openmc.model.Model(geometry=geom, settings=settings, tallies=[tally_transmitted, tally_backscattered])
74 # Run the simulation
—> 75 output = model.run()
77 # Extract results
78 results_transmitted = output.get_tally(name=‘transmitted’)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/model/model.py:711, in Model.run(self, particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, export_model_xml, **export_kwargs)
709 else:
710 self.export_to_xml(**export_kwargs)
→ 711 openmc.run(particles, threads, geometry_debug, restart_file,
712 tracks, output, Path(‘.’), openmc_exec, mpi_args,
713 event_based)
715 # Get output directory and return the last statepoint written
716 if self.settings.output and ‘path’ in self.settings.output:

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:314, in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, path_input)
261 """Run an OpenMC simulation.
262
263 Parameters
(…)
305
306 """
308 args = _process_CLI_arguments(
309 volume=False, geometry_debug=geometry_debug, particles=particles,
310 restart_file=restart_file, threads=threads, tracks=tracks,
311 event_based=event_based, openmc_exec=openmc_exec, mpi_args=mpi_args,
312 path_input=path_input)
→ 314 _run(args, output, cwd)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:125, in _run(args, output, cwd)
122 error_msg = ‘OpenMC aborted unexpectedly.’
123 error_msg = ’ '.join(error_msg.split())
→ 125 raise RuntimeError(error_msg)

RuntimeError: HDF5 data format uses version 1.0 whereas your installation of OpenMC expects version 3.x data. -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------"
}
“”

The important part of that error message

RuntimeError: HDF5 data format uses version 1.0 whereas your installation of OpenMC expects version 3.x data

I would recommend downloading the hdf5 files from openmc.org

thank you very much that worked. but hopefully this will be the last error i get. “”

“”
{
“name”: “RuntimeError”,
“message”: “No fission sites banked on MPI rank 0 -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------”,
“stack”: "---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[14], line 76
72 model = openmc.model.Model(geometry=geom, settings=settings, tallies=[tally_transmitted, tally_backscattered])
75 # Run the simulation
—> 76 output = model.run()
78 # Extract results
79 results_transmitted = output.get_tally(name=‘transmitted’)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/model/model.py:711, in Model.run(self, particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, export_model_xml, **export_kwargs)
709 else:
710 self.export_to_xml(**export_kwargs)
→ 711 openmc.run(particles, threads, geometry_debug, restart_file,
712 tracks, output, Path(‘.’), openmc_exec, mpi_args,
713 event_based)
715 # Get output directory and return the last statepoint written
716 if self.settings.output and ‘path’ in self.settings.output:

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:314, in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based, path_input)
261 """Run an OpenMC simulation.
262
263 Parameters
(…)
305
306 """
308 args = _process_CLI_arguments(
309 volume=False, geometry_debug=geometry_debug, particles=particles,
310 restart_file=restart_file, threads=threads, tracks=tracks,
311 event_based=event_based, openmc_exec=openmc_exec, mpi_args=mpi_args,
312 path_input=path_input)
→ 314 _run(args, output, cwd)

File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py:125, in _run(args, output, cwd)
122 error_msg = ‘OpenMC aborted unexpectedly.’
123 error_msg = ’ '.join(error_msg.split())
→ 125 raise RuntimeError(error_msg)

RuntimeError: No fission sites banked on MPI rank 0 -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. --------------------------------------------------------------------------"
}
“”

Yes that is a new error message so it looks like the cross section error is resolved.

The No fission sites banked on MPI rank 0 error has come up before on the forum perhaps best to look at the other threads on the topic.

thank you soo much for your help. I will look at the other threads and solve it.