Properties Groups#

Creating groups#

Properties can be grouped using the PropertiesGroup() class.

import h_transport_materials as htm

prop1 = htm.Diffusivity(1, 0)
prop2 = htm.Diffusivity(2, 0)

my_group = htm.PropertiesGroup([prop1, prop2])

PropertiesGroup() inherits from list. Groups can therefore be concatenated:

group1 = htm.PropertiesGroup([prop1, prop2])
group2 = htm.PropertiesGroup([prop1, prop2])

big_group = group1 + group2

And iterated through:

for prop in group1:
    pass

HTM database#

HTM already contains several hundreds of properties stored in database.

from h_transport_materials import database
nb_properties = len(database)

database contains all the properties. Users can also access all the diffusivities in diffusivities. solubilities, permeabilities, recombination_coeffs, and dissociation_coeffs are also available.

Filters#

Property groups can be filtered by several property attributes: materials, author, year

import h_transport_materials as htm

prop1 = htm.Diffusivity(1, 0, author="jack")
prop2 = htm.Diffusivity(2, 0, author="jon")
prop3 = htm.Diffusivity(3, 0, author="jean")

group = htm.PropertiesGroup([prop1, prop2, prop3])

# filtered groups
only_jack = group.filter(author="jack")
jon_and_jean = group.filter(author=["jon", "jean"])

everyone_but_jon = group.filter(author="jon", exclude=True)

The internal database being a PropertiesGroup() too, it can also be filtered: For instance, to filter the tungsten diffusivities of HTM:

import h_transport_materials as htm

tungsten_diffusivities = htm.diffusivities.filter(material=htm.TUNGSTEN)

To filter all the steel alloys, two options. Explicitely filter each grade of steel:

steels = [htm.STEEL_RAFM, htm.STEEL_316L, htm.STEEL_SERIES_300]

steel_diffusivities = htm.diffusivities.filter(material=steels)

Filter with the Material object htm.Steel:

steel_diffusivities = htm.diffusivities.filter(material=htm.Steel)

Alternatively, the properties can be filtered by the material name as a string:

steel_diffusivities = htm.diffusivities.filter(material="steel")
tungsten_diffusivities = htm.diffusivities.filter(material="tungsten")

Computing mean property#

With PropertiesGroup() objects, it is possible to compute the mean property using the mean() method.

import h_transport_materials as htm

prop1 = htm.Diffusivity(1, 0.1)
prop2 = htm.Diffusivity(2, 0.2)

group = htm.PropertiesGroup([prop1, prop2])
mean_property = group.mean()

print(mean_property)
Author:
Material:
Year: None
Isotope: None
Pre-exponential factor: 1.41×10⁰ m²/s
Activation energy: 1.50×10⁻¹ eV/particle

(Source code, png, hires.png, pdf)

../_images/groups-1.png