openmc.Material¶
-
class
openmc.
Material
(material_id=None, name='', temperature=None)[source]¶ A material composed of a collection of nuclides/elements.
To create a material, one should create an instance of this class, add nuclides or elements with
Material.add_nuclide()
or Material.add_element, respectively, and set the total material density with Material.export_to_xml(). The material can then be assigned to a cell using theCell.fill
attribute.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.
- temperature (float, optional) – Temperature of the material in Kelvin. If not specified, the material inherits the default temperature applied to the model.
Variables: - id (int) – Unique identifier for the material
- temperature (float) – Temperature of the material in Kelvin.
- 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.
- depletable (bool) – Indicate whether the material is depletable. This attribute can be used by downstream depletion applications.
- elements (list of tuple) – List in which each item is a 4-tuple consisting of an
openmc.Element
instance, the percent density, the percent type (‘ao’ or ‘wo’), and enrichment. - 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’). - average_molar_mass (float) – The average molar mass of nuclides in the material in units of grams per mol. For example, UO2 with 3 nuclides will have an average molar mass of 270 / 3 = 90 g / mol.
- volume (float) – Volume of the material in cm^3. This can either be set manually or
calculated in a stochastic volume calculation and added via the
Material.add_volume_information()
method. - paths (list of str) – The paths traversed through the CSG tree to reach each material
instance. This property is initialized by calling the
Geometry.determine_paths()
method. - num_instances (int) – The number of instances of this material throughout the geometry.
-
add_element
(element, percent, percent_type='ao', enrichment=None)[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.
- enrichment (float, optional) – Enrichment for U235 in weight percent. For example, input 4.95 for 4.95 weight percent enriched U. Default is None (natural composition).
-
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)[source]¶ Add an \(S(\alpha,\beta)\) table to the material
Parameters: name (str) – Name of the \(S(\alpha,\beta)\) table
-
add_volume_information
(volume_calc)[source]¶ Add volume information to a material.
Parameters: volume_calc (openmc.VolumeCalculation) – Results from a stochastic volume calculation
-
clone
(memo=None)[source]¶ Create a copy of this material with a new unique ID.
Parameters: memo (dict or None) – A nested dictionary of previously cloned objects. This parameter is used internally and should not be specified by the user. Returns: clone – The clone of this material Return type: openmc.Material
-
classmethod
from_hdf5
(group)[source]¶ Create material from HDF5 group
Parameters: group (h5py.Group) – Group in HDF5 file Returns: Material instance Return type: openmc.Material
-
get_nuclide_atom_densities
()[source]¶ Returns all nuclides in the material and their atomic densities in units of atom/b-cm
Returns: nuclides – Dictionary whose keys are nuclide names and values are tuples of (nuclide, density in atom/b-cm) Return type: dict
-
get_nuclide_densities
()[source]¶ Returns all nuclides in the material and their densities
Returns: nuclides – Dictionary whose keys are nuclide names and values are 3-tuples of (nuclide, density percent, density percent type) Return type: dict
-
get_nuclides
()[source]¶ Returns all nuclides in the material
Returns: nuclides – List of nuclide names Return type: list of str
-
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', 'kg/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’.
-
to_xml_element
(cross_sections=None)[source]¶ Return XML representation of the material
Parameters: cross_sections (str) – Path to an XML cross sections listing file Returns: element – XML element containing material data Return type: xml.etree.ElementTree.Element