External transfer rates source term
Description
This is a follow up of the recent TransfeRates, adding a further external source term $S$ to the depletion solver:
$$\frac{dn_i(t)}{dt} = \sum_j \gamma_{j\rightarrow i} n_j\overline{\sigma_j\phi} - n_i \overline{\sigma_i \phi} + \sum_j \gamma_{j\rightarrow i} n_j\lambda_{i\rightarrow j} + \lambda_{j\rightarrow i}n_i - \epsilon_i \lambda_i n_i + S_i$$
The linear system can be easily homogenized adding the source vector to the Bateman matrix and a dummy nuclide vector as such:
$$Ax+s = \tilde{A}\tilde{x} = \begin{bmatrix}
a_{1,1} & \cdots & a_{1,n} & S_1\
\vdots & \ddots & \vdots & \vdots\
a_{n,1} & \cdots & a_{n,n} & S_n\
0 & 0 & 0 & 0\
\end{bmatrix}
\begin{bmatrix}
x_1\
\vdots\
x_n\
1 \end{bmatrix}$$
For reference see: Isotalo et al
This allows to input feed or removal fixed source rate during a depletion run, similar to the ORIGEN module of SCALE.
To set an external source rate, similar to a transfer rate, one can simply add to an integrator instance, as such:
integrator.add_external_source_rate('fuel', {'U235':1}, 1.0, external_source_rate_units='g/s', timesteps=None)
with default units: $grams/sec$
In the same PR I've also included a time-dependency, both to this and TransferRates, allowing to specify specific depletion time-steps where to activate these modeling, adding a timesteps argument to the setter functions.
Verification
As a simple verification I've compared with a depletion case, where I manually modify the material composition between two depletion steps:
Checklist
- [x] I have performed a self-review of my own code
- [ ] I have run clang-format (version 15) on any C++ source files (if applicable)
- [x] I have followed the style guidelines for Python source files (if applicable)
- [ ] I have made corresponding changes to the documentation (if applicable)
- [x] I have added tests that prove my fix is effective or that my feature works (if applicable)