mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Clean up changes introduced by Integrators
Remove some unused imports, redeclared __init__, long lines, etc.
This commit is contained in:
parent
c4567b6d9d
commit
51add8f6e9
6 changed files with 17 additions and 24 deletions
|
|
@ -101,7 +101,7 @@ class Integrator(ABC):
|
|||
# See Operator.__call__, Operator.initial_condition
|
||||
bos_conc = list(res.data[0])
|
||||
rates = res.rates[0]
|
||||
k = ufloat(res.k[0,0], res.k[0, 1])
|
||||
k = ufloat(res.k[0, 0], res.k[0, 1])
|
||||
|
||||
# Scale rates by ratio of powers
|
||||
rates *= step_power / res.power[0]
|
||||
|
|
@ -110,7 +110,8 @@ class Integrator(ABC):
|
|||
def _get_start_data(self):
|
||||
if self.operator.prev_res is None:
|
||||
return 0.0, 0
|
||||
return self.operator.prev_res[-1].time[-1], len(self.operator.prev_res) - 1
|
||||
return (self.operator.prev_res[-1].time[-1],
|
||||
len(self.operator.prev_res) - 1)
|
||||
|
||||
def integrate(self):
|
||||
"""Perform the entire depletion process across all steps"""
|
||||
|
|
@ -181,14 +182,12 @@ class SI_Integrator(Integrator):
|
|||
Power density of the reactor in [W/gHM]. It is multiplied by
|
||||
initial heavy metal inventory to get total power if ``power``
|
||||
is not speficied.
|
||||
n_stages : int, optional
|
||||
Number of stages. Default : 10
|
||||
"""
|
||||
|
||||
def __init__(self, operator, timesteps, power=None, power_density=None,
|
||||
n_stages=10):
|
||||
n_steps : int, optional
|
||||
Number of stochastic iterations per depletion interval.
|
||||
Default : 10
|
||||
"""
|
||||
super().__init__(operator, timesteps, power, power_density)
|
||||
self.n_stages = n_stages
|
||||
self.n_steps = n_steps
|
||||
|
||||
def _get_bos_data_from_openmc(self, step_index, step_power, bos_conc):
|
||||
reset_particles = False
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""The CE/CM integrator."""
|
||||
|
||||
from textwrap import dedent
|
||||
|
||||
from .abc import Integrator
|
||||
from .cram import timed_deplete
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""First-order predictor algorithm."""
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
from .abc import Integrator
|
||||
from .cram import timed_deplete
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,18 @@
|
|||
|
||||
import copy
|
||||
|
||||
from uncertainties import ufloat
|
||||
|
||||
from .abc import SI_Integrator
|
||||
from .cram import timed_deplete
|
||||
from .celi import _celi_f1, _celi_f2
|
||||
from ..abc import OperatorResult
|
||||
from ..results import Results
|
||||
|
||||
|
||||
class SI_CELI_Integrator(SI_Integrator):
|
||||
r"""Deplete using the si-ce/li cfq4 algorithm.
|
||||
|
||||
Implements the stochastic implicit ce/li predictor-corrector algorithm using
|
||||
the `fourth order commutator-free integrator <https://doi.org/10.1137/05063042>`_.
|
||||
Implements the stochastic implicit ce/li predictor-corrector algorithm
|
||||
using the `fourth order commutator-free integrator
|
||||
<https://doi.org/10.1137/05063042>`_.
|
||||
|
||||
detailed algorithm can be found in section 3.2 in `colin josey's thesis
|
||||
<http://hdl.handle.net/1721.1/113721>`_.
|
||||
|
|
@ -52,7 +50,7 @@ class SI_CELI_Integrator(SI_Integrator):
|
|||
inter_conc = copy.deepcopy(eos_conc)
|
||||
|
||||
# Begin iteration
|
||||
for j in range(self.n_stages + 1):
|
||||
for j in range(self.n_steps + 1):
|
||||
inter_res = self.operator(inter_conc, power)
|
||||
|
||||
if j <= 1:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import copy
|
|||
from collections.abc import Iterable
|
||||
from itertools import repeat
|
||||
|
||||
from uncertainties import ufloat
|
||||
|
||||
from .abc import SI_Integrator
|
||||
from .si_celi import SI_CELI_Integrator
|
||||
from .leqi import _leqi_f1, _leqi_f2, _leqi_f3, _leqi_f4
|
||||
|
|
@ -75,7 +73,7 @@ class SI_LEQI_Integrator(SI_Integrator):
|
|||
proc_time += time1
|
||||
inter_conc = copy.deepcopy(eos_conc)
|
||||
|
||||
for j in range(self.n_stages + 1):
|
||||
for j in range(self.n_steps + 1):
|
||||
inter_res = self.operator(inter_conc, power)
|
||||
|
||||
if j <= 1:
|
||||
|
|
|
|||
|
|
@ -76,8 +76,10 @@ def test_results_save(run_in_tmpdir):
|
|||
t1 = [0.0, 1.0]
|
||||
t2 = [1.0, 2.0]
|
||||
|
||||
op_result1 = [OperatorResult(ufloat(*k), rates) for k, rates in zip(eigvl1, rate1)]
|
||||
op_result2 = [OperatorResult(ufloat(*k), rates) for k, rates in zip(eigvl2, rate2)]
|
||||
op_result1 = [OperatorResult(ufloat(*k), rates)
|
||||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue