openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Feature request: deplete.export_to_materials to support individual material export

Open shimwell opened this issue 3 years ago • 1 comments

Hi all,

Could the deplete.export_to_materials be modified to allow the exporting of a single material instead of all materials in the model.

This could be done with the addition of another argument that identifies material ids to loop through. Currently we loop through all the materials

This could save some processing time for user that just want to extract one material

Would this be a welcome feature or is it unnecessary.

Currently I'm indexing the returned materials to get the one I am interested in. So I have a work around and this is perhaps not necessary.

results = openmc.deplete.Results.from_hdf5("depletion_results.h5")
material = results.export_to_materials(step)[0] # <--- [0] as I'm interested in just the first material

shimwell avatar Jul 18 '22 10:07 shimwell

Could be useful, espec when doing results analysis.

yardasol avatar Aug 31 '22 16:08 yardasol

We now have get_material in the StepResult class that mainly solves this feature request.

https://github.com/openmc-dev/openmc/blob/46045588f50c1dac0106942d3851a772497c2fa1/openmc/deplete/stepresult.py#L202

So I think this is good to close. Feel free to reopen if anyone feels this needs further work.

shimwell avatar Oct 03 '22 08:10 shimwell