KeyError: 'absorption'

Hi all,
I am trying to find the absorption reaction rate of a few nuclides for which I’m geting a key word error when i use the string ‘absorption’. Can you tell me if the string i used is wrong?
P.S: I intend to calculate the conversion ratio by dividing sum of n,gamma reaction rates by sum of absorption reaction rates.

This is the command i used:
_time, u233abs_rate = results.get_reaction_rate(“1”, “U233”, ‘absorption’)

Best,
Mashaba

KeyError: ‘absorption’

@Mashaba In a depletion simulation, only a few specific reaction rates are saved in the depletion results file, e.g. (n,gamma) and (n,2n). If we want the absorption rate through depletion, what you should do is define a tally including that reaction rate and export it to a tallies.xml file before beginning the depletion simulation.

tally = openmc.Tally()
tally.nuclides = ['U233', ...]
tally.scores = ['absorption']
tallies = openmc.Tallies([tally])
tallies.export_to_xml()

Then, at each depletion step when a statepoint is written, it wlll include that tally and you can use the openmc.StatePoint class to get the result.

1 Like

@paulromano okay i have made the changes like you said I am able to calculate the mean and standard deviation.
but how can I read the absorption rate at different burnups e.g. 10-100 MWd/kg and assign it to an array?

@Mashaba After each transport run, depletion module writes tally data to statepoint file. Open each statepoint file using the StatePoint class just like you did after the transport run. Here file names are named

  • openmc_simulation_n0.h5 = At fresh
  • openmc_simulation_n1.h5 = First burn
  • openmc_simulation_n2.h5 = Second burn

and so on…

sp = openmc.StatePoint('openmc_simulation_n1.h5')
tally = sp.get_tally(name='name of the tally')
tally.get_pandas_dataframe()

Keep continue for the other files.

Hope this will help!

1 Like

It definitely helped! @Pranto but is there any way i can transfer those absorption rate values to an array…for example using a for loop or a command or something?

THERE’S SEEMS TO BE ANOTHER PROBLEM. im plotting k eigenvalues with respect to burnup. But the time variable generated doesn’t match with the burnup time steps i’ve defined.

operator = openmc.deplete.Operator(geom, settings_file, “./chain_casl_pwr.xml”)
time_steps=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
integrator = openmc.deplete.PredictorIntegrator(operator, time_steps, power=200.0e6,power_density=None,timestep_units=‘MWd/kg’)
integrator.integrate()
import openmc.deplete
results = openmc.deplete.ResultsList.from_hdf5("./depletion_results.h5")
time, k = results.get_eigenvalue()
time

array([ 0. , 30.70370534, 92.11111603, 184.22223206,
307.03705344, 460.55558016, 644.77781222, 859.70374963,
1105.33339238, 1381.66674048, 1688.70379392])

Best,
Mashaba :slight_smile:

When i specify the nuclides using tally.nuclides=[‘all’] the kernel dies.
even when i specify the nuclides using abs_rate.nuclides = [‘U233’,‘U235’,‘Pu239’,‘Pu241’] the kernel dies saying it didnt find U-233 in the material. BUT these nuclides will contribute to the absorption rate of neutron ,consequently the conversion ratio later when they are formed so i will need their absorption rate.
What should i do?

@Mashaba I would suggest adding a very low concentration of U233 (e.g., 1e-12) into your original material to avoid that error. Even though U233 will get added in during depletion, if you try to tally it on the first timestep and it doesn’t see it in the original material, you’ll get this error.

Have not considered that but I’ll go for a even small value 1e-24 or restart depletion after 1st time-step and don’t forget to update tally definition this time.