bluemira.fuel_cycle.tools
Fuel cycle utility objects, including sink algorithms
Classes
Enumeration of noise search modes. |
|
Sink Data fit methods |
Functions
|
Find local minima or maxima in a noisy signal. |
|
Discretise x and y for a given number of points. |
|
Convert an atomic flux to a flow-rate. |
|
Piecewise linear model with initial linear slope, followed by threshold. |
|
Piecewise square-root model, followed by threshold. |
|
Function used to determine simplified tritium sink model parameters, from |
|
Time-shift a tritium flow with a delay and account for radioactive decay. |
|
Fountain tritium block. Needs a minimum T inventory to operate. |
|
The main recycling loop, JIT compiled. |
|
Finds peak slope in fpy as a function of calendar years |
|
Calculates the release rate of T from the model TFV cycle in kg/yr. |
|
Analytical value of series expansion for an inventory I with a incoming |
|
Analytical value of series expansion for an in-flux of tritium over a time- |
|
Inter-timestep method solving for dt in the below equality: |
|
A simple linear fountain tritium retention sink model between a minimum |
|
A simple linear tritium retention sink model. Used over a time-step. |
|
A simple sqrt tritium retention sink model. Used over a time-step. |
|
Bathtub sink model. |
|
Bathtub sink model with a sqrt inventory retention law. |
|
A fountain and bathtub sink simultaneously. |
Module Contents
- class bluemira.fuel_cycle.tools.NoiseModeType(*args, **kwds)
Bases:
enum.EnumEnumeration of noise search modes.
- MIN
- MAX
- classmethod _missing_(value: str | NoiseModeType) NoiseModeType
- Parameters:
value (str | NoiseModeType)
- Return type:
- bluemira.fuel_cycle.tools.find_noisy_locals(x: numpy.ndarray, x_bins: int = 50, mode: str = 'min') tuple[numpy.ndarray, numpy.ndarray]
Find local minima or maxima in a noisy signal.
- Parameters:
x (numpy.ndarray) – The noise data to search
x_bins (int) – The number of bins to search with
mode (str) – The search mode [‘min’, ‘max’]
- Returns:
local_mid_x – The arguments of the local minima or maxima
local_m – The local minima or maxima
- Return type:
tuple[numpy.ndarray, numpy.ndarray]
- bluemira.fuel_cycle.tools.discretise_1d(x: numpy.ndarray, y: numpy.ndarray, n: int, method: str = 'linear') tuple[numpy.ndarray, numpy.ndarray]
Discretise x and y for a given number of points.
- Parameters:
x (numpy.ndarray) – The x data
y (numpy.ndarray) – The y data
n (int) – The number of discretisation points
method (str) – The interpolation method
- Returns:
x_1d – The discretised x data
y_1d – The discretised y data
- Return type:
tuple[numpy.ndarray, numpy.ndarray]
- bluemira.fuel_cycle.tools.convert_flux_to_flow(flux: float, area: float) float
Convert an atomic flux to a flow-rate.
- Parameters:
flux (float) – The atomic flux [T/m^2/s]
area (float) – The surface area of the flux [m^2]
- Return type:
The flow-rate [kg/s]
- bluemira.fuel_cycle.tools.piecewise_linear_threshold(x: numpy.ndarray, x0: float, y0: float, m1: float, m2: float) numpy.ndarray
Piecewise linear model with initial linear slope, followed by threshold.
- Parameters:
x (numpy.ndarray) – The vector of x values to calculate the function for
x0 (float) – The x coordinate of the kink point
y0 (float) – The y coordinate of the kink point
m1 (float) – The slope of the first curve
m2 (float) – The threshold value of the function
- Return type:
The vector of fitted values
- bluemira.fuel_cycle.tools.piecewise_sqrt_threshold(x: numpy.ndarray, factor: float, kink: float, threshold: float) numpy.ndarray
Piecewise square-root model, followed by threshold.
- Parameters:
x (numpy.ndarray) – The vector of x values to calculate the function for
factor (float) – The multiplication factor for the sqrt function
kink (float) – The x value where the behaviour changes from sqrt to constant
threshold (float) – The threshold value of the model
- Return type:
The vector of fitted values
- class bluemira.fuel_cycle.tools.FitMethod(*args, **kwds)
Bases:
enum.EnumSink Data fit methods
- LINEAR
- SQRT
- classmethod _missing_(value: str)
- Parameters:
value (str)
- bluemira.fuel_cycle.tools.fit_sink_data(x: numpy.ndarray, y: numpy.ndarray, method: str | FitMethod = FitMethod.SQRT, *, plot: bool = True) tuple[float, float]
Function used to determine simplified tritium sink model parameters, from data values.
- Parameters:
x (numpy.ndarray) – The vector of x values
y (numpy.ndarray) – The vector of y values
method (str | FitMethod) – The type of fit to use [‘linear’, ‘sqrt’]
plot (bool) – Whether or not to plot the fitting result
- Returns:
slope – The slope of the fitted piecewise linear threshold function
threshold – The threshold of the fitted piecewise linear threshold function
- Return type:
tuple[float, float]
- bluemira.fuel_cycle.tools.delay_decay(t: numpy.ndarray, m_t_flow: numpy.ndarray, tt_delay: float) numpy.ndarray
Time-shift a tritium flow with a delay and account for radioactive decay.
- Parameters:
t (numpy.ndarray) – The time vector [s]
m_t_flow (numpy.ndarray) – The mass flow vector [kg/s] [or any other unit same as return value]
tt_delay (float) – The delay duration (scalar) [yr]
- Return type:
The delayed flow vector [kg/s] [or any other unit same as m_t_flow]
- bluemira.fuel_cycle.tools.fountain(flow: numpy.ndarray, t: numpy.ndarray, min_inventory: float) tuple[numpy.ndarray, Ellipsis]
Fountain tritium block. Needs a minimum T inventory to operate. This is a binary description. In reality, the TFV systems modelled here (such as the cryogenic distillation column) can and do operate below I_min.
- Parameters:
flow (numpy.ndarray) – \(m_{T_{flow}}\) tritium flow through system [kg/s]
t (numpy.ndarray) – \(t\) time [years]
min_inventory (float) – \(I_{min}\) minimum T inventory for system to operate [kg]
- Returns:
m_out – \(m_{T_{flowout}}\) mass flow out [kg/s]
inventory – \(I\) built-up T inventory in system [kg]
- Return type:
tuple[numpy.ndarray, Ellipsis]
Notes
\(dt = t[i]-t[i-1]\) n \(I[i] = I[i-1]e^{-ln(2)dt/t_{1/2}}+m_{T_{flow}}dt\) n
- if \(I > I_{min}\):
\(I[i] = I_{min}\) [kg]n \(m_{T_{flowout}} = \frac{I_{min}-I[i]}{dt}\) [kg/s] n
- if \(I < I_{min}\):
\(I[i] = I[i-1]+m_{T_{flow}}dt\) [kg] n \(m_{T_{flowout}} = 0\) [kg/s]
- bluemira.fuel_cycle.tools._speed_recycle(m_start_up: float, t: numpy.ndarray, m_in: numpy.ndarray, m_fuel_injector: numpy.ndarray) numpy.ndarray
The main recycling loop, JIT compiled.
- Parameters:
m_start_up (float) – An initial guess for the start-up inventory [kg]
t (numpy.ndarray) – The time vector [years]
m_in (numpy.ndarray) – The array of tritium flow-rates required for fusion [kg/s]
m_fuel_injector (numpy.ndarray) – The array of tritium flow-rates fuelling the plasma [kg/s]
- Returns:
The tritium in the stores
- Return type:
numpy.ndarray
- bluemira.fuel_cycle.tools.find_max_load_factor(time_years: numpy.ndarray, time_fpy: numpy.ndarray) float
Finds peak slope in fpy as a function of calendar years Divides implicitly by slightly less than a year
- Parameters:
time_years (numpy.ndarray) – The time signal [calendar years]
time_fpy (numpy.ndarray) – The time signal [fpy]
- Returns:
The maximum load factor in the time signal (over a one year period)
- Return type:
float
- bluemira.fuel_cycle.tools.legal_limit(max_load_factor: float, fb: float, m_gas: float, eta_f: float, eta_fuel_pump: float, f_dir: float, f_exh_split: float, f_detrit_split: float, f_terscwps: float, TBR: float, mb: float | None = None, p_fus: float | None = None) float
Calculates the release rate of T from the model TFV cycle in kg/yr.
\(A_{max}\Bigg[\Big[\dot{m_{b}}\Big((\frac{1}{f_{b}}-1)+ (1-{\eta}_{f_{pump}})(1-{\eta}_{f})\frac{1}{f_{b}{\eta}_{f}}\Big)+ \dot{m_{gas}}\Big](1-f_{DIR})(1-f_{tfv})(1-f_{detrit})+\dot{m_{b}} \Lambda f_{TERSCWPS}\Bigg]\times365\times24\times3600\)
Where:
\(\dot{m_{b}} = \frac{P_{fus}[MW]M_{T}[g/mol]} {17.58 [MeV]eV[J]N_{A}[1/mol]} [g/s]\)
- Parameters:
m_gas (float) – mass of gas flow [kg/s]
mb (float | None) – tritium inventory gross burn rate [kg/s]
p_fus (float | None) – fusion power [W]
dimensionless (All other parameters are)
max_load_factor (float)
fb (float)
eta_f (float)
eta_fuel_pump (float)
f_dir (float)
f_exh_split (float)
f_detrit_split (float)
f_terscwps (float)
TBR (float)
- Returns:
release rate of T [kg/yr]
- Return type:
legal_limit
- Raises:
FuelCycleError – Fusion power or burn rate must be specified
- bluemira.fuel_cycle.tools._dec_I_mdot(inventory: float, eta: float, m_dot: float, t_in: float, t_out: float) float
Analytical value of series expansion for an inventory I with a incoming flux of tritium (kg/yr).
\(I_{end} = Ie^{-{\lambda}{\Delta}t}+{\eta}\dot{m}\sum_{t=0}^{{\Delta}t}e^{-\lambda(T-t)}\)
\(I_{end} = Ie^{-{\lambda}{\Delta}t}+{\eta}\dot{m}\dfrac{e^{-{\lambda}T}\big(e^{{\lambda}({\Delta}t+1/2)}-1\big)}{e^{\lambda}-1}\)
- Returns:
output inventory
- Raises:
ValueError – Output inventory < 0
- Parameters:
inventory (float)
eta (float)
m_dot (float)
t_in (float)
t_out (float)
- Return type:
float
- bluemira.fuel_cycle.tools._timestep_decay(flux: float, dt: float) float
Analytical value of series expansion for an in-flux of tritium over a time- step. Accounts for decay during the timestep only.
\(I_{end} = I\dfrac{e^{-{\lambda}T}\big(e^{{\lambda}({\Delta}t+1)}-1\big)}{e^{\lambda}-1}\)
- Parameters:
flux (float) – The total inventory flowing through on a given time-step [kg]
dt (float) – The time-step [years]
- Returns:
The value of the total inventory which decayed over the time-step.
- Return type:
float
- bluemira.fuel_cycle.tools._find_t15(inventory: float, eta: float, m_flow: float, t_in: float, t_out: float, inventory_limit: float) float
Inter-timestep method solving for dt in the below equality:
\(Ie^{\lambda{\Delta}t}+{\eta}\dot{m}\dfrac{e^{-{\lambda}{\Delta}t} \big(e^{{\lambda}({\Delta}t+1/2)}-1\big)}{e^{\lambda}-1}=I_{lim}\)
\({\Delta}t=\dfrac{ln\bigg(\dfrac{Ie^{\lambda}-I-{\eta}\dot{m}} {I_{lim}e^{{\lambda}}-I_{lim}-{\eta}\dot{m}e^{\lambda/2}}\bigg)}{\lambda}\)
- Returns:
dt relative to t_in of crossing point
- Parameters:
inventory (float)
eta (float)
m_flow (float)
t_in (float)
t_out (float)
inventory_limit (float)
- Return type:
float
- bluemira.fuel_cycle.tools._fountain_linear_sink(m_flow: float, t_in: float, t_out: float, inventory: float, fs: float, max_inventory: float, min_inventory: float, sum_in: float, decayed: float) tuple[float, float, float, float]
A simple linear fountain tritium retention sink model between a minimum and a maximum. Used over a time-step.
- Parameters:
m_flow (float) – The in-flow of tritium [kg/s]
t_in (float) – The first point in the time-step [years]
t_out (float) – The second point in the time-step [years]
inventory (float) – The inventory of tritium already in the sink [kg]
fs (float) – The tritium release rate of the sink (1-absorbtion rate)
max_inventory (float) – The threshold inventory of the sink at which point it saturates
min_inventory (float) – The minimum inventory required for the system to release tritium
sum_in (float) – Accountancy parameter to calculate the total value lost to a sink
decayed (float) – Accountancy parameter to calculate the total value of decayed T in a sink
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
- Raises:
ValueError – Undefined behaviour for inventory > maximum Outflow greater than inflow Negative inventory Negative outflow
- Return type:
tuple[float, float, float, float]
- bluemira.fuel_cycle.tools._linear_thresh_sink(m_flow: float, t_in: float, t_out: float, inventory: float, fs: float, max_inventory: float, sum_in: float, decayed: float) tuple[float, float, float, float]
A simple linear tritium retention sink model. Used over a time-step.
- Parameters:
m_flow (float) – The in-flow of tritium [kg/s]
t_in (float) – The first point in the time-step [years]
t_out (float) – The second point in the time-step [years]
inventory (float) – The inventory of tritium already in the sink [kg]
fs (float) – The tritium release rate of the sink (1-absorbtion rate)
max_inventory (float) – The threshold inventory of the sink at which point it saturates
sum_in (float) – Accountancy parameter to calculate the total value lost to a sink
decayed (float) – Accountancy parameter to calculate the total value of decayed T in a sink
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
- Return type:
tuple[float, float, float, float]
- bluemira.fuel_cycle.tools._sqrt_thresh_sink(m_flow: float, t_in: float, t_out: float, inventory: float, factor: float, max_inventory: float, sum_in: float, decayed: float, *, _testing: bool) tuple[float, float, float, float]
A simple sqrt tritium retention sink model. Used over a time-step.
- Parameters:
m_flow (float) – The in-flow of tritium [kg/s]
t_in (float) – The first point in the time-step [years]
t_out (float) – The second point in the time-step [years]
inventory (float) – The inventory of tritium already in the sink [kg]
factor (float) – The multiplication factor of the sqrt function
max_inventory (float) – The threshold inventory of the sink at which point it saturates
sum_in (float) – Accountancy parameter to calculate the total value lost to a sink
decayed (float) – Accountancy parameter to calculate the total value of decayed T in a sink
_testing (bool)
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
- Return type:
tuple[float, float, float, float]
Notes
\(I_{sequestered} = factor \times \sqrt{ t_{fpy}}\)
The time in the equation is sub-planted for the inventory, to make the retention model independent of time.
The values for the threshold and factor must be obtained from detailed T retention modelling.
Here, we’re tacking the growth of the inventory to a function, but decay is not accounted for in this function. We have to add decay in the sink and ensure this is handled when calculation the absorbtion and out-flow.
- bluemira.fuel_cycle.tools.linear_bathtub(flow: numpy.ndarray, t: numpy.ndarray, eta: float, bci: int, max_inventory: float) tuple[numpy.ndarray, numpy.ndarray, float, float]
Bathtub sink model.
- Parameters:
flow (numpy.ndarray) – The vector of flow-rates [kg/s]
t (numpy.ndarray) – The time vector [years]
eta (float) – The bathtub tritium release fraction
bci (int) – The blanket change index. Used if a component is replaced to reset the inventory to 0.
max_inventory (float) – The threshold inventory for the bathtub.
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
- Return type:
tuple[numpy.ndarray, numpy.ndarray, float, float]
- bluemira.fuel_cycle.tools.sqrt_bathtub(flow: numpy.ndarray, t: numpy.ndarray, factor: float, bci: int, max_inventory: float, *, _testing: bool = False) tuple[numpy.ndarray, numpy.ndarray, float, float]
Bathtub sink model with a sqrt inventory retention law.
- Parameters:
flow (numpy.ndarray) – The vector of flow-rates [kg/s]
bci (int) – The blanket change index. Used if a component is replaced to reset the inventory to 0.
t (numpy.ndarray) – The time vector [years]
factor (float) – The sqrt model multiplication factor
max_inventory (float) – The threshold inventory for the bathtub.
_testing (bool) – Used for testing purposes only (switches off decay).
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
- Return type:
tuple[numpy.ndarray, numpy.ndarray, float, float]
- bluemira.fuel_cycle.tools.fountain_bathtub(flow: numpy.ndarray, t: numpy.ndarray, fs: float, max_inventory: float, min_inventory: float) tuple[numpy.ndarray, numpy.ndarray, float, float]
A fountain and bathtub sink simultaneously.
- Parameters:
flow (numpy.ndarray) – Tritium flow through system [kg/s]
t (numpy.ndarray) – Time [years]
fs (float) – efficiency of bathtub
min_inventory (float) – Minimum T inventory for system to operate [kg]
max_inventory (float) – Maximum T inventory for system to operate [kg]
- Returns:
m_out – The out-flow of tritium [kg/s]
inventory – The amount of tritium in the sink [kg]
sum_in – Accountancy parameter to calculate the total value lost to a sink
decayed – Accountancy parameter to calculate the total value of decayed T in a sink
\(dt = t[i]-t[i-1]\)
\(I[i] = I[i-1]e^{-ln(2)dt/t_{1/2}}\)
- if \(I < I_{min}\):
\(I[i] += m_{T_{flow}}dt\)
\(m_{T_{flowout}} = 0\)
- if \(I >= I_{max}\):
\(I[i] = I_{max}\)
\(m_{T_{flowout}} = m_{T_{flow}}\)
- if \(I < I_{max}\):
\(m_{T_{flowout}} = {\eta}m_{T_{flow}}\)
\(I += (1-{\eta})m_{T_{flow}}dt\)
- Return type:
tuple[numpy.ndarray, numpy.ndarray, float, float]