Error Encountered in Burnup Analysis Using 'openmc.deplete.PredictorIntegrator' Function

I have been attempting to run a code for burnup analysis; however, I encountered an error when using the ‘openmc.deplete.PredictorIntegrator’ function. I am unsure if there is a way to link the XML files with the ‘openmc.deplete.Chain.from_xml’ and ‘openmc.deplete.CoupledOperator’ functions. The code executes correctly up to the ‘openmc.deplete.PredictorIntegrator’ function, provided that the XML file paths are not included. I have attached the relevant screenshots and link for reference.




Thank you for bringing this issue to our attention. As of now, NukeLab does not come with depletion chain files by default. However, you can download depletion chain files directly from the OpenMC website: Depletion Chains. We’re actively working to incorporate this in future releases.

In the meantime, you can use the openmc.deplete.Chain and openmc.deplete.CoupledOperator classes to link the depletion chain XML file to your burnup analysis. Here’s an example of how to do that:

Example Code:

import openmc
import openmc.deplete
import numpy as np

# Option 1: Create a new depletion chain from ENDF files
decay_files = ['decay_data.endf']  # ENDF decay data files
fpy_files = ['fpy_data.endf']      # fission product yield data files
neutron_files = ['neutron_data.endf']  # neutron reaction data files

chain = openmc.deplete.Chain.from_endf(decay_files, fpy_files, neutron_files)

# Export the chain to an XML file
chain.export_to_xml('depletion_chain.xml')

chain_file = 'depletion_chain.xml'


# Option 2: Download the chain file from OpenMC Depletion Chains repository

chain_file = "chain_endfb71_pwr.xml"  # Ensure you have this file downloaded

# Load the depletion chain from the XML file
chain = openmc.deplete.Chain.from_xml(chain_file)

# Display information about the chain
print(f"Number of nuclides in chain: {len(chain.nuclides)}")
print(f"Number of reactions in chain: {len(chain.reactions)}")

# Define your OpenMC model (geometry, settings, materials)
model = openmc.Model(geometry=geom, settings=settings, materials=materials)

# Create the CoupledOperator using the model and depletion chain file
operator = openmc.deplete.CoupledOperator(model=model, chain_file=chain_file)

# Define power and burnup steps
power = 110  # Power in MW
bu_steps = np.array([0.2, 0.4, 0.6, 1.1, 1.6, 2.6, 3.6, 4.6])  # Burnup steps in MWd/kg
burnup = np.diff(bu_steps, prepend=0.0)
timesteps = [30] * 8  # Time steps corresponding to burnup steps

# Create the PredictorIntegrator for depletion
integrator = openmc.deplete.PredictorIntegrator(operator, burnup, timesteps, power, timestep_units='MWd/kg')

# Run the integration (depletion simulation)
integrator.integrate()

Feel free to try this method, and let us know if you encounter any issues.

2 Likes

Downloading the depletion chain file is not enough. Then it needs to upload the chain file in that particular folder. It works fine this way.

1 Like

Thank you so much for providing the solution! I truly appreciate the time and effort you took to assist me.

1 Like