Repository: RemDelaporteMathurin/h-transport-materials

Issue:
Entries from HCDB
https://db-amdis.org/hcdb

316L

- [ ] https://doi.org/10.1016/j.ijhydene.2006.05.008  this is a review, will not include in HTM
- [x] https://doi.org/10.13182/FST85-A24629
- [x] https://doi.org/10.1016/0022-3115(85)90056-X already in HTM
- [x] https://doi.org/10.1016/0022-3115(91)90091-K
- [x] https://doi.org/10.13182/FST57-3-185

Comments:

Patch:
diff --git a/h_transport_materials/properties_group.py b/h_transport_materials/properties_group.py
index 60ba476..7a81f9c 100644
--- a/h_transport_materials/properties_group.py
+++ b/h_transport_materials/properties_group.py
@@ -6,6 +6,8 @@ from textwrap import dedent
 
 from h_transport_materials import ureg, ArrheniusProperty, __version__
 
+warnings.filterwarnings("always", message="No property matching the requirements")
+
 
 class PropertiesGroup(list):
     @property
@@ -94,7 +96,11 @@ class PropertiesGroup(list):
 
         # geometric mean of pre-exponential factor
         pre_exps = np.array([prop.pre_exp.magnitude for prop in self])
-        pre_exp = pre_exps.prod() ** (1.0 / len(pre_exps))
+        scaling_factor = np.max(pre_exps)
+        pre_exps = pre_exps / scaling_factor  # scale pre-exps to avoid inf
+
+        pre_exp = pre_exps.prod() ** (1.0 / len(pre_exps))  # compute mean
+        pre_exp = pre_exp * scaling_factor  # re-scale
 
         # arithmetic mean of activation energy
         act_energy = np.array([prop.act_energy.magnitude for prop in self]).mean()
diff --git a/h_transport_materials/property_database/iron.py b/h_transport_materials/property_database/iron.py
index 942a7b5..02aef03 100644
--- a/h_transport_materials/property_database/iron.py
+++ b/h_transport_materials/property_database/iron.py
@@ -8,7 +8,9 @@ from h_transport_materials import (
 
 u = htm.ureg
 
-IRON_MOLAR_VOLUME = 7.09e-6  # m3/mol https://www.aqua-calc.com/calculate/mole-to-volume-and-weight/substance/iron
+# TODO give units to IRON_MOLAR_VOLUME
+# https://www.aqua-calc.com/calculate/mole-to-volume-and-weight/substance/iron
+IRON_MOLAR_VOLUME = 7.09e-6  # m3/mol
 
 volkl_diffusivity = Diffusivity(
     D_0=4.00e-8 * u.m**2 * u.s**-1,
diff --git a/h_transport_materials/property_database/steel_316L/steel_316L.py b/h_transport_materials/property_database/steel_316L/steel_316L.py
index d8c2edb..38f3867 100644
--- a/h_transport_materials/property_database/steel_316L/steel_316L.py
+++ b/h_transport_materials/property_database/steel_316L/steel_316L.py
@@ -6,11 +6,17 @@ from h_transport_materials import (
     DissociationCoeff,
     RecombinationCoeff,
 )
-from h_transport_materials.property_database.iron import IRON_MOLAR_VOLUME
 import numpy as np
 
 u = htm.ureg
 
+STEEL_316L_DENSITY = (
+    8.0 * u.g * u.cm**-3
+)  # ref https://doi.org/10.31399/asm.hb.mhde2.9781627081993
+STEEL_316L_MOLAR_MASS = 56.52 * u.g * u.mol**-1  # TODO compute it from composition
+STEEL_316L_MOLAR_VOLUME = STEEL_316L_DENSITY / STEEL_316L_MOLAR_MASS
+
+
 reiter_diffusivity = Diffusivity(
     D_0=3.70e-7 * u.m**2 * u.s**-1,
     E_D=51.9 * u.kJ * u.mol**-1,
@@ -21,7 +27,7 @@ reiter_diffusivity = Diffusivity(
 )
 
 reiter_solubility = Solubility(
-    S_0=5.8e-6 / IRON_MOLAR_VOLUME * u.mol * u.m**-3 * u.Pa**-0.5,
+    S_0=5.8e-6 * u.Pa**-0.5 * STEEL_316L_MOLAR_VOLUME,
     E_S=13.1 * u.kJ * u.mol**-1,
     range=(500 * u.K, 1200 * u.K),
     isotope="H",
@@ -29,6 +35,57 @@ reiter_solubility = Solubility(
     note="this is an average of 5 papers on diffusivity from Reiter compilation review",
 )
 
+# TODO fit this ourselves
+reiter_1985_solubility_h = Solubility(
+    S_0=1.84e-6 * u.Pa**-0.5 * STEEL_316L_MOLAR_VOLUME,
+    E_S=6880 * u.J * u.mol**-1,
+    range=(600 * u.K, 900 * u.K),
+    isotope="h",
+    source="reiter_interaction_1985",
+    note="probably a unit mistake in the activation energies in original paper",
+)
+
+reiter_1985_solubility_d = Solubility(
+    S_0=1.96e-6 * u.Pa**-0.5 * STEEL_316L_MOLAR_VOLUME,
+    E_S=8090 * u.J * u.mol**-1,
+    range=(600 * u.K, 900 * u.K),
+    isotope="d",
+    source="reiter_interaction_1985",
+    note="probably a unit mistake in the activation energies in original paper",
+)
+
+reiter_1985_diffusivity_h = Diffusivity(
+    D_0=2.99e-6 * u.m**2 * u.s**-1,
+    E_D=59700 * u.J * u.mol**-1,
+    range=(600 * u.K, 900 * u.K),
+    isotope="h",
+    source="reiter_interaction_1985",
+    note="probably a unit mistake in the activation energies in original paper",
+)
+
+reiter_1985_diffusivity_d = Diffusivity(
+    D_0=1.74e-6 * u.m**2 * u.s**-1,
+    E_D=58100 * u.J * u.mol**-1,
+    range=(600 * u.K, 900 * u.K),
+    isotope="d",
+    source="reiter_interaction_1985",
+    note="probably a unit mistake in the activation energies in original paper",
+)
+
+reiter_1985_permeability_h = reiter_1985_diffusivity_h * reiter_1985_solubility_h
+reiter_1985_permeability_h.range = reiter_1985_diffusivity_h.range
+reiter_1985_permeability_h.isotope = reiter_1985_diffusivity_h.isotope
+reiter_1985_permeability_h.source = reiter_1985_diffusivity_h.source
+reiter_1985_permeability_h.note = "calculated in HTM"
+
+
+reiter_1985_permeability_d = reiter_1985_diffusivity_d * reiter_1985_solubility_d
+reiter_1985_permeability_d.range = reiter_1985_diffusivity_d.range
+reiter_1985_permeability_d.isotope = reiter_1985_diffusivity_d.isotope
+reiter_1985_permeability_d.source = reiter_1985_diffusivity_d.source
+reiter_1985_permeability_d.note = "calculated in HTM"
+
+
 houben_permeability = Permeability(
     pre_exp=8e-7 * u.mol * u.m**-1 * u.s**-1 * u.mbar**-0.5,
     act_energy=58 * u.kJ * u.mol**-1,
@@ -212,6 +269,88 @@ serra_solubility = Solubility(
     source="serra_hydrogen_2004",
 )
 
+
+shan_permeability_h = Permeability(
+    data_T=[500.0, 550.0, 600.0, 650.0, 700.0, 723.0] * u.K,
+    data_y=[8.95e-11, 3.46e-10, 1.07e-9, 2.78e-9, 6.30e-9, 8.84e-9]
+    * u.mol
+    * u.m**-1
+    * u.s**-1
+    * u.MPa**-0.5,
+    isotope="h",
+    source="shan_behavior_1991",
+    note="Table 1",
+)
+
+shan_permeability_t = Permeability(
+    data_T=[500.0, 550.0, 600.0, 650.0, 700.0, 723.0] * u.K,
+    data_y=[1.72e-11, 6.39e-11, 1.91e-10, 4.82e-10, 1.07e-9, 1.48e-9]
+    * u.mol
+    * u.m**-1
+    * u.s**-1
+    * u.MPa**-0.5,
+    isotope="t",
+    source="shan_behavior_1991",
+    note="Table 1",
+)
+
+shan_diffusivity_h = Diffusivity(
+    data_T=[500.0, 550.0, 600.0, 650.0, 700.0, 723.0] * u.K,
+    data_y=[1.39e-12, 4.51e-12, 1.20e-11, 2.76e-11, 5.64e-11, 7.57e-11]
+    * u.m**2
+    * u.s**-1,
+    isotope="h",
+    source="shan_behavior_1991",
+    note="Table 1",
+)
+
+shan_diffusivity_t = Diffusivity(
+    data_T=[500.0, 550.0, 600.0, 650.0, 700.0, 723.0] * u.K,
+    data_y=[6.00e-12, 8.35e-12, 1.10e-11, 1.39e-11, 1.70e-11, 1.84e-11]
+    * u.m**2
+    * u.s**-1,
+    isotope="t",
+    source="shan_behavior_1991",
+    note="Table 1",
+)
+
+shan_solubility_h = Solubility(
+    S_0=shan_permeability_h.pre_exp / shan_diffusivity_h.pre_exp,
+    E_S=shan_permeability_h.act_energy - shan_diffusivity_h.act_energy,
+    range=shan_permeability_h.range,
+    isotope="h",
+    source="shan_behavior_1991",
+    note="calculated in HTM",
+)
+
+
+shan_solubility_t = Solubility(
+    S_0=shan_permeability_t.pre_exp / shan_diffusivity_t.pre_exp,
+    E_S=shan_permeability_t.act_energy - shan_diffusivity_t.act_energy,
+    range=shan_permeability_t.range,
+    isotope="t",
+    source="shan_behavior_1991",
+    note="calculated in HTM",
+)
+
+penzhorn_diffusivity_1 = Diffusivity(
+    D_0=1.9e-2 * u.cm**2 * u.s**-1,
+    E_D=61300 * u.J * u.mol**-1,
+    range=(373.0, 473.0) * u.K,
+    isotope="T",
+    source="penzhorn_distribution_2010",
+    note="Section III.B, temperature range is unclear",
+)
+
+penzhorn_diffusivity_2 = Diffusivity(
+    D_0=1.5e-2 * u.cm**2 * u.s**-1,
+    E_D=57300 * u.J * u.mol**-1,
+    range=(373.0, 473.0) * u.K,
+    isotope="T",
+    source="penzhorn_distribution_2010",
+    note="Section III.C, temperature range is unclear",
+)
+
 properties = [
     reiter_diffusivity,
     reiter_solubility,
@@ -234,6 +373,20 @@ properties = [
     serra_permeability,
     serra_diffusivity,
     serra_solubility,
+    reiter_1985_solubility_h,
+    reiter_1985_solubility_d,
+    reiter_1985_diffusivity_h,
+    reiter_1985_diffusivity_d,
+    reiter_1985_permeability_h,
+    reiter_1985_permeability_d,
+    shan_permeability_h,
+    shan_permeability_t,
+    shan_diffusivity_h,
+    shan_diffusivity_t,
+    shan_solubility_h,
+    shan_solubility_t,
+    penzhorn_diffusivity_1,
+    penzhorn_diffusivity_2,
 ]
 
 for prop in properties:
diff --git a/h_transport_materials/references.bib b/h_transport_materials/references.bib
index 462c4a8..650d880 100644
--- a/h_transport_materials/references.bib
+++ b/h_transport_materials/references.bib
@@ -2411,3 +2411,40 @@ Publisher: Multidisciplinary Digital Publishing Institute},
 	year = {1980},
 	month = {6}
 }
+
+@article{reiter_interaction_1985,
+	author = {F. Reiter and J. Camposilvan and M. Caorlin and G. Saibenea and R. Sartoria},
+	title = {Interaction of Hydrogen Isotopes with Stainless Steel 316 L},
+	journal = {Fusion Technology},
+	volume = {8},
+	number = {2P2},
+	pages = {2344-2351},
+	year  = {1985},
+	publisher = {Taylor & Francis},
+	doi = {10.13182/FST85-A24629},
+}
+
+@article{shan_behavior_1991,
+	title = {The behavior of diffusion and permeation of tritium through 316L stainless steel},
+	journal = {Journal of Nuclear Materials},
+	volume = {179-181},
+	pages = {322-324},
+	year = {1991},
+	issn = {0022-3115},
+	doi = {https://doi.org/10.1016/0022-3115(91)90091-K},
+	url = {https://www.sciencedirect.com/science/article/pii/002231159190091K},
+	author = {Changqi Shan and Aiju Wu and Qingwang Chen},
+	abstract = {Results on diffusivity, solubility coefficient and permeability of tritium through palladium-plated 316L stainless steel are described. An empirical formula for the diffusivity, the solubility coefficient and the permeability of tritium through palladium-plated 316L stainless steel at various temperatures is presented. The influence of tritium pressure on the permeability, and the isotope effect of diffusivity of hydrogen and tritium in 316L stainless steel is discussed.}
+}
+
+@article{penzhorn_distribution_2010,
+	author = {R.-D. Penzhorn and Y. Torikai and S. Naoe and K. Akaishi and A. Perevezentsev and K. Watanabe and M. Matsuyama},
+	title = {Distribution and Mobility of Tritium in Type 316 Stainless Steel},
+	journal = {Fusion Science and Technology},
+	volume = {57},
+	number = {3},
+	pages = {185-195},
+	year  = {2010},
+	publisher = {Taylor & Francis},
+	doi = {10.13182/FST57-3-185},
+}
\ No newline at end of file


Test patch:
diff --git a/tests/test_properties_group.py b/tests/test_properties_group.py
index 711d54f..84f1b21 100644
--- a/tests/test_properties_group.py
+++ b/tests/test_properties_group.py
@@ -215,3 +215,10 @@ def test_cannot_compute_mean_on_mixed_groups():
 
     with pytest.raises(ValueError, match="Can't compute mean on mixed units groups"):
         my_group.mean()
+
+
+def test_mean_of_large_numbers_properties():
+    """This test catches bug reported in issue #242"""
+
+    perm = htm.permeabilities.filter(material="steel").mean()
+    assert not np.isinf(perm.pre_exp)