armi.materials package

The material package defines compositions and material-specific properties.

Properties in scope include temperature dependent thermo/mechanical properties (like heat capacity, linear expansion coefficients, viscosity, density), and material-specific nuclear properties that can’t exist at the nuclide level alone (like thermal scattering laws).

As the fundamental macroscopic building blocks of any physical object, these are highly important to reactor analysis.

This module handles the dynamic importing of all the materials defined here at the framework level as well as in all the attached plugins. It is expected that most teams will have special material definitions that they will want to define.

It may also make sense in the future to support user-input materials that are not hard-coded into the app.

The base class for all materials is in armi.materials.material.

armi.materials.setMaterialNamespaceOrder(order)[source]
armi.materials.importMaterialsIntoModuleNamespace(path, name, namespace, updateSource=None)[source]

Import all Material subclasses into the top subpackage.

This allows devs to use from armi.materials import HT9

This can be used in plugins for similar purposes.

Warning

Do not directly import materials from this namespace in code. Use the full module import instead. This is just for material resolution. This will be replaced with a more formal material registry in the future.

Parameters:
  • path (str) – Path to package/module being imported

  • name (str) – module name

  • namespace (dict) – The namespace

  • updateSource (str, optional) – Change DATA_SOURCE on import to a different string. Useful for saying where plugin materials are coming from.

armi.materials.iterAllMaterialClassesInNamespace(namespace)[source]

Iterate over all Material subclasses found in a namespace.

Notes

Useful for testing.

armi.materials.resolveMaterialClassByName(name: str, namespaceOrder: Optional[List[str]] = None)[source]

Find the first material class that matches a name in an ordered namespace.

Names can either be fully resolved class paths (e.g. armi.materials.uZr:UZr) or simple class names (e.g. UZr). In the latter case, the CONF_MATERIAL_NAMESPACE_ORDER setting to allows users to choose which particular material of a common name (like UO2 or HT9) gets used.

Input files usually specify a material like UO2. Which particular implementation gets used (Framework’s UO2 vs. a user plugins UO2 vs. the Kentucky Transportation Cabinet’s UO2) is up to the user at runtime.

Parameters:
  • name (str) – The material class name to find, e.g. "UO2". Optionally, a module path and class name can be provided with a colon separator as module:className, e.g. armi.materials.uraniumOxide:UO2 for direct specification.

  • namespaceOrder (list of str, optional) – A list of namespaces in order of preference in which to search for the material. If not passed, the value in the global MATERIAL_NAMESPACE_ORDER will be used, which is often set by the CONF_MATERIAL_NAMESPACE_ORDER setting (e.g. during reactor construction). Any value passed into this argument will be ignored if the name is provided with a modulePath.

Returns:

matCls – The material

Return type:

Material

Raises:

KeyError – When material of name cannot be found in namespaces.

Examples

>>> resolveMaterialClassByName("UO2", ["something.else.materials", "armi.materials"])
<class 'something.else.materials.UO2'>

See also

armi.reactor.reactors.factory

Applies user settings to default namespace order.

Subpackages

Submodules