Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start of documentation and example scripts #1

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
4c3e275
PDE comparison with ODE
LukeSeifert Jan 16, 2024
752af84
Added gif generation
LukeSeifert Jan 16, 2024
5b32b81
FIxes to flow rate and added 135 isobar example MSRE solve
LukeSeifert Jan 17, 2024
8fbfed1
readme update on spacial source and loss in-core
LukeSeifert Jan 17, 2024
a92bb1f
README in-core ex-core ratios
LukeSeifert Jan 17, 2024
89f5230
Added docstring for ODE solve
LukeSeifert Jan 17, 2024
ecf56d9
Renamed file; updated structure of isobar solve
LukeSeifert Jan 17, 2024
4799c68
Added gif creation to isobar script
LukeSeifert Jan 17, 2024
1908413
Fixed comparison script gif and shifted input locations
LukeSeifert Jan 17, 2024
6f8d9b8
Updated readme
LukeSeifert Jan 23, 2024
e99f814
Cleaned up doc strings
LukeSeifert Jan 23, 2024
0a69d04
pep8 changes
LukeSeifert Jan 23, 2024
ec21fd0
autopep8
LukeSeifert Jan 23, 2024
4808a2e
pep8 changes
LukeSeifert Jan 23, 2024
fe39077
autopep8
LukeSeifert Jan 23, 2024
bbdd7c4
Added more options to MORTY scripts
LukeSeifert Mar 5, 2024
2dbfee1
Added theory document
LukeSeifert Mar 5, 2024
6e42e32
Typo fix
LukeSeifert Mar 5, 2024
196c03e
Updated transfer rate approach docs
LukeSeifert Mar 17, 2024
e5c15dd
Updated theory with PDE slicing method
LukeSeifert Mar 17, 2024
853a84c
Updated readme
LukeSeifert Mar 17, 2024
8188c4c
pep8 fixes
LukeSeifert Mar 18, 2024
58d0c9d
pep8 fixes
LukeSeifert Mar 18, 2024
ee11aa5
pep8 fix
LukeSeifert Mar 18, 2024
3f468cf
Added openmc dependent version
LukeSeifert Mar 20, 2024
3854f0e
Added OpenMC data and initial work on automating data
LukeSeifert Mar 20, 2024
b06e03c
Added cross section generation
LukeSeifert Mar 25, 2024
e227a4a
Integrated OpenMC data into solve
LukeSeifert Mar 25, 2024
dc6338d
Bug fixes
LukeSeifert Mar 25, 2024
4f8c88b
Updated ODE solve and added plotting
LukeSeifert Mar 28, 2024
c0ce728
Fixed missing self
LukeSeifert Mar 28, 2024
a02a22d
Fixed other occurances of typo
LukeSeifert Mar 28, 2024
cb66c50
Added nuclide refinement study
LukeSeifert Mar 28, 2024
f0f7821
Bug fixes
LukeSeifert Mar 28, 2024
9bdc92b
Removed averaging from format spatial
LukeSeifert Apr 4, 2024
3f1031a
Bug fix ODE
LukeSeifert Apr 4, 2024
20c76e3
Added parasitic absorption plotting
LukeSeifert Apr 15, 2024
a689a0c
Fixed units on parasitic absorption plotting
LukeSeifert Apr 15, 2024
78dc566
Removed vol2 in denominator
LukeSeifert Apr 15, 2024
28362ff
Refactor progress, added solvers file
LukeSeifert Apr 16, 2024
706f7f9
Further work on refactoring scripts
LukeSeifert Apr 16, 2024
0310823
Added missing data to scripts
LukeSeifert Apr 16, 2024
84348df
Added more functionality
LukeSeifert Apr 18, 2024
9b2aafc
Added analysis file
LukeSeifert Apr 18, 2024
6362948
Fixed excore outlet position
LukeSeifert Apr 23, 2024
2d8ab44
Bug fixes
LukeSeifert Apr 25, 2024
07888e0
Bug fixes and feature updates
LukeSeifert Apr 25, 2024
9b85e77
Added printing of results
LukeSeifert Apr 25, 2024
4bcd7c4
Fixed units in fission rate
LukeSeifert Apr 25, 2024
a1e084a
Fixed bug in units and solver
LukeSeifert Apr 29, 2024
1e9fd95
Added gif creation
LukeSeifert Apr 30, 2024
ed06b6a
debugging parasitic absorption
LukeSeifert Apr 30, 2024
ee2bbc1
Updated plotting functionality
LukeSeifert May 2, 2024
cf1af3d
cleaned up doc strings
LukeSeifert May 2, 2024
2b32622
fixed docstrings
LukeSeifert May 2, 2024
f519a65
cleaned up docstrings
LukeSeifert May 2, 2024
b139108
autopep8
LukeSeifert May 2, 2024
dc39036
pep8 fixes
LukeSeifert May 2, 2024
2665ff0
pep8 fixes
LukeSeifert May 2, 2024
65d60b5
pep8 fixes
LukeSeifert May 2, 2024
ab18583
Removed old files and add new theory file
LukeSeifert May 2, 2024
4d796bb
readme source fix
LukeSeifert May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# msr-spatial-dep
A collection of scripts associated with investigating spatial effects on molten salt reactor depletion
A collection of scripts associated with investigating spatial effects on molten salt reactor depletion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A collection of scripts associated with investigating spatial effects on molten salt reactor depletion.
A collection of scripts for investigating the spatial effects on molten salt reactor depletion.


## Theory
A brief discussion on the theory associated with this work is given in the `docs` directory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A brief discussion on the theory associated with this work is given in the `docs` directory.
A brief discussion on the theory associated with this work is given in `docs/theory.md`.


## Preliminary Work
Some preliminary work displaying a simplified version is given in the `scripts` directory under the `morty` sub-directory.
This work analyzes single nuclides and five nuclides in the 135 isobar to see the effects of spatial tracking on xenon-135.
Comment on lines +8 to +9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Some preliminary work displaying a simplified version is given in the `scripts` directory under the `morty` sub-directory.
This work analyzes single nuclides and five nuclides in the 135 isobar to see the effects of spatial tracking on xenon-135.
Some preliminary work analyzes spatial tracking for xenon-135 in the 135 isobar for both a single nuclide and five nuclides. This work may be found in `scripts/morty/`.

2,841 changes: 2,841 additions & 0 deletions data/chain_casl_pwr.xml

Large diffs are not rendered by default.

2,841 changes: 2,841 additions & 0 deletions data/chain_casl_sfr.xml

Large diffs are not rendered by default.

30,404 changes: 30,404 additions & 0 deletions data/chain_endfb71_pwr.xml

Large diffs are not rendered by default.

30,404 changes: 30,404 additions & 0 deletions data/chain_endfb71_sfr.xml

Large diffs are not rendered by default.

154 changes: 154 additions & 0 deletions docs/theory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Spatially resolved depletion approaches

## One spatial dimension, uniform velocity profile, loosely coupled depletion
For each nuclide $i$:

$$\frac{\partial N_i(z, t)}{\partial t} + \nu_i(z, t) \frac{\partial N_i(z, t)}{\partial z} = S_i(z, t) - \mu_i(z, t) N_i(z, t)$$

where $N$ is the atom density [$\frac{atoms}{cm^3}$], $t$ is time [$s$], $\nu$ is the linear flow rate [$\frac{cm}{s}$], $z$ is the linear distance travelled [$cm$], $S$ is the production, or source, term [$\frac{atoms}{cm^3 s}$], and $\mu$ is the loss term [$s^-1$].

### Approach - MORTY PDE

In order to reduce computational cost, the MORTY PDE approach looks only at isobars and without the advection loosely coupled to depletion.
The loose depletion coupling means that the terms in the equation can be updated as frequently or infrequently as desired. The problem can be run even without a depletion step (though it may be easier to run with depletion).
OpenMC can generate and output the relevant production and loss rates after a depletion step, which can then be fed into the MORTY PDE solver.

The solver uses upwind in space (backwards) and explicit in time finite differencing to generate a solution. At higher dimensions, a finite element approach would be better. The following equations show the finite difference approach.

$$\frac{\partial N_i(z, t)}{\partial t} + \nu_i(z, t) \frac{\partial N_i(z, t)}{\partial z} = S_i(z, t) - \mu_i(z, t) N_i(z, t)$$

Removing $i$ subscript for readability and applying finite differencing in space ($k$) and time ($l$).

$$\frac{N_{k, l+1} - N_{k, l}}{\Delta t} + \nu_{k, l} \frac{N_{k, l} - N_{k-1, l}}{\Delta z} = S_{k, l} - \mu_{k, l} N_{k, l}$$


$$N_{k, l+1} = N_{k, l} + \Delta t \left( S_{k, l} - \mu_{k, l} N_{k, l} - \nu_{k, l} \frac{N_{k, l} - N_{k-1, l}}{\Delta z} \right)$$



MORTY PDE runs this iteratively each time step five times by first updating the source terms for each nuclide in the isobar (since they decay into each other) and then calculating the concentration at that time step.

The level of fidelity of the source and loss terms can vary depending on the fidelity of the neutronics solve. At the lowest level, two regions can be used: in-core (in the neutronics solve) and ex-core (decay only).



## One spatial dimension, uniform velocity profile, tightly coupled predictor depletion

The general equation used in depletion calculations is:

$$\frac{dn}{dt} = An$$

Where $n$ is a vector of nuclide concentrations (~2000-by-1) and $A$ is a square depletion matrix (~2000-by-2000) containing the source and loss terms for each nuclide.

Assuming that $A$ is constant over the time step $h$ (the "predictor" depletion method), Euler's method can be used:

$$n_{l+1} = n_l e^{A_l h}$$

Including a single spatial dimension with advection changes the depletion equation to:

$$\frac{\partial n}{\partial t} + \nu \frac{\partial n}{\partial z} = An$$

Applying finite differencing spatially:

$$\frac{\partial n_k}{\partial t} = A_k n_k - \frac{\nu}{\Delta z} (n_{k-1} - n_k)$$

Grouping $n_k$ together:

$$\frac{\partial n_k}{\partial t} = \left( A_k - \frac{\nu}{\Delta z} \right) n_k + \frac{\nu}{\Delta z} n_{k-1}$$

Generating the advective depletion matrix $\hat{A}$:

$$\hat{A}_k = A_k - \frac{\nu}{\Delta z}$$

Plugging in the advective depletion matrix:

$$\frac{\partial n_k}{\partial t} = \hat{A}_k n_k + \frac{\nu}{\Delta z} n_{k-1}$$

Applying Euler method:

$$n_{k, l+1} = n_{k, l} e^{\hat{A}_{k, l} h} + \frac{\nu_{k, l}}{\Delta z} n_{k-1, l}$$

### Approach - Transfer Rates Method

This method takes the "transfer rates" approach from OpenMC for reprocessing and modifies it for advection use.
This approach is useful because implementation should be fairly rapid, and it will provide reasonably accurate results with >3 materials included.
However, the approach requires many materials to have fine spatial resolution, and the cost scales rapidly as the matrix solve grows with the number of materials (simultaneous solve required).

An example with three materials (1, 2, and 3) is given below. Material 1 flows to material 2, 2 to 3, and 3 to 1.


$$
\frac{d}{dt}
\left(\begin{array}{c}
n_1\\
n_2\\
n_3
\end{array}\right)
=
\left(\begin{array}{ccc}
\hat{A}_{1, 1} & 0 & F_{1, 3}\\
F_{2, 1} & \hat{A}_{2, 2} & 0\\
0 & F_{3, 2} & \hat{A}_{3, 3}
\end{array}\right)
\left(\begin{array}{c}
n_1\\
n_2\\
n_3
\end{array}\right)
$$

Where:

$$F_{d, s} = \frac{\nu_{d, s}}{\Delta z},$$

in which $\nu_{d, s}$ is the flow rate from material $s$ to material $d$, and:

$$\hat{A}_{mat, k} = A_{mat, k} - F_{d, s}$$

This is identical to transfer rates, as the $F_{d, s}$ terms are in units of per time, and can thus already be represented in the current version of OpenMC ($d$ represents flow destination, and $s$ is flow source).

Replicating the example from the OpenMC documentation where material 1 flows to material 2:

$$
\frac{d}{dt}
\left(\begin{array}{c}
n_1\\
n_2
\end{array}\right)
=
\left(\begin{array}{cc}
\hat{A}_{1, 1} & 0\\
F_{2, 1} & A_{2, 2}
\end{array}\right)
\left(\begin{array}{c}
n_1\\
n_2
\end{array}\right)
$$

This is the exact same form from the OpenMC documentation, except the transfer rate term, $T_{i, j}$, is represented by $F_{d, s}$.


### Approach - PDE Homogeneous Slicing

This method takes the depletion matrix for each material and uses that in the finite differencing format previously described. This approach will initially be a homogeneous approach, where the depletion matrix will be assumed constant over that entire spatial region. In theory, it is possible to use the transfer rates dictionary to reconstruct a flow path and then approximate how materials fit together to have a more accurate representation of the problem spatially. However, that approach will not be used here.

This approach is useful as it should increase the spatial resolution without requiring a large number of materials, which would increase computational cost more.

The homogeneous approximation yields the following simplification:
$$\hat{A}_k = \hat{A}_{material}$$

Therefore, the equation to solve for each time step (and for each spatial node) is:
$$n_{k, l+1} = n_{k, l} e^{\hat{A}_k h} + h \frac{\nu_k}{\Delta z} n_{k-1, l}$$

The first half of the equation can be solved using CRAM. The second half will then need to be added to the result to properly update the concentration.

For numerical stability, the $\lambda_k$ term *must* be less than 1:
$$\lambda_k = \frac{h \nu_k}{\Delta z}$$

The process for solving the problem with this method is as follows:
1. Run transport to generate the depletion matrices for each material
2. Determine time sub-step based on $\lambda_k$ of 0.9 (specific value needs testing), flow rates, number of spatial nodes, and spatial dimensions provided
3. Step through each time step, and within each time step solve spatially
4. Iterate until the time has reached $h$, or the depletion time step (if the sub-step will be too large, use a smaller value)
5. Loop for new depletion time step, or return
9 changes: 9 additions & 0 deletions scripts/morty/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Overview
These scripts are motivated by the work of Shayan Shahbazi [1].
In general, these scripts give a high-level view of the effects of including a more refined spatial mesh on a traditional depletion simulation.
These scripts assume the existence of two neutronicly distinct regions: in-core and ex-core.
More distinct regions can be added later.
Alternatively, different flux/power profiles can be used.
Currently, a constant flux profile is used.

[1] Shahbazi, Shayan, Paul Romano, Tingzhou Fei, and David Grabaskas. “Steady-State Radiochemical Transport Model of the Molten Salt Reactor Experiment.” Journal of Radioanalytical and Nuclear Chemistry 331, no. 12 (December 1, 2022): 5247–57. https://doi.org/10.1007/s10967-022-08535-3.
Loading