openmc-dev / openmc

OpenMC Monte Carlo Code
https://docs.openmc.org
Other
699 stars 444 forks source link

`IndependentOperator` does not work as intended for decay-only problem #2963

Closed gridley closed 1 week ago

gridley commented 2 weeks ago

Bug Description

IndependentOperator claims that using an empty MicroXS object allows a decay-only step. It appears that trying to handle only decay, without any associated openmc.Model object, results in an error saying that no heat was found from the OpenMC output.

[openmc.deplete] t=0.0 s, dt=1.0 s, source=0.0
No energy reported from OpenMC tallies. Do your HDF5 files have heating data?

Well that's exactly what I expect! No transport-induced heat production, and pure decay. IndependentOperator suggests this is allowable use of it, to quote the documentation:

  Note that passing an empty :class:`~openmc.deplete.MicroXS` instance to the
  ``micro_xs`` argument allows a decay-only calculation to be run.

If I am not using this class correctly, the documentation should be improved.

Steps to Reproduce

Here's an MWE that produces the error:

import numpy as np
import openmc
import openmc.deplete

chain_file = '/home/gavin/Data/chain_endfb71_pwr.xml'
openmc.config['chain_file'] = chain_file
openmc.config['cross_sections'] = '/home/gavin/Data/endfb-viii.0-hdf5/cross_sections.xml'

decay_times = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])

# Create one material to deplete
mat = openmc.Material()
mat.name = 'I decay!'
mat.add_nuclide('U239', 1.0, 'ao')
mat.volume = 10.0
mats = openmc.Materials([mat])

empty_micro = openmc.deplete.MicroXS(np.array([]).reshape((0, 0)), [], [])
op = openmc.deplete.IndependentOperator(mats, [1.0], [empty_micro], chain_file)
integ = openmc.deplete.PredictorIntegrator(op, decay_times, power=0.0, timestep_units='s')
integ.integrate()

I would hope to see the decay progeny of U239 appear here.

Environment

On the latest commit 2974d53b3c07dc1a822f2b31ecd27b6553cbd458. Ubuntu. Nuclear data libraries are visible in the MWE.