示例#1
0
文件: res_keff.py 项目: inr-kit/pirs2
#
# This file is part of PIRS-2.
#
# PIRS-2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PIRS-2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from pirs.tools.plots import MeshPlotter

dmp = load('results/b_iteration_058.dump')

kkk = MeshPlotter()
kkk.figsize = (8, 4)
kkk.add_line(0, 0, (), 'temp', 0, fmt='.k', label='$k_{eff}$')
kkk.xlabel[0] = 'Iteration index'
kkk.ylabel[0] = '$k_{eff}$'

Keff = dmp['Keff'][2:]
Kerr = dmp['Kerr'][2:]
fig = kkk.figure([range(1, len(Keff) + 1), Keff, Kerr])
fig.savefig('res_keff.pdf')
示例#2
0
# PIRS-2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PIRS-2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from pirs.tools.plots import MeshPlotter

r9 = load('jnter09.dump')['r']
r9i = load('jnter09i.dump')['r']

r9 = r9.get_child((0, 0))
r9i = r9i.get_child((0, 0))

g = MeshPlotter()

# heat
g.add_line(0, 0, (), 'heat', 0, color='r', label='900')
g.add_line(0, 1, (), 'heat', 0, color='k', label='900i')
# differences
g.add_line(1, 2, (), 'heat', 0, color='k', label='900 - 900i')

# axial symmetry
g.add_line(2, 3, (), 'heat', 0, color='r', label='900(z) - 900(-z)')
示例#3
0
if argvc[-1] == 'noplot':
    # only text file will be printed.
    doplot = False
    argvc.pop()
else:
    doplot = True


# Setup plotting  later
ppp = None


for f in argvc:
    if '.dump' in f:
        print 'printing from ', f
        d = load(f)
        Ic = d['Ic']
        kcode = d['kcode']
        sres = d['scf_result']
        mres = d['mcnp_result']
        Rm = d['relaxed']

        prefix = f[:-5]
        if doplot:
            if ppp is None:

                # first, get the proper compound key for the fuel pin to be plotted:
                for c in sres.children:
                    if c.ijk == (Nx, Ny, 0):
                        for cc in c.values():
                            if cc.local_key == 'fuel':
示例#4
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

Extracts scf_result data from dump and put it in a text form.

This needs that version of PIRS is installed, that was used to
generate dupms.

"""
import sys
from pirs.tools import dump, load

dfile = sys.argv[1]

print 'extracting from {}'.format(dfile)

dorig = load(dfile)
sres = dorig['scf_result']

print 'sres extracted'

for c in sres.children.values():
    for cc in c.values():
        if cc.local_key == 'fuel':
            # print c.ijk, cc.material
            print cc.get_key()
            print cc.temp._zmesh__z
            print cc.temp._zmesh__v
            break

            
示例#5
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# set heat meshes
for v in mi.gm.values():
    if v.material == 'fuel':
        v.heat.set_grid([1] * 20)

if __name__ == '__main__':
    mi.wp.prefix = 'm5_'
    mi.run('R', tasks=3)

    from pirs.tools import dump
    dump('m5_.dump', gm=mi.gm)

    from pirs.tools.plots import colormap
    hx1 = colormap(mi.gm, plane={'x': -0.63}, var='heat', aspect='auto')
    hx2 = colormap(mi.gm, plane={'x': 0.63}, var='heat', aspect='auto')
    hy1 = colormap(mi.gm, plane={'y': -0.63}, var='heat', aspect='auto')
    hy2 = colormap(mi.gm, plane={'y': 0.63}, var='heat', aspect='auto')
    hx1.get_figure().savefig('hmcnp5_hx1.pdf')
    hx2.get_figure().savefig('hmcnp5_hx2.pdf')
    hy1.get_figure().savefig('hmcnp5_hy1.pdf')
    hy2.get_figure().savefig('hmcnp5_hy2.pdf')
else:
    from pirs.tools import load
    mi.gm = load('m5_.dump')['gm']
示例#6
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PIRS-2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from pirs.tools import load
from pirs.tools.plots import colormap

dmp = load(argv[1])

sres = dmp['scf_result']

x = -2.5
x = 1.2 
x=0.
z = 1.

a = {}
a['gm'] = colormap(sres, plane={'z':z}, var='material')

a['zh'] = colormap(sres, plane={'z':z}, var='heat', filter_=lambda e: e.name == 'fuel')
a['xh'] = colormap(sres, plane={'x':x}, var='heat', filter_=lambda e: e.name == 'fuel', aspect='auto')

a['zft'] = colormap(sres, plane={'z':z}, var='temp', filter_=lambda e: e.name == 'fuel')
示例#7
0
parser.add_argument('--dTc',
                    help='Discretization for Tcool, K',
                    type=float,
                    dest='dTc',
                    default=None)
parser.add_argument('--uxsdir',
                    help='Update xsdir for continue run.',
                    dest='uxsdir',
                    action='store_true')
args = parser.parse_args()
print args

if '.dump' in args.key:
    # args.key is the dump file. Read it and continue calculations.
    print 'loading data from {0}'.format(args.key)
    dmp = load(args.key)
    Ic = dmp['Ic']
    s1 = dmp['s1']
    Ss = dmp['Ss']
    MI = dmp['MI']
    SI = dmp['SI']
    Keff = dmp['Keff']
    Kerr = dmp['Kerr']
    Krel = dmp['Krel']
    dTf = dmp['dTf']
    dTc = dmp['dTc']
    # prefix = dmp['prefix']
    prefix = args.key[0:-len(dump_suffix.format(0))]
    SI.wp.prefix = prefix + 'scf_'
    MI.wp.prefix = prefix + 'mcnp_'
示例#8
0
    on a map.
    """

# read model from dump:
dfile = argv[-1]
try:
    zlevel = float(argv[-2])
    zstr = argv[-2].replace('.', '_')
except ValueError:
    zlevel = 0.
    zstr = '0'
print 'Color map will be plotted for height {}'.format(zlevel)

if '.dump' in dfile:
    print 'reading {}... '.format(dfile),
    d = load(dfile)
    sres = d['scf_result'] # model with last SCF results and relaxed power density
    Keff = d['Keff'][-1]
    Kerr = d['Kerr'][-1]
    Ic = d['Ic']
    print 'ok.'
else:
    # produce simple SCF result:
    dfile = 'plot_simple'
    from a_scf import si as SI
    sres = SI.run('R')


# read data from the model:
fxyr = [] # fuel positions and radii
ftemp = [] # fuel temperature
示例#9
0
the benchmark.
"""
import sys
from pirs.tools import load


def _get(d, key):
    v = d.get(key, None)
    if v is None:
        v = []
        d[key] = v
    return v


for dname in sys.argv[1:]:
    dmp = load(dname)
    SI = dmp['SI']
    Wtot = SI.find('total_power')[0].value

    m = SI.gm

    # collect data by i, j
    data = {}
    Imin, Imax = None, None
    Jmin, Jmax = None, None
    Sh = 0.
    for e in m.children:
        i, j, k = e.ijk
        ij = (i, j)
        if Imin is None or Imin > i:
            Imin = i
示例#10
0
plt.add_line(2, 2, '', 'temp', 0, fmt='.g',
             label='$T_T$')  # results for rod (1,35)
plt.add_line(3, 3, '', 'temp', 0, sharey=2, fmt='.g',
             label='$T_T$')  # results for rod (51,35)
# for alex results
plt.add_line(0, 4, '', 'temp', 0, fmt='.b',
             label='$T_I$')  # results for rod (1,1)
plt.add_line(1, 5, '', 'temp', 0, fmt='.b',
             label='$T_I$')  # results for rod (51,1)
plt.add_line(2, 6, '', 'temp', 0, fmt='.b',
             label='$T_I$')  # results for rod (1,35)
plt.add_line(3, 7, '', 'temp', 0, fmt='.b',
             label='$T_I$')  # results for rod (51,35)

# get my results:
d = load('n_iteration_017.dump')
sres = d['scf_result']
print 'dump read'
apins = {}
for c in sres.children.values():
    index = -1
    if c.ijk == (1 - 2, 1 - 2, 0):
        index = 0
    elif c.ijk == (51 - 2, 1 - 2, 0):
        index = 1
    elif c.ijk == (1 - 2, 35 - 2, 0):
        index = 2
    elif c.ijk == (51 - 2, 35 - 2, 0):
        index = 3
    if index in [0, 1, 2, 3]:
        for cc in c.values():
示例#11
0
文件: res_dT.py 项目: inr-kit/pirs2
kTf.ylabel[0] = '$\Delta T_f^{max}$'

kal = MeshPlotter()
kal.figsize=(8,4)
kal.add_line(0, 0, (), 'temp',  0, fmt='.k', label=r'$\alpha$')
kal.ylabel[0] = r'$\alpha$'

dt = []
x = []
dh = []
dhr = []
herr = []
Ss = []
for i in range(1, 56):
    print 'processing dump ' , i
    dmp = load('results/b_iteration_{0:03d}.dump'.format(i))
    sr = dmp['scf_result']
    mr = dmp['mcnp_result']
    ss = dmp['Ss']
    Ss.append(ss)
    dtmax = -1
    dhmax = -1
    for (se, me) in zip(sr.heats(), mr.heats()):
        dtl = (se.temp - me.temp).values()
        dhl = (se.heat - me.heat).values()
        for d, v in zip(dtl, se.temp.values()):
            d = abs(d/v)
            if d > dtmax:
                dtmax = d
        for d, v in zip(dhl, se.heat.values()):
            h = abs(d.nominal_value / v.nominal_value)
示例#12
0
fc = lambda e: e.name == -1

tprev = None
sprev = None
if __name__ == '__main__':
    print '{0:>3s} {1:>9s} {2:>17s} {3:>9s} {4:>7s} {5:>10s}'.format(
        'I', 'Alpha', 'Keff', 'dHmax', 'Nh', 'Ntot'),
    print '{0:12s}'.format('Krlx'),
    print '{0:36s}'.format('relaxed_heat'),
    print '{0:36s}'.format('relaxed_Tf'),
    print '{0:36s}'.format('relaxed_Tc'),
    print '{0:36s}'.format('relaxed_Rho_c')

    first_dump = True
    for dfile in sys.argv[1:]:
        dmp = load(dfile)
        SI = dmp['SI']
        MI = dmp['MI']
        Keff = dmp['Keff']
        Kerr = dmp['Kerr']
        Krel = dmp['Krel']
        tstamp = dmp['_timestamp']
        a = dmp['a']

        t = datetime.strptime(tstamp, '%Y-%m-%d %H:%M:%S')

        s_m = SI.gm
        m_m = MI.gm
        if first_dump:
            f1k = None
            c1k = None
示例#13
0
                   aspect='auto')  #  , filter_=fltr
    ty1 = colormap(si.gm, plane={'y': -0.63}, var='temp',
                   aspect='auto')  #  , filter_=fltr
    ty2 = colormap(si.gm, plane={'y': 0.63}, var='temp',
                   aspect='auto')  #  , filter_=fltr
    tz.get_figure().savefig('hscf3_tz.pdf')  #
    tx1.get_figure().savefig('hscf3_tx1.pdf')  #
    tx2.get_figure().savefig('hscf3_tx2.pdf')  #
    ty1.get_figure().savefig('hscf3_ty1.pdf')  #
    ty2.get_figure().savefig('hscf3_ty2.pdf')  #
    #
    fltr = lambda e: e.name == -1  #
    dz = colormap(si.gm, plane={'z': 1}, var='dens',
                  aspect='auto')  #  , filter_=fltr
    dx1 = colormap(si.gm, plane={'x': -0.63}, var='dens',
                   aspect='auto')  #  , filter_=fltr
    dx2 = colormap(si.gm, plane={'x': 0.63}, var='dens',
                   aspect='auto')  #  , filter_=fltr
    dy1 = colormap(si.gm, plane={'y': -0.63}, var='dens',
                   aspect='auto')  #  , filter_=fltr
    dy2 = colormap(si.gm, plane={'y': 0.63}, var='dens',
                   aspect='auto')  #  , filter_=fltr
    dz.get_figure().savefig('hscf3_dz.pdf')
    dx1.get_figure().savefig('hscf3_dx1.pdf')
    dx2.get_figure().savefig('hscf3_dx2.pdf')
    dy1.get_figure().savefig('hscf3_dy1.pdf')
    dy2.get_figure().savefig('hscf3_dy2.pdf')
else:
    from pirs.tools import load
    si.gm = load('s3_.dump')['gm']