Extracting generation-wise tallies

Hi folks,

My goal can be boiled down to this: I’d like to capture an array of mesh-tally values for each generation to help myself understand inter-generational correlation.

I can produce a state point for each generation, and I can extract tallies from the state point. I think this gives me the sum and sum of squares up to and including that generation so that successive differences give me everything I need. Is that true? Is there an easier way to do this?

Thanks,
Jeremy

I’ve had a chance to confirm what I proposed will work. I suspect for my purposes that any deviations due to round-off errors introduced when taking the successive differences should be unimportant.

Hey Jeremy!

Yes, what you proposed will indeed work. However, I’d like to point out that the Python bindings to our C API would allow you to do this without constantly writing/reading statepoints. Using these bindings, it would look something like:

openmc.capi.init()
openmc.capi.simulation_init()

tally = openmc.capi.tallies[1]

for i in range(n_batches):
openmc.capi.next_batch()
result = tally.results

Do something with tally results

openmc.capi.simulation_finalize()
openmc.capi.finalize()

In this case, the tally results array that is actually used internally in the code is exposed as a 3D numpy array. The first dimension corresponds to filter combinations, the second dimension corresponds to scores, and the third dimension has three values that store temporary value, sum, and sum of squares. Let me know if you want me to walk you through this more.

Best,
Paul

Perfect! I knew there had to be a way but hadn’t dug in far enough to the C API yet.

Thanks,
Jeremy