Issues with R2S data persistence, photon tallies

When using the openmc.deplete.R2S Manager, I’ve encountered some issues with storing and accessing photon tallies from different time steps, and perhaps relatedly overwriting of statepoint files.

My neutron model specifies an output path for saving files into, and when my photon model is copied based upon that, the same output path is stored. I’ve found this results in the statepoint files being saved in the parent directory (defined by settings.output[“path”]), rather than within e.g., ‘photon_transport’ and each overwriting each other so that each time step does not have an independent statepoint file (as appears to be expected based on code in R2SManager.load_results()).

Despite the statepoints overwriting each other, I think the ‘results’ object within R2SManager should still be storing independent copies of the photon tallies since those are being copied over each time a new photon run is completed (~lines 533-536 in r2s.py). However, I find that each of the different time steps have identical photon tallies (again I think overwriting the last ones). In debugging, when I add a print statement of <print(self.results)> (or various variations of that), each tally is saved independently and I get the desired behavior, with this illustrated below- the only difference is adding <print(self.results)> to lines 538 in r2s.py.

I’ve managed to fix both of these issues by clearing the settings.output entry in my photon model, but I wanted to raise the issue and see if this was the expected and desired behavior, both in regard to the memory handling in r2s.py

(lines 534-537: “ with openmc.StatePoint(statepoint_path) as sp:

            self.results\['photon_tallies'\]\[time_index\] = \[

sp.tallies[tally.id] for tally in self.photon_model.tallies

            \]”), 

and with regards to needing to clear the settings.output entry in order to get this functionality to work.

Thanks for implementing the R2SManager capability, and thanks in advance for any insight on this,
Marc