# Asking for help to fix

Hello. I am new to openmc. I am trying to simulate burnup analysis with onix-openmc coupling.
my code is

import openmc
import onix
import openmc.mgxs as mgxs
from onix.cell import Cell
from onix.system import System
from onix import salameche

from onix import utils
import matplotlib
from matplotlib import pyplot
import numpy as np
import math
import matplotlib_inline

#defining material
uo2_35 = openmc.Material()
uo2_35.set_density(“g/cm3”, 10.77)
uo2_35.volume = 63.51
#gd2o3 = openmc.Material()
#gd2o3.set_density(‘g/cm3’,7.41)
#mixing fuel elements
#mixer = openmc.Material.mix_materials([uo2_35,gd2o3],[0.6,0.4])
#moderator and coolant material
h2o = openmc.Material()
h2o.set_density(‘g/cm3’, 1)
#zircalloy
zr_alloy = openmc.Material()
zr_alloy.set_density(‘g/cm3’, 6.56)
#hellium
#he = openmc.Material(5,‘gap_material’)
materials = openmc.Materials([uo2_35, h2o, zr_alloy])
materials.export_to_xml()
#defining geometry
fuel_or = openmc.ZCylinder(r=0.38)
hexa_prism = openmc.model.HexagonalPrism(edge_length=1.38, boundary_type=‘reflective’)

up = openmc.ZPlane(z0=+70, boundary_type=‘vacuum’)
down = openmc.ZPlane(z0=-70, boundary_type=‘vacuum’)
right = openmc.XPlane(x0=0.97, boundary_type=‘vacuum’)
left = openmc.XPlane(x0=-0.97, boundary_type=‘vacuum’)
p_width = openmc.YPlane(y0=1.19, boundary_type=‘vacuum’)
n_width = openmc.YPlane(y0=-1.19, boundary_type=‘vacuum’)
#defining region
fuel_reg = -fuel_or & -up & +down
gap_reg = -clad_ir & +fuel_or & -up & +down
mod_reg = +clad_or & -hexa_prism & -up & +down
com_reg = -hexa_prism
#defining region
‘’‘fuel_reg = -fuel_or & -up & +down
gap_reg = -clad_ir & +fuel_or & -up & +down
mod_reg = +clad_or & -hexa_prism & -up & +down’‘’
#fuel cell
fuel_cell1 = openmc.Cell()
fuel_cell1.fill = uo2_35
fuel_cell1.region = fuel_reg
fuel_cell1.volume= 63.51
#moderator cell
mod_cell = openmc.Cell()
mod_cell.fill = h2o
mod_cell.region = mod_reg
#gap cell
gap_cell = openmc.Cell()
gap_cell.fill = None
gap_cell.region = gap_reg

‘’'com_cell = openmc.Cell()

com_cell.region = fuel_reg | gap_reg | clad_reg | mod_reg & -up & +down
vol_clc = openmc.VolumeCalculation([com_cell], 10000000, [-0.97, -1.19, -70], [0.97, 1.19, 70])‘’’

#universe
root = openmc.Universe(cells=(fuel_cell1, gap_cell, clad_cell, mod_cell))
root_cell = openmc.Cell()
root_cell.fill = root
root_cell.region = fuel_reg & gap_reg & clad_reg | mod_reg
root_univ = openmc.Universe()

geom = openmc.Geometry(root_univ)

#root_2 = openmc.Universe(cells=(mod_cell))

geom.export_to_xml()
‘’'p = openmc.Plot()
p.filename = ‘hexacaremplot’
p.width= (3.0,3.0)
p.pixels = (2500,2500)

openmc.plot_inline(p)‘’’
sets = openmc.Settings()
sets.batches = 200
sets.inactive = 50
sets.particles = 1000
sets.export_to_xml()
#openmc.run()
macrostep_vector = [0.1, 0.5, 2.5, 7.5, 15, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420]
macrostep_unit = ‘d’
norma_vector = [550] * len(macrostep_vector)
norma_unit = ‘power’
microstep_vector = [3] * len(macrostep_vector)
microstep_vector = [3] * len(macrostep_vector)
sequence1 = onix.Sequence(1)
sequence1.set_macrostep(macrostep_vector, macrostep_unit)
sequence1.set_norma(norma_vector, norma_unit)
sequence1.microstep_vector = microstep_vector
sequence1.flux_approximation = ‘iv’
bu_cell = onix.cell.Cell(1, ‘burn_cell’)

bu_cell.set_default_decay_lib()
#bu_cell = root_cell
couple = onix.couple.Couple_openmc()

couple.set_bounding_box([-0.97, -1.19, -70], [0.97, 1.19, 70])

#couple.openmc_bin_path = ‘/home/noor-al-din/anaconda3/envs/openmc-env/bin’
couple.select_bucells([fuel_cell1])
#couple.root_cell(com_cell)
couple.import_openmc(root_cell)
vol = {‘fuel_cell’: 63.51}
couple.set_vol(vol)
couple.set_sequence(sequence1)
couple.burn()
but it is showing
{}
=== OpenMC pre-run ===

Traceback (most recent call last):
File “/home/noor-al-din/PycharmProjects/pythonProject/project carem/onix3.py”, line 144, in
couple.import_openmc(root_cell)
File “/home/noor-al-din/anaconda3/envs/openmc-env/lib/python3.12/site-packages/onix/couple/couple_openmc.py”, line 312, in import_openmc
self._pre_run(root_cell)
File “/home/noor-al-din/anaconda3/envs/openmc-env/lib/python3.12/site-packages/onix/couple/couple_openmc.py”, line 458, in _pre_run
openmc.calculate_volumes(cwd = pre_run_path)
File “/home/noor-al-din/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py”, line 254, in calculate_volumes
_run(args, output, cwd)
File “/home/noor-al-din/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py”, line 125, in _run
raise RuntimeError(error_msg)
RuntimeError: No cells were found in the geometry.xml file -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD Proc: [[47750,0],0] 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. --------------------------------------------------------------------------
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%

Hi Noor Al Din, welcome to the openmc community.
the problem you encounter is
`RuntimeError: No cells were found in the geometry.xml file `
which came from this line input `root_univ.add_cell = root_cell`, which makes the material.xml file empty. It should be `root_univ.add_cell(root_cell)` so the root_cell will be added as root universe for your openmc model.
also, this part of region definitions `root_cell.region = fuel_reg & gap_reg & clad_reg | mod_reg` can’t work since the fuel region will not intersect (&) to gap regions and so on.
try to use a simpler method, such as the root cell covering the area of 1 fuel pin with coolant which is then filled with fuel pin universe.

also, there are several other things that you should pay attention to when using Onix, i.e. Onix can’t handle add_element if you use that when defining depletable material, so you need to use add_nuclide. also, problems might arise in the Onix routine when you use void material in root cells, and don’t forget to add total volume in your Onix openmc volume definition. With many Onix examples from their documentation, I think it would be good practice to give names to all your cells.

your model has a low heavy metal loading (low k-inf value) for 420 days of operation in 550 watts/cc. You might want to check your input. Here is the notebook for your case
nooronix.ipynb (1.5 MB)

Thank you very much for your help.
but in my jupyter note book
File ~/anaconda3/envs/openmc-env/lib/python3.12/site-packages/numpy/linalg/_linalg.py:162, in _commonType(*arrays) 159 result_type = double 160 elif rt is None: 161 # unsupported inexact scalar → 162 raise TypeError(“array type %s is unsupported in linalg” % 163 (a.dtype.name,)) 164 else: 165 result_type = double TypeError: array type complex256 is unsupported in linalg
have you faced this issue before?

Hi Noor,
Sorry, I didn’t get any error when running your case, you can check the notebook file I attached. Have you tried to run the openmc-onix notebook example to make sure that you have a proper configuration?
You can also try to localize the problem in your model, i.e. try to run the openmc part of your input and then run the coupled openmc-onix.