2022-02-11 22:36:46 +00:00
|
|
|
"""Regression tests for openmc.deplete.Results.transfer_volumes method."""
|
2018-06-02 16:34:41 -04:00
|
|
|
|
|
|
|
|
from pytest import approx
|
2019-07-18 08:37:17 -05:00
|
|
|
import openmc
|
2022-04-28 17:20:55 -05:00
|
|
|
from openmc.deplete import PredictorIntegrator, Results
|
2018-06-02 16:34:41 -04:00
|
|
|
|
|
|
|
|
from tests import dummy_operator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_transfer_volumes(run_in_tmpdir):
|
|
|
|
|
"""Unit test of volume transfer in restart calculations."""
|
|
|
|
|
|
|
|
|
|
op = dummy_operator.DummyOperator()
|
|
|
|
|
op.output_dir = "test_transfer_volumes"
|
|
|
|
|
|
|
|
|
|
# Perform simulation using the predictor algorithm
|
|
|
|
|
dt = [0.75]
|
|
|
|
|
power = 1.0
|
2019-07-18 08:37:17 -05:00
|
|
|
PredictorIntegrator(op, dt, power).integrate()
|
2018-06-02 16:34:41 -04:00
|
|
|
|
|
|
|
|
# Load the files
|
2022-04-28 17:20:55 -05:00
|
|
|
res = openmc.deplete.Results(op.output_dir / "depletion_results.h5")
|
2018-06-02 16:34:41 -04:00
|
|
|
|
|
|
|
|
# Create a dictionary of volumes to transfer
|
2019-08-05 16:08:11 -05:00
|
|
|
res[0].volume['1'] = 1.5
|
2018-06-02 16:34:41 -04:00
|
|
|
res[0].volume['2'] = 2.5
|
|
|
|
|
|
|
|
|
|
# Create dummy geometry
|
|
|
|
|
mat1 = openmc.Material(material_id=1)
|
|
|
|
|
mat1.depletable = True
|
|
|
|
|
mat2 = openmc.Material(material_id=2)
|
|
|
|
|
|
|
|
|
|
cell = openmc.Cell()
|
|
|
|
|
cell.fill = [mat1, mat2]
|
|
|
|
|
root = openmc.Universe()
|
|
|
|
|
root.add_cell(cell)
|
|
|
|
|
geometry = openmc.Geometry(root)
|
|
|
|
|
|
|
|
|
|
# Transfer volumes
|
2021-10-08 14:15:40 -05:00
|
|
|
res[0].transfer_volumes(openmc.Model(geometry))
|
2018-06-02 16:34:41 -04:00
|
|
|
|
|
|
|
|
assert mat1.volume == 1.5
|
|
|
|
|
assert mat2.volume is None
|