Problem in burnup

Hi,

I hope to run burnup simulation through openmc. The following is the program of my burnup part (most of them refer to the program in example)

#burnup
chain_file = "chain_casl.xml"
op = openmc.deplete.Operator(geometry,settings,chain_file)
timesteps = [5.0, 10, 20]
full_power = 1000.0e6
power = [full_power, full_power, full_power]
integrator = openmc.deplete.CECMIntegrator( op, timesteps, power=power, timestep_units='d')
get_results_info(U235)

The result is: OSError: Error reading file ‘chain’_ casl.xml ‘: failed to load external entity "chain_ casl.xml "
And then I added
chain_file.export_to_xml()
Result is : AttributeError: ‘str’ object has no attribute ‘export_to_xml’.
Did I download some less data? Or does my program need to be modified?

Best regards,

Lei

@SaitoAsuka If the external entity that you’re trying to load in that case chain_casl.xml is not on your current folder, then the error would be caused by that.

#burnup
chain_file = "/path/to/chain_casl.xml"

Sorry, I can’t find “chain_casl.xml” in JEFF 3.3 nuclear data. Is it in openmc-env? Or do I need to download it separately?

@SaitoAsuka Download link for chain_casl_pwr.xml.
Other depletion chain file download link: depletion-chain

Thank you for your links, but now there is another error:

RuntimeError: Volume not specified for depletable material with ID=1

I have defined cell for the fuel by

fuel_or = openmc.ZCylinder(r=0.39)
fuel_cell = openmc.Cell(name='Fuel', fill=uo2,region=-fuel_or)
moderator_cell = openmc.Cell(name=‘Moderator’, fill=water,region=+fuel_or)
pin_cell_universe = openmc.Universe(name=‘pwr Fuel Pin’, cells=[fuel_cell,moderator_cell])

How can I specify the volume of the materials?

fuel = openmc.Material()
fuel.depletable = True

fuel_or = openmc.ZCylinder(r=0.39)

fuel.volume = math.pi * fuel_or.coefficients['r'] ** 2

pincell depletion example might be helpful for you.

Thank you very much. I can now run the burnup simulator successfully.
For data analysis, is there any method for me to get the atomic concentration and keff of each timestep in burnup?

# post processing

import openmc.deplete
import matplotlib.pyplot as plt

import h5py
>> f = h5py.File('depletion_results.h5', 'r')
>> list(f['reactions']

['(n,2n)', '(n,3n)', '(n,4n)', '(n,a)', '(n,gamma)', '(n,p)', 'fission']


# Let's open results file

results = openmc.deplete.ResultsList.from_hdf5('depletion_results.h5')

# K_eff as a function of time

time, keff = results.get_eigenvalue()
days = 24*60*60
plt.plot(time/days, keff, label="K-effective")
plt.xlabel("Time (days)")
plt.ylabel("Keff")
plt.legend()
plt.show()

# U-235 concentration change over time

time, u235 = results.get_atoms("1", 'U235', nuc_units='atom/b-cm', time_units='d')
plt.plot(time, u235, label='U235 concentration')
plt.xlabel('Burnup units in Days')
plt.ylabel('Concentration in atom/b-cm')
plt.legend()
plt.show()

# U-235 fission rate change over time

time, u5_fission = results.get_reaction_rate("1", "U235", "fission")
plt.plot(time/days, u5_fission)
plt.xlabel("Time [d]")
plt.ylabel("Fission reactions / s")
plt.show()

https://docs.openmc.org/en/stable/examples/pincell-depletion.html

No, I mean, does openmc have code to generate “.m” files (like serpent), which makes it very convenient for me to process data in MATLAB.

Saito,

OpenMC does not have a way to generate MATLAB files. If you want to convert to something that can be read with MATLAB, you can use scipy.io.savemat after pulling the data from the HDF result file. The routines in the pincell depletion example, linked above, would be a good starting point.

If you wish to compare against Serpent, I would recommend looking into GitHub - CORE-GATECH-GROUP/serpent-tools: A suite of parsers designed to make interacting with SERPENT output files simple and flawless

(full disclosure I am the lead developer for that project and fairly biased)

Best regards,

Andrew

Hi,

I don’t think it’s necessary to generate .m files. For example, openmc will generate a deletion_results.h5 file after running burnup simulation, and Matlab can read the data in h5 file through this code

data = h5read(‘data4torch.h5’,‘/data’);

where ‘/data’ is the dataset in the h5 file. And now I’m confused about which dataset is corresponding to keff and atomic concentration in the h5 file.

First read entire h5 file
>> h5disp('depletion_results.h5');
and then read the dataset e.g `eigenvalues`
>> h5read('depletion_results.h5','/eigenvalues');

Hope this will help.

Yes, thank you very much! It works very well.
And how can I get the concentration of a specific nuclide, e.g. U235

The file specifications can be found at 4. Depletion Results File Format — OpenMC Documentation

There you will find a breakdown of how the data are arranged inside the depletion result file