Rename deplete.ResultsList -> deplete.Results

This commit is contained in:
Paul Romano 2022-04-28 17:20:55 -05:00
parent aacf3c4938
commit 8bfb1889b9
13 changed files with 39 additions and 39 deletions

View file

@ -133,7 +133,7 @@ data, such as number densities and reaction rates for each material.
AtomNumber
OperatorResult
ReactionRates
ResultsList
Results
StepResult
The following class and functions are used to solve the depletion equations,

View file

@ -49,11 +49,11 @@ one of these functions along with the timesteps and power level::
The coupled transport-depletion problem is executed, and once it is done a
``depletion_results.h5`` file is written. The results can be analyzed using the
:class:`openmc.deplete.ResultsList` class. This class has methods that allow for
:class:`openmc.deplete.Results` class. This class has methods that allow for
easy retrieval of k-effective, nuclide concentrations, and reaction rates over
time::
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.Results("depletion_results.h5")
time, keff = results.get_keff()
Note that the coupling between the transport solver and the transmutation solver

View file

@ -12,7 +12,7 @@ with openmc.StatePoint(statepoint) as sp:
geometry = sp.summary.geometry
# Load previous depletion results
previous_results = openmc.deplete.ResultsList("depletion_results.h5")
previous_results = openmc.deplete.Results("depletion_results.h5")
###############################################################################
# Transport calculation settings
@ -56,7 +56,7 @@ integrator.integrate()
###############################################################################
# Open results file
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.Results("depletion_results.h5")
# Obtain K_eff as a function of time
time, keff = results.get_keff(time_units='d')

View file

@ -101,7 +101,7 @@ integrator.integrate()
###############################################################################
# Open results file
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.Results("depletion_results.h5")
# Obtain K_eff as a function of time
time, keff = results.get_keff(time_units='d')

View file

@ -24,7 +24,7 @@ from openmc.checkvalue import check_type, check_greater_than
from openmc.mpi import comm
from .results import StepResult
from .chain import Chain
from .results_list import ResultsList
from .results_list import Results
from .pool import deplete
@ -79,7 +79,7 @@ class TransportOperator(ABC):
in initial condition to ensure they exist in the decay chain.
Only done for nuclides with reaction rates.
Defaults to 1.0e3.
prev_results : ResultsList, optional
prev_results : Results, optional
Results from a previous depletion calculation.
Attributes
@ -88,7 +88,7 @@ class TransportOperator(ABC):
Initial atom density [atoms/cm^3] to add for nuclides that are zero
in initial condition to ensure they exist in the decay chain.
Only done for nuclides with reaction rates.
prev_res : ResultsList or None
prev_res : Results or None
Results from a previous depletion calculation. ``None`` if no
results are to be used.
"""
@ -102,7 +102,7 @@ class TransportOperator(ABC):
if prev_results is None:
self.prev_res = None
else:
check_type("previous results", prev_results, ResultsList)
check_type("previous results", prev_results, Results)
self.prev_res = prev_results
@property

View file

@ -25,7 +25,7 @@ from .abc import TransportOperator, OperatorResult
from .atom_number import AtomNumber
from .chain import _find_chain_file
from .reaction_rates import ReactionRates
from .results_list import ResultsList
from .results_list import Results
from .helpers import (
DirectReactionRateHelper, ChainFissionHelper, ConstantFissionYieldHelper,
FissionYieldCutoffHelper, AveragedFissionYieldHelper, EnergyScoreHelper,
@ -94,7 +94,7 @@ class Operator(TransportOperator):
Path to the depletion chain XML file. Defaults to the file
listed under ``depletion_chain`` in
:envvar:`OPENMC_CROSS_SECTIONS` environment variable.
prev_results : ResultsList, optional
prev_results : Results, optional
Results from a previous depletion calculation. If this argument is
specified, the depletion calculation will start from the latest state
in the previous results.
@ -192,7 +192,7 @@ class Operator(TransportOperator):
Initial heavy metal inventory [g]
local_mats : list of str
All burnable material IDs being managed by a single process
prev_res : ResultsList or None
prev_res : Results or None
Results from a previous depletion calculation. ``None`` if no
results are to be used.
cleanup_when_done : bool
@ -284,7 +284,7 @@ class Operator(TransportOperator):
if comm.size == 1:
self.prev_res = prev_results
else:
self.prev_res = ResultsList()
self.prev_res = Results()
mat_indexes = _distribute(range(len(self.burnable_mats)))
for res_obj in prev_results:
new_res = res_obj.distribute(self.local_mats, mat_indexes)
@ -494,7 +494,7 @@ class Operator(TransportOperator):
Volumes for the above materials in [cm^3]
nuclides : list of str
Nuclides to be used in the simulation.
prev_res : ResultsList, optional
prev_res : Results, optional
Results from a previous depletion calculation
"""
@ -543,7 +543,7 @@ class Operator(TransportOperator):
----------
mat : openmc.Material
The material to read from
prev_res : ResultsList
prev_res : Results
Results from a previous depletion calculation
"""

View file

@ -12,7 +12,7 @@ from openmc.data.library import DataLibrary
from openmc.material import Material, Materials
from openmc.exceptions import DataError, InvalidArgumentError
__all__ = ["ResultsList"]
__all__ = ["Results"]
def _get_time_as(seconds, units):
@ -26,10 +26,10 @@ def _get_time_as(seconds, units):
return seconds
class ResultsList(list):
class Results(list):
"""Results from a depletion simulation
The :class:`ResultsList` class acts as a list that stores the results from
The :class:`Results` class acts as a list that stores the results from
each depletion step and provides extra methods for interrogating these
results.
@ -63,13 +63,13 @@ class ResultsList(list):
Returns
-------
ResultsList
Results
New instance of depletion results
"""
warn(
"The from_hdf5(...) method is no longer necessary and will be removed "
"in a future version of OpenMC. Use ResultsList(...) instead.",
"in a future version of OpenMC. Use Results(...) instead.",
FutureWarning
)
return cls(filename)

View file

@ -77,8 +77,8 @@ def test_full(run_in_tmpdir, problem, multiproc):
return
# Load the reference/test results
res_test = openmc.deplete.ResultsList(path_test)
res_ref = openmc.deplete.ResultsList(path_reference)
res_test = openmc.deplete.Results(path_test)
res_ref = openmc.deplete.Results(path_reference)
# Assert same mats
for mat in res_ref[0].mat_to_ind:
@ -139,7 +139,7 @@ def test_depletion_results_to_material(run_in_tmpdir, problem):
"""Checks openmc.Materials objects can be created from depletion results"""
# Load the reference/test results
path_reference = Path(__file__).with_name('test_reference.h5')
res_ref = openmc.deplete.ResultsList(path_reference)
res_ref = openmc.deplete.Results(path_reference)
# Firstly need to export materials.xml file for the initial simulation state
geometry, lower_left, upper_right = problem

View file

@ -107,7 +107,7 @@ def test_activation(run_in_tmpdir, model, reaction_rate_mode, reaction_rate_opts
integrator.integrate()
# Get resulting number of atoms
results = openmc.deplete.ResultsList('depletion_results.h5')
results = openmc.deplete.Results('depletion_results.h5')
_, atoms = results.get_atoms(w, "W186")
assert atoms[0] == pytest.approx(n0)
@ -155,7 +155,7 @@ def test_decay(run_in_tmpdir):
integrator.integrate()
# Get resulting number of atoms
results = openmc.deplete.ResultsList('depletion_results.h5')
results = openmc.deplete.Results('depletion_results.h5')
_, atoms = results.get_atoms(mat, "Sr89")
# Ensure density goes down by a factor of 2 after each half-life

View file

@ -16,7 +16,7 @@ import pytest
from openmc.mpi import comm
from openmc.deplete import (
ReactionRates, StepResult, ResultsList, OperatorResult, PredictorIntegrator,
ReactionRates, StepResult, Results, OperatorResult, PredictorIntegrator,
CECMIntegrator, CF4Integrator, CELIIntegrator, EPCRK4Integrator,
LEQIIntegrator, SICELIIntegrator, SILEQIIntegrator, cram)
@ -103,7 +103,7 @@ def test_results_save(run_in_tmpdir):
StepResult.save(op, x2, op_result2, t2, 0, 1)
# Load the files
res = ResultsList("depletion_results.h5")
res = Results("depletion_results.h5")
for i in range(stages):
for mat_i, mat in enumerate(burn_list):
@ -176,7 +176,7 @@ def test_integrator(run_in_tmpdir, scheme):
# get expected results
res = ResultsList(operator.output_dir / "depletion_results.h5")
res = Results(operator.output_dir / "depletion_results.h5")
t1, y1 = res.get_atoms("1", "1")
t2, y2 = res.get_atoms("1", "2")

View file

@ -24,7 +24,7 @@ def test_restart_predictor_cecm(run_in_tmpdir):
openmc.deplete.PredictorIntegrator(op, dt, power).integrate()
# Load the files
prev_res = openmc.deplete.ResultsList(op.output_dir / "depletion_results.h5")
prev_res = openmc.deplete.Results(op.output_dir / "depletion_results.h5")
# Re-create depletion operator and load previous results
op = dummy_operator.DummyOperator(prev_res)
@ -50,7 +50,7 @@ def test_restart_cecm_predictor(run_in_tmpdir):
cecm.integrate()
# Load the files
prev_res = openmc.deplete.ResultsList(op.output_dir / "depletion_results.h5")
prev_res = openmc.deplete.Results(op.output_dir / "depletion_results.h5")
# Re-create depletion operator and load previous results
op = dummy_operator.DummyOperator(prev_res)
@ -73,7 +73,7 @@ def test_restart(run_in_tmpdir, scheme):
bundle.solver(operator, [0.75], 1.0).integrate()
# restart
prev_res = openmc.deplete.ResultsList(
prev_res = openmc.deplete.Results(
operator.output_dir / "depletion_results.h5")
operator = dummy_operator.DummyOperator(prev_res)
@ -82,7 +82,7 @@ def test_restart(run_in_tmpdir, scheme):
# compare results
results = openmc.deplete.ResultsList(
results = openmc.deplete.Results(
operator.output_dir / "depletion_results.h5")
_t, y1 = results.get_atoms("1", "1")

View file

@ -1,4 +1,4 @@
"""Tests the ResultsList class"""
"""Tests the Results class"""
from pathlib import Path
from math import inf
@ -13,7 +13,7 @@ def res():
"""Load the reference results"""
filename = (Path(__file__).parents[1] / 'regression_tests' / 'deplete'
/ 'test_reference.h5')
return openmc.deplete.ResultsList(filename)
return openmc.deplete.Results(filename)
def test_get_atoms(res):
@ -72,9 +72,9 @@ def test_get_keff(res):
@pytest.mark.parametrize("unit", ("s", "d", "min", "h"))
def test_get_steps(unit):
# Make a ResultsList full of near-empty Result instances
# Make a Results full of near-empty Result instances
# Just fill out a time schedule
results = openmc.deplete.ResultsList()
results = openmc.deplete.Results()
# Time in units of unit
times = np.linspace(0, 100, num=5)
if unit == "d":

View file

@ -2,7 +2,7 @@
from pytest import approx
import openmc
from openmc.deplete import PredictorIntegrator, ResultsList
from openmc.deplete import PredictorIntegrator, Results
from tests import dummy_operator
@ -19,7 +19,7 @@ def test_transfer_volumes(run_in_tmpdir):
PredictorIntegrator(op, dt, power).integrate()
# Load the files
res = openmc.deplete.ResultsList(op.output_dir / "depletion_results.h5")
res = openmc.deplete.Results(op.output_dir / "depletion_results.h5")
# Create a dictionary of volumes to transfer
res[0].volume['1'] = 1.5