openmc.Material

class openmc.Material(material_id=None, name='')[source]

A material composed of a collection of nuclides/elements that can be assigned to a region of space.

Parameters:
  • material_id (int, optional) – Unique identifier for the material. If not specified, an identifier will automatically be assigned.
  • name (str, optional) – Name of the material. If not specified, the name will be the empty string.
Variables:
  • id (int) – Unique identifier for the material
  • density (float) – Density of the material (units defined separately)
  • density_units (str) – Units used for density. Can be one of ‘g/cm3’, ‘g/cc’, ‘kg/cm3’, ‘atom/b-cm’, ‘atom/cm3’, ‘sum’, or ‘macro’. The ‘macro’ unit only applies in the case of a multi-group calculation.
  • elements (list of tuple) – List in which each item is a 3-tuple consisting of an openmc.Element instance, the percent density, and the percent type (‘ao’ or ‘wo’).
  • nuclides (list of tuple) – List in which each item is a 3-tuple consisting of an openmc.Nuclide instance, the percent density, and the percent type (‘ao’ or ‘wo’).
add_element(element, percent, percent_type='ao', expand=False)[source]

Add a natural element to the material

Parameters:
  • element (openmc.Element or str) – Element to add
  • percent (float) – Atom or weight percent
  • percent_type ({'ao', 'wo'}, optional) – ‘ao’ for atom percent and ‘wo’ for weight percent. Defaults to atom percent.
  • expand (bool, optional) – Whether to expand the natural element into its naturally-occurring isotopes. Defaults to False.
add_macroscopic(macroscopic)[source]

Add a macroscopic to the material. This will also set the density of the material to 1.0, unless it has been otherwise set, as a default for Macroscopic cross sections.

Parameters:macroscopic (str or openmc.Macroscopic) – Macroscopic to add
add_nuclide(nuclide, percent, percent_type='ao')[source]

Add a nuclide to the material

Parameters:
  • nuclide (str or openmc.Nuclide) – Nuclide to add
  • percent (float) – Atom or weight percent
  • percent_type ({'ao', 'wo'}) – ‘ao’ for atom percent and ‘wo’ for weight percent
add_s_alpha_beta(name, xs)[source]

Add an \(S(\alpha,\beta)\) table to the material

Parameters:
  • name (str) – Name of the \(S(\alpha,\beta)\) table
  • xs (str) – Cross section identifier, e.g. ‘71t’
get_all_nuclides()[source]

Returns all nuclides in the material

Returns:nuclides – Dictionary whose keys are nuclide names and values are 2-tuples of (nuclide, density)
Return type:dict
get_material_xml()[source]

Return XML representation of the material

Returns:element – XML element containing material data
Return type:xml.etree.ElementTree.Element
remove_element(element)[source]

Remove a natural element from the material

Parameters:element (openmc.Element) – Element to remove
remove_macroscopic(macroscopic)[source]

Remove a macroscopic from the material

Parameters:macroscopic (openmc.Macroscopic) – Macroscopic to remove
remove_nuclide(nuclide)[source]

Remove a nuclide from the material

Parameters:nuclide (openmc.Nuclide) – Nuclide to remove
set_density(units, density=None)[source]

Set the density of the material

Parameters:
  • units ({'g/cm3', 'g/cc', 'km/cm3', 'atom/b-cm', 'atom/cm3', 'sum', 'macro'}) – Physical units of density.
  • density (float, optional) – Value of the density. Must be specified unless units is given as ‘sum’.