A proposal for consistent behavior between Results.export_to_material
and StepResult.get_material
#3126
Labels
Results.export_to_material
and StepResult.get_material
#3126
Description
There are currently two ways to construct
Material
Python objects from depletion results:openmc.Results.export_to_materials
openmc.StepResult.get_material
I understand that they serve different purposes (one resulting material definition is intended for neutron transport and the other is a description of the depleted material composition from the depletion results). The outcome is that we have two different ways of obtaining
Material
objects during depletion post-processing.As
StepResult.get_material
is used in many other places withinResults
, I propose that we changeResults.export_to_materials
to useget_material
under the hood. To maintain the current behavior, I'll propose a method be added toMaterial
that removes nuclides without transport cross-sections based on the current configuration. (I think the nuclide removal method is best placed there, but others may have more thoughts on that). This method can be called on each resulting material object and should result in the same material compositions returned by the method now.I think this flag could replace the
nuc_with_data
capability in most cases, simplifying this method. It also places logic for material construction in a single place, which is generally preferrable for codebase maintenance.New proposed signature:
Alternatives
Perhaps changing the name of the
export_to_materials
to something likeexport_to_transport_materials
would perhaps clarify the purpose of this method, but it would not solve the underlying inconsistency in material generation from depletion result files.Compatibility
If the
nuc_with_data
option is removed, this would be a breaking change. This one is optional I'd say though. The method can still be refactored to useget_material
without any change to this method signature in theory. I simply prefer the option of a flag I've suggested above. So, TBD.The text was updated successfully, but these errors were encountered: