Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
df720b1
inclusion of the mass attenuation data
marco-de-pietri Dec 2, 2025
0188939
ci test
marco-de-pietri Dec 2, 2025
49f32fc
ci test 2
marco-de-pietri Dec 2, 2025
15dd4a4
ci test 3
marco-de-pietri Dec 2, 2025
bd33b76
fix in the test_data_mu_en_coefficients.py
marco-de-pietri Dec 2, 2025
5c61954
fix test mu_en
marco-de-pietri Dec 2, 2025
bcd414c
fix test mu_en 2
marco-de-pietri Dec 2, 2025
1386ce5
mu_tests
marco-de-pietri Dec 5, 2025
4b752f2
initial structure for gamma contact dose rate
marco-de-pietri Dec 5, 2025
512caac
intermediate development of the cdr integrand
marco-de-pietri Dec 8, 2025
475e3ac
photon attenuation file creation
marco-de-pietri Dec 9, 2025
0d68e6d
photon attenuation intermediate commit
marco-de-pietri Dec 9, 2025
2f66503
fix typo bug in material.py
marco-de-pietri Dec 10, 2025
eaa4159
fix bug material
marco-de-pietri Dec 10, 2025
a6d3bd9
unit tests for the linear attenuation
marco-de-pietri Dec 10, 2025
460f4ca
unit tests for the linear attenuation - fix bug
marco-de-pietri Dec 10, 2025
21f8b7c
linear attenuation tests - specific values
marco-de-pietri Dec 10, 2025
216c0e4
linear attenuation tests - specific values - relax criteria
marco-de-pietri Dec 10, 2025
1c7299c
linear attenuation tests - specific values - relax criteria 2
marco-de-pietri Dec 10, 2025
abee4bc
fix bug photon_mass_attenuation
marco-de-pietri Dec 11, 2025
9d35d9f
material.photon_mass_attenuation_coefficient tests
marco-de-pietri Dec 11, 2025
327428e
fix bug in type checking
marco-de-pietri Dec 11, 2025
971fd79
fixed bug in linear attenuation coefficient
marco-de-pietri Dec 11, 2025
7c7abd7
adjust tests
marco-de-pietri Dec 11, 2025
74734c6
cobalt test
marco-de-pietri Dec 11, 2025
a238484
fix bug
marco-de-pietri Dec 11, 2025
04244c6
spectrum distribution tests
marco-de-pietri Dec 11, 2025
901a097
fix typos and polish
marco-de-pietri Dec 11, 2025
65c130b
first draft of approximate spectrum fispact style
marco-de-pietri Dec 11, 2025
a05043a
intermediate commit
marco-de-pietri Dec 12, 2025
26f74de
temporary removal of approximate spectrum function
marco-de-pietri Dec 17, 2025
f0a7e4d
removal of Sum function usage
marco-de-pietri Dec 19, 2025
bfab1e8
Revert "removal of Sum function usage"
marco-de-pietri Dec 19, 2025
6315100
format
marco-de-pietri Dec 21, 2025
6f9bdd8
function name change
marco-de-pietri Dec 29, 2025
88c41f6
added linear att test
marco-de-pietri Dec 29, 2025
13d4db3
fix linear attenuation test
marco-de-pietri Dec 29, 2025
38f2745
definition of the mass_attenuation energy distribution generator
marco-de-pietri Dec 29, 2025
9c033d8
fix circular import
marco-de-pietri Dec 29, 2025
19b97b5
fix test logic
marco-de-pietri Dec 29, 2025
e5d8af0
simplified material method for computing the attenuation
marco-de-pietri Dec 29, 2025
252a646
first version of the contact gamma dose rate / gamma only
marco-de-pietri Dec 30, 2025
1fb7b78
restored decay file - formatting issue
marco-de-pietri Dec 30, 2025
6bef75c
revert small formatting changes in material.py
marco-de-pietri Dec 30, 2025
8064015
simplification of mass-energy absorption storage of tabulated data
marco-de-pietri Jan 2, 2026
bed5d0a
removal of temperature dependancy for computing linear attenuation
marco-de-pietri Jan 2, 2026
c5c7a75
reorganization of mass attenuation material method
marco-de-pietri Jan 2, 2026
9a9b176
update of mass attenuation testing
marco-de-pietri Jan 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openmc/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
from .function import *

from .effective_dose.dose import dose_coefficients
from .mass_energy_absorption import mu_en_coefficients
1 change: 1 addition & 0 deletions openmc/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
# Unit conversions
EV_PER_MEV = 1.0e6
JOULE_PER_EV = 1.602176634e-19
BARN_PER_CM_SQ = 1.0e24

# Avogadro's constant
AVOGADRO = 6.02214076e23
Expand Down
93 changes: 93 additions & 0 deletions openmc/data/mass_energy_absorption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import numpy as np

import openmc.checkvalue as cv
from openmc.data import EV_PER_MEV

# Embedded NIST-126 data
# Air (Dry Near Sea Level) — NIST Standard Reference Database 126 Table 4 (doi: 10.18434/T4D01F)
# Columns: Energy (MeV), μen/ρ (cm^2/g)
_NIST126_AIR = np.array(
[
[1.00000e-03, 3.599e03],
[1.50000e-03, 1.188e03],
[2.00000e-03, 5.262e02],
[3.00000e-03, 1.614e02],
[3.20290e-03, 1.330e02],
[3.20290e-03, 1.460e02],
[4.00000e-03, 7.636e01],
[5.00000e-03, 3.931e01],
[6.00000e-03, 2.270e01],
[8.00000e-03, 9.446e00],
[1.00000e-02, 4.742e00],
[1.50000e-02, 1.334e00],
[2.00000e-02, 5.389e-01],
[3.00000e-02, 1.537e-01],
[4.00000e-02, 6.833e-02],
[5.00000e-02, 4.098e-02],
[6.00000e-02, 3.041e-02],
[8.00000e-02, 2.407e-02],
[1.00000e-01, 2.325e-02],
[1.50000e-01, 2.496e-02],
[2.00000e-01, 2.672e-02],
[3.00000e-01, 2.872e-02],
[4.00000e-01, 2.949e-02],
[5.00000e-01, 2.966e-02],
[6.00000e-01, 2.953e-02],
[8.00000e-01, 2.882e-02],
[1.00000e00, 2.789e-02],
[1.25000e00, 2.666e-02],
[1.50000e00, 2.547e-02],
[2.00000e00, 2.345e-02],
[3.00000e00, 2.057e-02],
[4.00000e00, 1.870e-02],
[5.00000e00, 1.740e-02],
[6.00000e00, 1.647e-02],
[8.00000e00, 1.525e-02],
[1.00000e01, 1.450e-02],
[1.50000e01, 1.353e-02],
[2.00000e01, 1.311e-02],
],
dtype=float,
)

# Registry of embedded tables: (data_source, material) -> ndarray
# Table shape: (N, 2) with columns [Energy (MeV), μen/ρ (cm^2/g)]
_MUEN_TABLES = {
("nist126", "air"): _NIST126_AIR,
}


def mu_en_coefficients(
material: str, data_source: str = "nist126"
) -> tuple[np.ndarray, np.ndarray]:
"""Return tabulated mass energy-absorption coefficients.

Parameters
----------
material : {'air'}
Material compound for which to load coefficients.
data_source : {'nist126'}
Source library.

Returns
-------
energy : numpy.ndarray
Energies [eV]
mu_en_coeffs : numpy.ndarray
Mass energy-absorption coefficients [cm^2/g]
"""
cv.check_value("material", material, {"air"})
cv.check_value("data_source", data_source, {"nist126"})

key = (data_source, material)
if key not in _MUEN_TABLES:
available = sorted({m for (ds, m) in _MUEN_TABLES.keys() if ds == data_source})
raise ValueError(
f"'{material}' has no embedded μen/ρ table for data source {data_source}. "
f"Available materials for {data_source}: {available}"
)

data = _MUEN_TABLES[key]
energy = data[:, 0].copy() * EV_PER_MEV # MeV -> eV
mu_en_coeffs = data[:, 1].copy()
return energy, mu_en_coeffs
80 changes: 80 additions & 0 deletions openmc/data/photon_attenuation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import numpy as np

from openmc.exceptions import DataError

from .data import ATOMIC_SYMBOL, ELEMENT_SYMBOL, zam
from .function import Sum, Tabulated1D
from .library import DataLibrary
from .photon import IncidentPhoton


_PHOTON_LIB: DataLibrary | None = None
_PHOTON_DATA: dict[str, IncidentPhoton] = {}


def _get_photon_data(nuclide: str) -> IncidentPhoton | None:
global _PHOTON_LIB

if _PHOTON_LIB is None:
try:
_PHOTON_LIB = DataLibrary.from_xml()
except Exception as err:
raise DataError(
"A cross section library must be specified with "
"openmc.config['cross_sections'] in order to load photon data."
) from err

lib = _PHOTON_LIB.get_by_material(nuclide, data_type="photon")
if lib is None:
return None

if nuclide not in _PHOTON_DATA:
_PHOTON_DATA[nuclide] = IncidentPhoton.from_hdf5(lib["path"])

return _PHOTON_DATA[nuclide]


def linear_attenuation_xs(element_input: str) -> Sum | None:
"""Return total photon interaction cross section for a nuclide.

Parameters
----------
element_input : str
Name of nuclide or element

Returns
-------
openmc.data.Sum or None
Sum of the relevant photon reaction cross sections as a function of
photon energy, or None if no photon data exist for *nuclide*.
"""

try:
z = zam(element_input)[0]
element = ATOMIC_SYMBOL[z]
except (ValueError, KeyError, TypeError):
if element_input not in ELEMENT_SYMBOL.values():
raise ValueError(f"Element '{element_input}' not found in ELEMENT_SYMBOL.")
element = element_input

photon_data = _get_photon_data(element)
if photon_data is None:
return None

photon_mts = (502, 504, 515, 517, 522)

xs_list = []
for reaction in photon_data.reactions.values():
mt = getattr(reaction, "mt", None)
if mt not in photon_mts:
continue

xs_list.append(reaction.xs)

if not xs_list:
return None

return Sum(xs_list)



Loading
Loading