mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Merge pull request #1054 from liangjg/wmp_v1.0
Accommodate the new WMP Library
This commit is contained in:
commit
dfcb97e714
16 changed files with 417 additions and 767 deletions
|
|
@ -3,8 +3,6 @@ import os
|
|||
import numpy as np
|
||||
import pytest
|
||||
import openmc.data
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
'OPENMC_MULTIPOLE_LIBRARY' not in os.environ,
|
||||
reason='OPENMC_MULTIPOLE_LIBRARY environment variable must be set')
|
||||
|
|
@ -18,44 +16,32 @@ def u235():
|
|||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def u234():
|
||||
def b10():
|
||||
directory = os.environ['OPENMC_MULTIPOLE_LIBRARY']
|
||||
filename = os.path.join(directory, '092234.h5')
|
||||
filename = os.path.join(directory, '005010.h5')
|
||||
return openmc.data.WindowedMultipole.from_hdf5(filename)
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def fe56():
|
||||
directory = os.environ['OPENMC_MULTIPOLE_LIBRARY']
|
||||
filename = os.path.join(directory, '026056.h5')
|
||||
return openmc.data.WindowedMultipole.from_hdf5(filename)
|
||||
|
||||
|
||||
def test_evaluate_rm(u235):
|
||||
"""Make sure a Reich-Moore multipole object can be called."""
|
||||
def test_evaluate(u235):
|
||||
"""Test the cross section evaluation of a library."""
|
||||
energies = [1e-3, 1.0, 10.0, 50.]
|
||||
total, absorption, fission = u235(energies, 0.0)
|
||||
assert total[1] == pytest.approx(90.64895383)
|
||||
total, absorption, fission = u235(energies, 300.0)
|
||||
assert total[1] == pytest.approx(91.12534964)
|
||||
scattering, absorption, fission = u235(energies, 0.0)
|
||||
assert (scattering[1], absorption[1], fission[1]) == \
|
||||
pytest.approx((13.09, 77.56, 67.36), rel=1e-3)
|
||||
scattering, absorption, fission = u235(energies, 300.0)
|
||||
assert (scattering[2], absorption[2], fission[2]) == \
|
||||
pytest.approx((11.24, 21.26, 15.50), rel=1e-3)
|
||||
|
||||
|
||||
def test_evaluate_mlbw(u234):
|
||||
"""Make sure a Multi-Level Breit-Wigner multipole object can be called."""
|
||||
energies = [1e-3, 1.0, 10.0, 50.]
|
||||
total, absorption, fission = u234(energies, 0.0)
|
||||
assert total[3] == pytest.approx(15.02827953)
|
||||
total, absorption, fission = u234(energies, 300.0)
|
||||
assert total[3] == pytest.approx(15.08269143)
|
||||
|
||||
|
||||
def test_high_l(fe56):
|
||||
"""Test a nuclide (Fe56) with a high l-value (4)."""
|
||||
def test_evaluate_none_poles(b10):
|
||||
"""Test a library with no poles, i.e., purely polynomials."""
|
||||
energies = [1e-3, 1.0, 10.0, 1e3, 1e5]
|
||||
total, absorption, fission = fe56(energies, 0.0)
|
||||
assert total[0] == pytest.approx(25.072619556789267)
|
||||
total, absorption, fission = fe56(energies, 300.0)
|
||||
assert total[0] == pytest.approx(27.85535792368082)
|
||||
scattering, absorption, fission = b10(energies, 0.0)
|
||||
assert (scattering[0], absorption[0], fission[0]) == \
|
||||
pytest.approx((2.201, 19330., 0.), rel=1e-3)
|
||||
scattering, absorption, fission = b10(energies, 300.0)
|
||||
assert (scattering[-1], absorption[-1], fission[-1]) == \
|
||||
pytest.approx((2.878, 1.982, 0.), rel=1e-3)
|
||||
|
||||
|
||||
def test_export_to_hdf5(tmpdir, u235):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue