From 18c4d5f4327828721a1b21c9bec0da24de8d5a3b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 7 Aug 2019 09:01:15 -0500 Subject: [PATCH] Document init parameters and attributes for Integrators --- docs/source/pythonapi/deplete.rst | 2 +- openmc/deplete/integrator/abc.py | 111 +++++++++++++++---------- openmc/deplete/integrator/cecm.py | 31 +++++++ openmc/deplete/integrator/celi.py | 31 +++++++ openmc/deplete/integrator/cf4.py | 31 +++++++ openmc/deplete/integrator/epc_rk4.py | 34 +++++++- openmc/deplete/integrator/leqi.py | 31 +++++++ openmc/deplete/integrator/predictor.py | 13 ++- openmc/deplete/integrator/si_celi.py | 38 ++++++++- openmc/deplete/integrator/si_leqi.py | 36 ++++++++ 10 files changed, 308 insertions(+), 50 deletions(-) diff --git a/docs/source/pythonapi/deplete.rst b/docs/source/pythonapi/deplete.rst index 29a3b5b9a0..f2964c5c89 100644 --- a/docs/source/pythonapi/deplete.rst +++ b/docs/source/pythonapi/deplete.rst @@ -17,9 +17,9 @@ transport-depletion coupling algorithms `_. :template: myclassinherit.rst integrator.PredictorIntegrator - integrator.CF4Integrator integrator.CECMIntegrator integrator.CELIIntegrator + integrator.CF4Integrator integrator.EPCRK4Integrator integrator.LEQIIntegrator integrator.SICELIIntegrator diff --git a/openmc/deplete/integrator/abc.py b/openmc/deplete/integrator/abc.py index 03064d8bdb..53db536aa4 100644 --- a/openmc/deplete/integrator/abc.py +++ b/openmc/deplete/integrator/abc.py @@ -13,30 +13,39 @@ from openmc.deplete import Results, OperatorResult class Integrator(ABC): """Abstract class for solving the time-integration for depletion + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ def __init__(self, operator, timesteps, power=None, power_density=None): - """ - Parameters - ---------- - operator : openmc.deplete.TransportOperator - The operator object to simulate on. - timesteps : iterable of float - Array of timesteps in units of [s]. Note that values are not - cumulative. - power : float or iterable of float, optional - Power of the reactor in [W]. A single value indicates that - the power is constant over all timesteps. An iterable - indicates potentially different power levels for each timestep. - For a 2D problem, the power can be given in [W/cm] as long - as the "volume" assigned to a depletion material is actually - an area in [cm^2]. Either ``power`` or ``power_density`` must be - specified. - power_density : float or iterable of float, optional - 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. - """ # Check number of stages previously used if operator.prev_res is not None: res = operator.prev_res[-1] @@ -175,33 +184,45 @@ class SIIntegrator(Integrator): Does not provide a ``__call__`` method, but scales and resets the number of particles used in initial transport calculation + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + The operator object to simulate on. + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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_steps : int, optional + Number of stochastic iterations per depletion interval. + Must be greater than zero. Default : 10 + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` + n_steps : int + Number of stochastic iterations per depletion interval """ def __init__(self, operator, timesteps, power=None, power_density=None, n_steps=10): - """ - Parameters - ---------- - operator : openmc.deplete.TransportOperator - The operator object to simulate on. - timesteps : iterable of float - Array of timesteps in units of [s]. Note that values are not - cumulative. - power : float or iterable of float, optional - Power of the reactor in [W]. A single value indicates that - the power is constant over all timesteps. An iterable - indicates potentially different power levels for each timestep. - For a 2D problem, the power can be given in [W/cm] as long - as the "volume" assigned to a depletion material is actually - an area in [cm^2]. Either ``power`` or ``power_density`` must be - specified. - power_density : float or iterable of float, optional - 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_steps : int, optional - Number of stochastic iterations per depletion interval. - Must be greater than zero. Default : 10 - """ check_type("n_steps", n_steps, Integral) check_greater_than("n_steps", n_steps, 0) super().__init__(operator, timesteps, power, power_density) diff --git a/openmc/deplete/integrator/cecm.py b/openmc/deplete/integrator/cecm.py index 647acfe0cc..aea4b7b399 100644 --- a/openmc/deplete/integrator/cecm.py +++ b/openmc/deplete/integrator/cecm.py @@ -21,6 +21,37 @@ class CECMIntegrator(Integrator): A_c &= A(y_m, t_n + h/2) \\ y_{n+1} &= \text{expm}(A_c h) y_n \end{aligned} + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 2 diff --git a/openmc/deplete/integrator/celi.py b/openmc/deplete/integrator/celi.py index 6935f9f6d6..9aa9830b2c 100644 --- a/openmc/deplete/integrator/celi.py +++ b/openmc/deplete/integrator/celi.py @@ -22,6 +22,37 @@ class CELIIntegrator(Integrator): y_{n+1} &= \text{expm}(\frac{h}{12} A_0 + \frac{5h}{12} A1) \text{expm}(\frac{5h}{12} A_0 + \frac{h}{12} A1) y_n \end{aligned} + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 2 diff --git a/openmc/deplete/integrator/cf4.py b/openmc/deplete/integrator/cf4.py index a88a6788c8..49ae16483a 100644 --- a/openmc/deplete/integrator/cf4.py +++ b/openmc/deplete/integrator/cf4.py @@ -27,6 +27,37 @@ class CF4Integrator(Integrator): y_4 &= \text{expm}( 1/4 F_1 + 1/6 F_2 + 1/6 F_3 - 1/12 F_4) \text{expm}(-1/12 F_1 + 1/6 F_2 + 1/6 F_3 + 1/4 F_4) y_0 \end{aligned} + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 4 diff --git a/openmc/deplete/integrator/epc_rk4.py b/openmc/deplete/integrator/epc_rk4.py index d5fba639f7..c8247bf427 100644 --- a/openmc/deplete/integrator/epc_rk4.py +++ b/openmc/deplete/integrator/epc_rk4.py @@ -8,8 +8,7 @@ class EPCRK4Integrator(Integrator): r"""Deplete using the EPC-RK4 algorithm. Implements an extended predictor-corrector algorithm with traditional - Runge-Kutta 4 method. - This algorithm is mathematically defined as: + Runge-Kutta 4 method. This algorithm is mathematically defined as: .. math:: \begin{aligned} @@ -22,6 +21,37 @@ class EPCRK4Integrator(Integrator): F_4 &= h A(y_3) \\ y_4 &= \text{expm}(1/6 F_1 + 1/3 F_2 + 1/3 F_3 + 1/6 F_4) y_0 \end{aligned} + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 4 diff --git a/openmc/deplete/integrator/leqi.py b/openmc/deplete/integrator/leqi.py index 551514078b..86c1ab2dfa 100644 --- a/openmc/deplete/integrator/leqi.py +++ b/openmc/deplete/integrator/leqi.py @@ -36,6 +36,37 @@ class LEQIIntegrator(Integrator): \end{aligned} It is initialized using the CE/LI algorithm. + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 2 diff --git a/openmc/deplete/integrator/predictor.py b/openmc/deplete/integrator/predictor.py index f57bac79c1..44b1516aa0 100644 --- a/openmc/deplete/integrator/predictor.py +++ b/openmc/deplete/integrator/predictor.py @@ -20,7 +20,7 @@ class PredictorIntegrator(Integrator): Parameters ---------- operator : openmc.deplete.TransportOperator - The operator object to simulate on. + Operator to perform transport simulations timesteps : iterable of float Array of timesteps in units of [s]. Note that values are not cumulative. @@ -36,6 +36,17 @@ class PredictorIntegrator(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. + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` """ _num_stages = 1 diff --git a/openmc/deplete/integrator/si_celi.py b/openmc/deplete/integrator/si_celi.py index 69f7287baf..4b4ccc1e69 100644 --- a/openmc/deplete/integrator/si_celi.py +++ b/openmc/deplete/integrator/si_celi.py @@ -15,8 +15,44 @@ class SICELIIntegrator(SIIntegrator): using the `fourth order commutator-free integrator `_. - Detailed algorithm can be found in section 3.2 in `colin josey's thesis + Detailed algorithm can be found in section 3.2 in `Colin Josey's thesis `_. + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + The operator object to simulate on. + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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_steps : int, optional + Number of stochastic iterations per depletion interval. + Must be greater than zero. Default : 10 + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` + n_steps : int + Number of stochastic iterations per depletion interval """ _num_stages = 2 diff --git a/openmc/deplete/integrator/si_leqi.py b/openmc/deplete/integrator/si_leqi.py index 4a39207caf..1e48c039e7 100644 --- a/openmc/deplete/integrator/si_leqi.py +++ b/openmc/deplete/integrator/si_leqi.py @@ -18,6 +18,42 @@ class SILEQIIntegrator(SIIntegrator): Detailed algorithm can be found in Section 3.2 in `Colin Josey's thesis `_. + + Parameters + ---------- + operator : openmc.deplete.TransportOperator + The operator object to simulate on. + timesteps : iterable of float + Array of timesteps in units of [s]. Note that values are not + cumulative. + power : float or iterable of float, optional + Power of the reactor in [W]. A single value indicates that + the power is constant over all timesteps. An iterable + indicates potentially different power levels for each timestep. + For a 2D problem, the power can be given in [W/cm] as long + as the "volume" assigned to a depletion material is actually + an area in [cm^2]. Either ``power`` or ``power_density`` must be + specified. + power_density : float or iterable of float, optional + 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_steps : int, optional + Number of stochastic iterations per depletion interval. + Must be greater than zero. Default : 10 + + Attributes + ---------- + operator : openmc.deplete.TransportOperator + Operator to perform transport simulations + chain : openmc.deplete.Chain + Depletion chain + timesteps : iterable of float + Size of each depletion interval in [s] + power : iterable of float + Power of the reactor in [W] for each interval in :attr:`timesteps` + n_steps : int + Number of stochastic iterations per depletion interval """ _num_stages = 2