scale.olm.contrib

Module for contributed code that doesn’t fit in the other places.

Everything should have doctests.

change_plot_font_size(ax, fontsize=14)[source]

Change the plot font size.

parse_sfcompo_operating_history(input)[source]

Parse the operating history format in SFCOMPO.

Parameters:

input – Either text or an open file an SFCOMPO operating history file.

Returns:

Elapsed time in days. burnup (list[float]): Cumulative burnup in MWd/MTIHM. burnup_std (list[float]): Standard deviation of cumulative burnup.

Return type:

time (list[float])

Examples

Initialize with sample data. Usually this data would come from reading a file.

>>> text='''Elapsed days;Value;Point type;Uncertainty (%);Sigma
... 0;0 MW*d/tUi;HISTOGRAM;0;0
... 6.3;188.06 MW*d/tUi;HISTOGRAM;5.0;9.403
... 18.33;567.33 MW*d/tUi;HISTOGRAM;7;39.713
... 39.87;1246.44 MW*d/tUi;HISTOGRAM;8;99.715'''
>>> time,burnup,burnup_std = parse_sfcompo_operating_history(text)
>>> time
[0.0, 6.3, 18.33, 39.87]
>>> burnup
[0.0, 188.06, 567.33, 1246.44]
>>> burnup_std
[0.0, 9.403, 39.713, 99.715]

Initialize from a file.

>>> from scale.olm.core import TempDir
>>> td = TempDir()
>>> op = 'operating_history.txt'
>>> path = td.write_file(text,op)
>>> with open(path, 'r') as f:
...     time,burnup,burnup_std = parse_sfcompo_operating_history(f)
>>> time
[0.0, 6.3, 18.33, 39.87]
>>> burnup
[0.0, 188.06, 567.33, 1246.44]
>>> burnup_std
[0.0, 9.403, 39.713, 99.715]
sfcompo_guess_initial_mox(fiss_pu_frac, pu_frac, density=10.4, relmin=0.7, u235=0.231, am241=0.0, nbins=10, plot=False, comp_fun=ValidateCallWrapper(<function mox_ornltm2003_2>))[source]

Generate an initial mox guess based on what SFCOMPO lists.

SFCOMPO lists the fissile Pu fraction and the Pu fraction. SCALE builds an interpolation just based on the Pu-239 fraction. This function takes what SFCOMPO has and builds an interpolatable conversion factor from a passed in MOX composition generator function. Setting plot=True may be useful to understand visually.

The target composition is passed back using the same function.

Examples

Search for fissile pu of 72.3% and pu fraction of 7.0%.

>>> x = sfcompo_guess_initial_mox(fiss_pu_frac=72.3, pu_frac=7.0)
>>> "{:.2f}".format(x['info']['pu_frac'])
'7.00'
>>> "{:.2f}".format(x['info']['pu239_frac'])
'66.08'
>>> "{:.2f}".format(x['info']['fiss_pu_frac'])
'72.30'

Check error is less than 0.01%.

>>> abs(x['info']['fiss_pu_frac']/72.3-1)<1e-4
True

Here is an example with plotting turned on.

import scale.olm.contrib as contrib
x = contrib.sfcompo_guess_initial_mox(fiss_pu_frac=72.3, pu_frac=7.0, plot=True)

(png, hires.png, pdf)

../_images/contrib-1.png