mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Rename deplete.Results -> deplete.StepResult
This commit is contained in:
parent
0b77cc7edc
commit
aacf3c4938
6 changed files with 25 additions and 21 deletions
|
|
@ -133,8 +133,8 @@ data, such as number densities and reaction rates for each material.
|
|||
AtomNumber
|
||||
OperatorResult
|
||||
ReactionRates
|
||||
Results
|
||||
ResultsList
|
||||
StepResult
|
||||
|
||||
The following class and functions are used to solve the depletion equations,
|
||||
with :func:`cram.CRAM48` being the default.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from uncertainties import ufloat
|
|||
from openmc.lib import MaterialFilter, Tally
|
||||
from openmc.checkvalue import check_type, check_greater_than
|
||||
from openmc.mpi import comm
|
||||
from .results import Results
|
||||
from .results import StepResult
|
||||
from .chain import Chain
|
||||
from .results_list import ResultsList
|
||||
from .pool import deplete
|
||||
|
|
@ -889,7 +889,7 @@ class Integrator(ABC):
|
|||
# Remove actual EOS concentration for next step
|
||||
conc = conc_list.pop()
|
||||
|
||||
Results.save(self.operator, conc_list, res_list, [t, t + dt],
|
||||
StepResult.save(self.operator, conc_list, res_list, [t, t + dt],
|
||||
source_rate, self._i_res + i, proc_time)
|
||||
|
||||
t += dt
|
||||
|
|
@ -901,7 +901,7 @@ class Integrator(ABC):
|
|||
if output and final_step:
|
||||
print(f"[openmc.deplete] t={t} (final operator evaluation)")
|
||||
res_list = [self.operator(conc, source_rate if final_step else 0.0)]
|
||||
Results.save(self.operator, [conc], res_list, [t, t],
|
||||
StepResult.save(self.operator, [conc], res_list, [t, t],
|
||||
source_rate, self._i_res + len(self), proc_time)
|
||||
self.operator.write_bos_data(len(self) + self._i_res)
|
||||
|
||||
|
|
@ -1048,13 +1048,13 @@ class SIIntegrator(Integrator):
|
|||
# Remove actual EOS concentration for next step
|
||||
conc = conc_list.pop()
|
||||
|
||||
Results.save(self.operator, conc_list, res_list, [t, t + dt],
|
||||
StepResult.save(self.operator, conc_list, res_list, [t, t + dt],
|
||||
p, self._i_res + i, proc_time)
|
||||
|
||||
t += dt
|
||||
|
||||
# No final simulation for SIE, use last iteration results
|
||||
Results.save(self.operator, [conc], [res_list[-1]], [t, t],
|
||||
StepResult.save(self.operator, [conc], [res_list[-1]], [t, t],
|
||||
p, self._i_res + len(self), proc_time)
|
||||
self.operator.write_bos_data(self._i_res + len(self))
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ from .reaction_rates import ReactionRates
|
|||
VERSION_RESULTS = (1, 1)
|
||||
|
||||
|
||||
__all__ = ["Results"]
|
||||
__all__ = ["StepResult"]
|
||||
|
||||
|
||||
class Results:
|
||||
class StepResult:
|
||||
"""Output of a depletion run
|
||||
|
||||
Attributes
|
||||
|
|
@ -72,7 +72,7 @@ class Results:
|
|||
def __repr__(self):
|
||||
t = self.time[0]
|
||||
dt = self.time[1] - self.time[0]
|
||||
return f"<Results: t={t}, dt={dt}, source={self.source_rate}>"
|
||||
return f"<StepResult: t={t}, dt={dt}, source={self.source_rate}>"
|
||||
|
||||
def __getitem__(self, pos):
|
||||
"""Retrieves an item from results.
|
||||
|
|
@ -139,7 +139,7 @@ class Results:
|
|||
return self.data.shape[0]
|
||||
|
||||
def allocate(self, volume, nuc_list, burn_list, full_burn_list, stages):
|
||||
"""Allocates memory of Results.
|
||||
"""Allocate memory for depletion step data
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -177,10 +177,10 @@ class Results:
|
|||
|
||||
Returns
|
||||
-------
|
||||
Results
|
||||
StepResult
|
||||
New results object
|
||||
"""
|
||||
new = Results()
|
||||
new = StepResult()
|
||||
new.volume = {lm: self.volume[lm] for lm in local_materials}
|
||||
new.mat_to_ind = {mat: idx for (idx, mat) in enumerate(local_materials)}
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ class Results:
|
|||
stages = len(x)
|
||||
|
||||
# Create results
|
||||
results = Results()
|
||||
results = StepResult()
|
||||
results.allocate(vol_dict, nuc_list, burn_list, full_burn_list, stages)
|
||||
|
||||
n_mat = len(burn_list)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from warnings import warn
|
|||
import h5py
|
||||
import numpy as np
|
||||
|
||||
from .results import Results, VERSION_RESULTS
|
||||
from .results import StepResult, VERSION_RESULTS
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.data.library import DataLibrary
|
||||
from openmc.material import Material, Materials
|
||||
|
|
@ -27,7 +27,11 @@ def _get_time_as(seconds, units):
|
|||
|
||||
|
||||
class ResultsList(list):
|
||||
"""A list of openmc.deplete.Results objects
|
||||
"""Results from a depletion simulation
|
||||
|
||||
The :class:`ResultsList` class acts as a list that stores the results from
|
||||
each depletion step and provides extra methods for interrogating these
|
||||
results.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -44,7 +48,7 @@ class ResultsList(list):
|
|||
n = fh["number"][...].shape[0]
|
||||
|
||||
for i in range(n):
|
||||
data.append(Results.from_hdf5(fh, i))
|
||||
data.append(StepResult.from_hdf5(fh, i))
|
||||
super().__init__(data)
|
||||
|
||||
|
||||
|
|
@ -59,7 +63,7 @@ class ResultsList(list):
|
|||
|
||||
Returns
|
||||
-------
|
||||
new : ResultsList
|
||||
ResultsList
|
||||
New instance of depletion results
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import pytest
|
|||
|
||||
from openmc.mpi import comm
|
||||
from openmc.deplete import (
|
||||
ReactionRates, Results, ResultsList, OperatorResult, PredictorIntegrator,
|
||||
ReactionRates, StepResult, ResultsList, OperatorResult, PredictorIntegrator,
|
||||
CECMIntegrator, CF4Integrator, CELIIntegrator, EPCRK4Integrator,
|
||||
LEQIIntegrator, SICELIIntegrator, SILEQIIntegrator, cram)
|
||||
|
||||
|
|
@ -99,8 +99,8 @@ def test_results_save(run_in_tmpdir):
|
|||
for k, rates in zip(eigvl1, rate1)]
|
||||
op_result2 = [OperatorResult(ufloat(*k), rates)
|
||||
for k, rates in zip(eigvl2, rate2)]
|
||||
Results.save(op, x1, op_result1, t1, 0, 0)
|
||||
Results.save(op, x2, op_result2, t2, 0, 1)
|
||||
StepResult.save(op, x1, op_result1, t1, 0, 0)
|
||||
StepResult.save(op, x2, op_result2, t2, 0, 1)
|
||||
|
||||
# Load the files
|
||||
res = ResultsList("depletion_results.h5")
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ def test_get_steps(unit):
|
|||
conversion_to_seconds = 1
|
||||
|
||||
for ix in range(times.size):
|
||||
res = openmc.deplete.Results()
|
||||
res = openmc.deplete.StepResult()
|
||||
res.time = times[ix:ix + 1] * conversion_to_seconds
|
||||
results.append(res)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue