Depletion calculation error: "KeyError: 'No material exists with ID=100.'"

Hello, I tried to use the depletion module for the first time today but I ran into an issue, when I run the depletion just as a test with one time step and a contant power of 100 W, it gives me this error: "WARNING: Negative value(s) found on probability table for nuclide Cd106 at 294K
WARNING: Negative value(s) found on probability table for nuclide Ar36 at 294K

WARNING: Could not find material 1 specified in plot 1
WARNING: Could not find material 2 specified in plot 1
WARNING: Could not find material 3 specified in plot 1
WARNING: Could not find material 4 specified in plot 1
WARNING: Could not find material 5 specified in plot 1
WARNING: Could not find material 6 specified in plot 1
WARNING: Could not find material 7 specified in plot 1
WARNING: Could not find material 8 specified in plot 1
WARNING: Could not find material 1 specified in plot 2
WARNING: Could not find material 2 specified in plot 2
WARNING: Could not find material 3 specified in plot 2
WARNING: Could not find material 4 specified in plot 2
WARNING: Could not find material 5 specified in plot 2
WARNING: Could not find material 6 specified in plot 2
WARNING: Could not find material 7 specified in plot 2
WARNING: Could not find material 8 specified in plot 2
WARNING: Could not find material 1 specified in plot 3
WARNING: Could not find material 2 specified in plot 3
WARNING: Could not find material 3 specified in plot 3
WARNING: Could not find material 4 specified in plot 3
WARNING: Could not find material 5 specified in plot 3
WARNING: Could not find material 6 specified in plot 3
WARNING: Could not find material 7 specified in plot 3
WARNING: Could not find material 8 specified in plot 3
WARNING: Could not find material 1 specified in plot 4
WARNING: Could not find material 2 specified in plot 4
WARNING: Could not find material 3 specified in plot 4
WARNING: Could not find material 4 specified in plot 4
WARNING: Could not find material 5 specified in plot 4
WARNING: Could not find material 6 specified in plot 4
WARNING: Could not find material 7 specified in plot 4
WARNING: Could not find material 8 specified in plot 4

InvalidIDError Traceback (most recent call last)
File ~/OpenMC_NEW/lib/python3.12/site-packages/openmc/lib/material.py:297, in _MaterialMapping.getitem(self, key)
296 try:
→ 297 _dll.openmc_get_material_index(key, index)
298 except (AllocationError, InvalidIDError) as e:
299 # contains expects a KeyError to work correctly

File ~/OpenMC_NEW/lib/python3.12/site-packages/openmc/lib/error.py:29, in _error_handler(err, func, args)
28 if err == errcode(‘OPENMC_E_INVALID_ID’):
—> 29 raise exc.InvalidIDError(msg)
30 elif err == errcode(‘OPENMC_E_GEOMETRY’):

InvalidIDError: No material exists with ID=100.

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
Cell In[10], line 10
6 POWER = 301.205 # Watts
8 integrator = openmc.deplete.PredictorIntegrator(op, TIME, POWER, timestep_units=‘d’)
—> 10 integrator.integrate()

File ~/OpenMC_NEW/lib/python3.12/site-packages/openmc/deplete/abc.py:793, in Integrator.integrate(self, final_step, output, path)
774 “”“Perform the entire depletion process across all steps
775
776 Parameters
(…)
790 .. versionadded:: 0.15.0
791 “””
792 with change_directory(self.operator.output_dir):
→ 793 n = self.operator.initial_condition()
794 t, self._i_res = self._get_start_data()
796 for i, (dt, source_rate) in enumerate(self):

File ~/OpenMC_NEW/lib/python3.12/site-packages/openmc/deplete/coupled_operator.py:390, in CoupledOperator.initial_condition(self)
387 openmc.lib.init(intracomm=comm)
389 # Generate tallies in memory
→ 390 materials = [openmc.lib.materials[int(i)] for i in self.burnable_mats]
392 return super().initial_condition(materials)

File ~/OpenMC_NEW/lib/python3.12/site-packages/openmc/lib/material.py:300, in _MaterialMapping.getitem(self, key)
297 _dll.openmc_get_material_index(key, index)
298 except (AllocationError, InvalidIDError) as e:
299 # contains expects a KeyError to work correctly
→ 300 raise KeyError(str(e))
301 return Material(index=index.value)

KeyError: ‘No material exists with ID=100.’"

this is the material ID that raised the error: “materials
ID = 100
Name = UO2
Temperature = None
Density = 10.55 [g/cm3]
Volume = 12149.0531936 [cm^3]
Depletable = True
S(a,b) Tables
Nuclides
U238 = 0.7038400000000001 [wo]
U236 = 0.00018894 [wo]
U235 = 0.02438550000000001 [wo]
U234 = 0.00138556 [wo]
C12 = 0.00003932267243441033 [wo]
C13 = 4.773275655896763e-06 [wo]
Fe54 = 1.78812034782065e-05 [wo]
Fe56 = 0.000003027013624242066 [wo]
Fe57 = 0.0001817216316800261e-05 [wo]
Fe58 = 0.0006002177807866417e-06 [wo]
O16 = 0.001279596037814502 [wo]
O17 = 0.0166441332171615e-07 [wo]
O18 = 0.08873180522809305e-06 [wo]
N14 = 0.000016584685601599772 [wo]
N15 = 0.000531439840022731e-06 [wo]
Al27 = 0.0000000398 [wo]
B10 = 0.00835549587507326e-06 [wo]
B11 = 8.164450412492673e-06 [wo]
Si28 = 0.000008071053361078421 [wo]
Si29 = 0.0071210210309880436 [wo]
Si30 = 0.000000063599453582277444 [wo]
Al27 = 0.08328885 [wo],”

and this is the depletion command: "op = mc.deplete.CoupledOperator(excess_reactivity,‘/home/user/data/projects/openmc/share/data/chain_endfb80.xml’)

TIME = [365] # days
POWER = 100 # Watts

integrator = openmc.deplete.PredictorIntegrator(op, TIME, POWER, timestep_units=‘d’)

integrator.integrate()"

If anyone has an idea at least of what might be causing the issue, I’d appreciate a suggestion.

The problem has been resolved, turned out the issue is caused by the existence of multiple XML files and not reading the intended ones when wanting to run the depletion model.

I have never used the openmc.Model class, and had to use it to run the depletion module, that’s why a confusing with managing XML files occurred in the first place.

1 Like