Copyright (c) 2017-2020 Serpent-Tools developer team, GTRC
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Data files are not included with the python package, but can be downloaded from the GitHub repository. For this tutorial, the files are placed in the directory identified with the SERPENT_TOOLS_DATA
environment variable.
In [1]:
%matplotlib inline
In [2]:
import os
mtxFile = os.path.join(
os.environ["SERPENT_TOOLS_DATA"],
"depmtx_ref.m")
The serpentTools
package supports reading depletion matrix files, generated when set depmtx 1
is added to the input file.
As of SERPENT
2.1.30, these files contain
1. The length of time for a depletion interval
2. Vector of initial concentrations for all isotopes present in the depletion problem
3. ZAI vector
4. Depletion matrix
5. Vector of final concentrations following one depletion event.
Files such as this are present for each burnable material tracked by SERPENT
and at each time step in the problem.
This document will demonstrate the DepmtxReader
, designed to store these arrays.
NOTE The depletion matrices can be very large for many problems, ~1000 x 1000 elements. For this end, the DepmtxReader
can store the matrices in Compressed Sparse Column csc_matrix
form or as full numpy
arrays. The reader will use the sparse format if scipy
is installed unless told not to directly.
In [3]:
import serpentTools
In [4]:
reader = serpentTools.read(mtxFile)
In [5]:
reader
Out[5]:
We have access to all the data present in the file directly on the reader.
In [6]:
reader.n0
Out[6]:
This input file did not include fission yield libraries for depletion in order to reduce the size of the depletion matrix from ~1000 x 1000 to 74 x 74.
Number densities and quantities in the depletion matrix are stored as longfloat
types, as they contain many signifiicant digits in the output files.
In [7]:
reader.zai
Out[7]:
One can easily check if the depletion matrix is sparse by using the sparse
attribute on the reader
In [8]:
reader.sparse
Out[8]:
In [9]:
reader.depmtx
Out[9]:
A simple plot method can be used to plot initial concentrations, final concentrations, or both.
In [10]:
reader.plotDensity()
Out[10]:
Some options can be passed to improve the look and feel of the plot
In [11]:
reader.plotDensity(
what='n0', # plot initial value
markers='>', # marker for scatter plot
labels='$N_0$', # labels for each entry plotted
ylim=1E-30, # set the lower y-axis limit
)
Out[11]:
We can see that there is not a lot of change in the isotopic concentration in this depletion step. Furthermore, the classical fission yield curves are not present due to the lack of fission yield data. Using a more complete dataset, one can view the distribution of fission products like below.