Material.add_material(...) method
Created by: samuelshaner
This short PR adds an add_material(...)
method to the Material object in the Python API. This method is useful when trying to homogenize multiple materials by atom percent (e.g. for the C5G7 benchmark or water/structural materials in BEAVRS) or weight percent (e.g. for the TREAT fuel/graphite blocks). The add_material(...)
is structured such that it expands a given material into its constituent nuclides and adds the nuclides to the base material.
While this method is handy, there are some caveats that haven't been addressed in this PR. Since the temperature is set by material or cell, a material can only be added to another material if they have the same temperature. Also, since s(a,b) are set on a material basis, there is the possibility of a material having multiple s(a,b) for the same nuclide. I'm not sure how OpenMC treats these cases, but it doesn't appear that an error is given.
Two materials can be homogenized as follows:
fuel = openmc.Material()
fuel.set_density('g/cm3', 10.0)
fuel.add_element('U', 1.0, enrichment=2.5)
fuel.add_element('O', 2.0)
clad = openmc.Material()
clad.set_density('g/cm3', 6.55)
clad.add_element('Zr', 1.0)
fuel_clad = openmc.Material()
fuel_clad.add_material(fuel, 0.9, 'ao')
fuel_clad.add_material(clad, 0.1, 'ao')
This PR builds on PR #771