Toy problem
[1]:
# import external modules
import sys
import os
import numpy as np
from matplotlib import rc
# add "coreutils" directories to path
sys.path.append(os.path.abspath('../../../../../'))
from coreutils.core.Core import Core
from coreutils.core.plot import RadialGeomPlot, AxialGeomPlot
import matplotlib as mpl
mpl.rcParams['figure.dpi']= 200 # set dpi for increasing plot rendering quality
rc('font', **{'family': 'sans-serif', 'sans-serif': ['Arial']})
rc('text', usetex=True)
# input file name and location
try:
os.chdir("ALFRED")
except FileNotFoundError: # patch for Linux systems
pass
filepath = os.path.join("input.json")
alfred = Core(filepath)
SERPENT Serpent 2.1.30 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_1073_Tc_1073_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
SERPENT Serpent 2.1.29 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_1073_Tc_673_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
SERPENT Serpent 2.1.29 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_1473_Tc_1073_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
SERPENT Serpent 2.1.30 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_1473_Tc_1473_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
SERPENT Serpent 2.1.30 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_1473_Tc_673_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
SERPENT Serpent 2.1.30 found in C:\Users\39346\Documents\mycodes\coreutils\docs\NEdata\ALFRED-FC_Tf_673_Tc_673_res.m, but version 2.1.31 is defined in settings
Attemping to read anyway. Please report strange behaviors/failures to developers.
The content of the “input.json” file is the following:
{ "NE" : { "filename" : "ALFRED_1_6_NE.txt", "pitch" : 17.1, "shape" : "H", "rotation" : 60, "assemblynames" : ["IF", "OF", "CR", "SR", "DR", "BA", "EL"], "fren" : true, "NEdata" : { "path" : "./docs/NEdata", "beginwith" : ["ALFRED-FC", "ALFRED-CC"] }, "replace" : { "SR": [92, 326, 237, 3] }, "cuts" : { "IF" : [["IF_BOT_REF", 0, 79], ["IF_BOT_PLUG", 79, 84], ["IF_PLEN", 84, 139], ["IF_BOT_INS", 139, 140], ["INN_FUEL", 140, 200], ["IF_TOP_INS", 200, 201], ["IF_SPRING", 201, 213], ["IF_TOP_PLUG", 213, 218], ["IF_TOP_REF", 218, 340]], "OF" : [["OF_BOT_REF", 0, 79], ["OF_BOT_PLUG", 79, 84], ["OF_PLEN", 84, 139], ["OF_BOT_INS", 139, 140], ["OUT_FUEL", 140, 200], ["OF_TOP_INS", 200, 201], ["OF_SPRING", 201, 213], ["OF_TOP_PLUG", 213, 218], ["OF_TOP_REF", 218, 340]], "CR" : [["CR_BOT_REF", 0, 62], ["CR_BOT_PLUG", 62, 67], ["CR_BOT_INS", 67, 68], ["CR_ACT", 68, 136], ["CR_DUMM", 136, 204], ["CR_SPRING", 204, 264], ["CR_TOP_REF", 264, 340]], "SR" : [["SR_BOT_REF", 0, 207], ["SR_BOT_PLUG", 207, 212], ["SR_ACT", 212, 236], ["SR_TOP_INS", 236, 237], ["SR_SPRING", 237, 307], ["SR_TOP_REF", 307, 340]], "DR" : [["DR_BOT_REF", 0, 79], ["DR_BOT_PLUG", 79, 84], ["DR_DUMM", 84, 201], ["DR_SPRING", 201, 213], ["DR_TOP_PLUG", 213, 218], ["DR_TOP_REF", 218, 340]], "BA" : [["BA", 0, 340]], "EL" : [["ll", 0, 340]] }, "zcuts" : [0, 68, 84, 136, 140, 200, 212, 264, 296, 340], "config" : { "5.4" : { "translate" : { "which" : [[92, 326], [237, 3]], "dz" : [-68, -68] }, "perturb" : { "which" : [[1, 2], [4, 5]], "what" : ["IF_BOT_REF", "IF_BOT_REF"], "with" : ["OF_BOT_REF", "IF_TOP_REF"] } }, "9" : { "perturb" : { "which" : [[80, 158], [4, 5]], "what" : ["IF_BOT_REF", "IF_TOP_REF"], "with" : ["IF_TOP_REF", "IF_BOT_REF"] } } }, "label" : {"IF_TOP_REF": "TR", "IF_TOP_PLUG": "PU", "IF_SPRING": "SP", "IF_TOP_INS" : "TI", "INN_FUEL" : "IF", "IF_BOT_INS" : "BI", "IF_PLEN" : "PL", "IF_BOT_PLUG" : "PU", "IF_BOT_REF" : "BR", "OF_TOP_REF": "TR", "OF_TOP_PLUG": "PU", "OF_SPRING": "SP", "OF_TOP_INS" : "TI", "OUT_FUEL" : "OF", "OF_BOT_INS" : "BI", "OF_PLEN" : "PL", "OF_BOT_PLUG" : "PU", "OF_BOT_REF" : "BR", "CR_TOP_REF" : "TR", "CR_SPRING" : "SP", "CR_DUMM" : "CD", "CR_ACT" : "CA", "CR_BOT_INS" : "BI", "CR_BOT_PLUG" : "PU", "CR_BOT_REF" : "BR", "DR_TOP_REF" : "TR", "DR_TOP_PLUG" : "PU", "SR_BOT_REF" : "BR", "SR_BOT_PLUG" : "PU", "SR_ACT" : "SR", "SR_TOP_INS" : "TI", "SR_SPRING" : "SP", "SR_TOP_REF" : "TR", "DR_SPRING" : "SP", "DR_DUMM" : "DE", "DR_BOT_PLUG" : "PU", "DR_BOT_REF" : "BR", "BA" : "BA", "ll" : "Pb"} }, "TH" : { "coolingzonefile" : "ALFRED_1_6_CZ.txt", "pitch" : 17.1, "shape" : "H", "rotation" : 60, "massflowrates" : [172.3, 145.2, 117.5, 93.4, 261, 143, 0.1], "temperatures" : [673, 673, 673, 673, 673, 673, 673], "pressures" : [2E+5, 2E+5, 2E+5, 2E+5, 2E+5, 2E+5, 2E+5], "coolingzonenames" : ["Z1", "Z2", "Z3", "Z4", "CR", "RE", "ST"], "fren" : true, "THdata" : { "filename" : "ALFRED_1_6_TH.txt", "assemblynames" : ["IF", "OF", "CR", "SR", "DR", "BA", "EL"], "replace" : { "SR": [92, 326, 237, 3] } }, "replace" : { "CR": [3, 28, 45, 92, 106, 123, 184, 201, 237, 262, 279, 326, 340, 357, 418, 435] }, "boundaryconditions" : { "5.4" : { "which" : [[1, 2], [4, 5]], "what" : ["massflowrates", "temperatures"], "with" : [300, 520] } } } }[2]:
# plot core radial configuration
print(alfred.NEtime)
for t in alfred.NEtime:
RadialGeomPlot(alfred, time=t, label=True, fren=True, whichconf="NEconfig", title="t=%.1f s" % t)
[0, 5.4, 9.0]
[3]:
# Do you want to save some core assemblies with the Serpent numbering?
ass = np.arange(1,80)
RadialGeomPlot(alfred, which=ass, time=0, label=True, figname="alfred_t0_sextI_serpnum.png",
fren=True, fontsize=8, whichconf="NEconfig")
[4]:
# select assembly numbers (FRENETIC numeration) to be plotted
ass = np.concatenate([np.arange(247, 235, -1), np.arange(1, 14)])
# plot core Axial configuration
for t in alfred.NEtime:
AxialGeomPlot(alfred, ass, time=t, fren=True, zcuts=True, title="t=%.1f s" % t)
[5]:
# Do you want custom labels? Just define them using a python dictionary
asslabel = alfred.NEassemblytypes
print(asslabel)
# plot with customised assembly labels
RadialGeomPlot(alfred, label=True, dictname=asslabel, time=0, fren=True, whichconf="NEconfig") # specify figname to save the figure
OrderedDict([(1, 'IF'), (2, 'OF'), (3, 'CR'), (4, 'SR'), (5, 'DR'), (6, 'BA'), (7, 'EL'), (8, 'SRt5.4z-68'), (9, 'IF_t5.4_p1'), (10, 'IF_t5.4_p2'), (11, 'IF_t9_p1'), (12, 'IF_t9_p2')])
[6]:
# Do you want to print it to a file? You can do it
# MODE 1 (Serpent-style)
alfred.writecorelattice(fname="serpent_lattice.txt", serpheader=True, whichconf="NEconfig")
# print file content
f = open('serpent_lattice.txt', 'r')
file = f.read()
print(file)
# MODE 2 (core flattened in a 1D array)
alfred.writecorelattice(flatten=True) # file saved with default name "coremap.txt"
lat core 3 0.0 0.0 32 32 17.1
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV EL EL EL EL EL EL EL EL EL EL EL EL EL VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV EL EL EL EL BA BA BA BA BA BA EL EL EL EL VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV EL EL EL BA BA DR DR DR DR DR BA BA EL EL EL VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV EL EL BA BA DR DR DR DR DR DR DR DR BA BA EL EL VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV EL BA BA DR DR DR DR OF OF OF DR DR DR DR BA BA EL VV VV VV VV
VV VV VV VV VV VV VV VV VV VV EL BA DR DR DR OF OF OF OF OF OF OF OF DR DR DR BA EL VV VV VV VV
VV VV VV VV VV VV VV VV VV EL BA DR DR DR OF OF OF CR OF CR OF OF OF DR DR DR BA EL VV VV VV VV
VV VV VV VV VV VV VV VV EL BA DR DR OF OF OF OF OF OF OF OF OF OF OF OF DR DR BA EL VV VV VV VV
VV VV VV VV VV VV VV EL BA DR DR OF OF CR OF IF IF IF IF IF OF CR OF OF DR DR BA EL VV VV VV VV
VV VV VV VV VV VV EL BA DR DR OF OF OF OF IF IF IF IF IF IF OF OF OF OF DR DR BA EL VV VV VV VV
VV VV VV VV VV EL EL BA DR DR OF CR OF IF IF SR IF IF IF IF OF CR OF DR DR BA EL EL VV VV VV VV
VV VV VV VV EL EL BA DR DR OF OF OF IF IF IF IF IF SR IF IF OF OF OF DR DR BA EL EL VV VV VV VV
VV VV VV EL EL EL BA DR OF OF OF IF IF IF IF IF IF IF IF IF OF OF OF DR BA EL EL EL VV VV VV VV
VV VV VV EL EL BA DR DR OF OF OF IF IF SR IF IF IF IF IF OF OF OF DR DR BA EL EL VV VV VV VV VV
VV VV VV EL EL BA DR DR OF CR OF IF IF IF IF SR IF IF OF CR OF DR DR BA EL EL VV VV VV VV VV VV
VV VV VV EL BA DR DR OF OF OF OF IF IF IF IF IF IF OF OF OF OF DR DR BA EL VV VV VV VV VV VV VV
VV VV VV EL BA DR DR OF OF CR OF IF IF IF IF IF OF CR OF OF DR DR BA EL VV VV VV VV VV VV VV VV
VV VV VV EL BA DR DR OF OF OF OF OF OF OF OF OF OF OF OF DR DR BA EL VV VV VV VV VV VV VV VV VV
VV VV VV EL BA DR DR DR OF OF OF CR OF CR OF OF OF DR DR DR BA EL VV VV VV VV VV VV VV VV VV VV
VV VV VV EL BA DR DR DR OF OF OF OF OF OF OF OF DR DR DR BA EL VV VV VV VV VV VV VV VV VV VV VV
VV VV VV EL BA BA DR DR DR DR OF OF OF DR DR DR DR BA BA EL VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV EL EL BA BA DR DR DR DR DR DR DR DR BA BA EL EL VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV EL EL EL BA BA DR DR DR DR DR BA BA EL EL EL VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV EL EL EL EL BA BA BA BA BA BA EL EL EL EL VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV EL EL EL EL EL EL EL EL EL EL EL EL EL VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV
[7]:
# Do you want to print assembly type and center coordinates?
alfred.writecentermap() # type, x [cm], y [cm]
# print file content
f = open('centermap.txt', 'r')
file = f.read()
print(file[0:100])
496 0.000000 0.000000
528 17.100000 0.000000
560 34.200000 0.000000
592 51.300000 0.000000
624 68.40
Now, let’s plot the Cooling Zone configurations. Please note that the AxialGeomPlot is available only for NEutronic configurations.
[8]:
# plot core radial configuration
print(alfred.CZtime)
for t in alfred.CZtime:
RadialGeomPlot(alfred, time=t, label=True, fren=True, whichconf="CZconfig", title="CZ @ t=%.1f s" % t)
[0, 7.6]
[9]:
# plot core radial configuration
RadialGeomPlot(alfred, label=True, fren=True, whichconf="THconfig", title="TH @ t=0 s")