plst = [] for e in MI.gm.values(): if e.name == 'fuel': p = e.abspos() plst.append(p) ksrc = 'ksrc ' + ''.join(map(lambda p: ' {} {} {}'.format(*p.car), plst)) MI.adc[-1] = ksrc print 'ksrc computed' MI.kcode.Nh = 10000 MI.kcode.Nct = 250 MI.kcode.Ncs = 30 a = MI.run('r', tasks=3) from pirs.tools.plots import colormap az = colormap(a, plane={'z':0}) ay = colormap(a, plane={'y':0}, aspect='auto') ax = colormap(a, plane={'x':0}, aspect='auto') az.get_figure().savefig('a_model_z.pdf') ay.get_figure().savefig('a_model_y.pdf') ax.get_figure().savefig('a_model_x.pdf') azh = colormap(a, plane={'z':0}, var='heat') axh = colormap(a, plane={'x':0}, var='heat', aspect='auto') azh.get_figure().savefig('a_heat_z.pdf') axh.get_figure().savefig('a_heat_x.pdf')
# 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') a['zct'] = colormap(sres, plane={'z':z}, var='temp', filter_=lambda e: e.name == -1) a['xft'] = colormap(sres, plane={'x':x}, var='temp', filter_=lambda e: e.name == 'fuel', aspect='auto') a['xct'] = colormap(sres, plane={'x':x}, var='temp', filter_=lambda e: e.name == -1, aspect='auto') a['zd'] = colormap(sres, plane={'z':z}, var='dens', filter_=lambda e: e.name == -1) a['xd'] = colormap(sres, plane={'x':x}, var='dens', filter_=lambda e: e.name == -1, aspect='auto') for (n, ax) in a.items(): ax.get_figure().savefig(argv[1].replace('.dump', n+'.pdf'))
# # 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 colormap # pin model pin = Cylinder(R=0.45, Z=100, material='clad') pin.insert(Cylinder(R=0.4, Z=pin.Z-5, material='fuel')) # assembly box a = Box(X=5, Y=7, Z=pin.Z+10, material='water') a.grid.x = 1 a.grid.y = 1.1 a.grid.z = a.Z # insert pins for i in range(5): for j in range(6): a.grid.insert((i,j,0), pin.copy_tree()) # center grid with respect to solid a.grid.center() colormap(a, filename='sol2z.png') colormap(a, plane={'x':0}, filename='sol2x.png', aspect='auto')
# 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/>. f = b.get_child((0, 0)) # fuel temperature axial profile f.temp.set_grid([1, 1, 1]) f.temp.set_values(350) # heat deposition axial profile f.heat.set_grid([1, 1, 2, 3, 2, 1, 1]) f.heat.set_values([1, 2, 3, 4, 3, 2, 1]) # density axial profile in water b.dens.set_grid([1, 1, 1]) b.dens.set_values([0.7, 0.65, 0.6]) if __name__ == '__main__': from pirs.tools.plots import colormap colormap(b, {'x': 0}, var='heat', filename='ex2t.pdf', aspect='auto')
# 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']
# 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/>. for v in cnt.values(True): v.temp.set_values(300.) cnt.dens.set_values(1.0) cnt.children[0].dens.set_values(5.0) cnt.children[1].dens.set_values(5.0) f1 = cnt.get_child((0, 0)) f2 = cnt.get_child((1, 0)) f1.temp.set_grid([1, 3, 1]) f1.temp.set_values([280, 320, 293]) f2.temp.set_grid([1, 2, 1]) f2.temp.set_values([275, 314, 293]) f1.dens.set_values(10.) f2.dens.set_values(10.) if __name__ == '__main__': from pirs.tools.plots import colormap pd = colormap(cnt, plane={'y': 0}, var='dens', aspect='auto') pt = colormap(cnt, plane={'y': 0}, var='temp', aspect='auto') pd.get_figure().savefig('geom2_d.pdf') pt.get_figure().savefig('geom2_t.pdf')
# 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 colormap c = Cylinder(Z=2) # heat c.heat.set_grid([1, 2, 1]) c.heat.set_values([0.1, 0.2, 0.3]) # temperature c.temp.set_grid([1] * 20) c.temp.set_values(lambda z: 300 + 100 * z) # density c.dens.set_grid([1] * 5) c.dens.set_values(1.) colormap(c, var='heat', plane={'x': 0}, filename='sol3h.png') colormap(c, var='temp', plane={'x': 0}, filename='sol3t.png') colormap(c, var='dens', plane={'x': 0}, filename='sol3d.png')
# from pirs.tools.plots import colormap from pirs.tools.plots import colormap cls = {} cls['swater'] = 'LightSteelBlue' cls['bwater'] = 'DeepSkyBlue' cls['uo2'] = 'Fuchsia' cls['mox1'] = 'Orange' cls['mox2'] = 'OrangeRed' cls['mox3'] = 'Red' cls['zirc'] = 'Gray' cls['waba'] = 'Yellow' cls['ifba'] = 'Gold' print 'generate plots' az = colormap(a, plane={'z': 0}, colors=cls) ay = colormap(a, plane={'y': 0}, aspect='auto', colors=cls) ax = colormap(a, plane={'x': 0}, aspect='auto', colors=cls) print 'saves plots to pdf' az.get_figure().savefig('a_model_z.pdf') ay.get_figure().savefig('a_model_y.pdf') ax.get_figure().savefig('a_model_x.pdf') if Nai == 3 and Naj == 3: # UOX and MOX assemblies print 'generate assembly plots' az = colormap(a, plane={'z': 0}, nmarker={'ifba': 'kx'}, colors=cls) ap2 = ap / 2.0 az.set_xlim(-ap2, ap2) az.set_ylim(-ap2, ap2)
print 'model completed.' model = vessel if __name__ == '__main__': pass for e in model.values(True): if str(e.material)[0] in ['u', 'm']: print repr(e.name), repr(e.material) exit() from pirs.tools.plots import colormap for k, a in adict.items(): print 'plotting assembly ', k az = colormap(a, plane={'z': 0}, linewidth=0.01, nmarker={'coat': 'rx'}) az.get_figure().savefig('qc.{}.pdf'.format(k)) rset = set() for r in a.children: plotted = False for rprev in rset: if r.name[:2] == rprev: plotted = True break if not plotted: print 'plotting rod ', r.name, r.ijk ar = colormap(r, plane={'z': 0}, linewidth=0.01) ar.get_figure().savefig('qc.{}.{}.pdf'.format(k, r.name)) rset.add(r.name[:2])
# 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/>. cnt = Box(X=2.53, Y=2.53, Z=365, material='water') r = Cylinder(R=0.4583, Z=365, material='steel') f = Cylinder(R=0.3951, Z=365, material='fuel') r.insert(f) cnt.insert(r) r2 = cnt.insert(r.copy_tree()) r2.pos.x = 0.8 r2.pos.y = 0.8 if __name__ == '__main__': from pirs.tools.plots import colormap pz = colormap(cnt, plane={'z': 0}) px = colormap(cnt, plane={'x': 0}, aspect='auto') py = colormap(cnt, plane={'y': 0}, aspect='auto') pz.get_figure().savefig('geom1_pz.pdf') px.get_figure().savefig('geom1_px.pdf') py.get_figure().savefig('geom1_py.pdf')
# 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 colormap dmp = load('results/b_iteration_056.dump') sr = dmp['scf_result'] mr = dmp['mcnp_result'] gm = sr.copy_tree() gm.remove_by_criteria(name=-1) agm = colormap(gm, plane={'z': 1}, var='material') agm.get_figure().savefig('res_model.pdf') fltr = lambda e: e.name == 'fuel' atx = colormap(sr, plane={'x': 0}, var='temp', aspect='auto', filter_=fltr) aty = colormap(sr, plane={'y': 0}, var='temp', aspect='auto', filter_=fltr) atx.get_figure().savefig('res_tx.pdf') aty.get_figure().savefig('res_ty.pdf') ahx = colormap(sr, plane={'x': 0}, var='heat', aspect='auto', filter_=fltr) ahy = colormap(sr, plane={'y': 0}, var='heat', aspect='auto', filter_=fltr) ahx.get_figure().savefig('res_hx.pdf') ahy.get_figure().savefig('res_hy.pdf') ahz = colormap(sr, plane={'z': 1}, var='heat', filter_=fltr)
# 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 colormap b = Box() b.X = 3 b.Y = 4 b.Z = 5 b.material = 'm1' c1 = Cylinder() c1.R = 1 c1.Z = 4 c1.material = 'm2' b.insert(c1) c2 = c1.copy_tree() c2.material = 'm3' c2.R = 0.8 c2.pos.x = 0.8 c2.pos.y = 0.6 b.insert(c2) colormap(b, filename='sol1z.png') colormap(b, plane={'x': 0}, filename='sol1x.png')
r1 = cnt.children[0] r2 = cnt.children[1] r1.material = 'zirc' r1.ijk = (0, 0, 0) r2.ijk = (1, 0, 0) r2.pos *= 0. cnt.grid.x = 1.26 cnt.grid.y = 1.30 cnt.grid.z = cnt.Z r3 = cnt.grid.insert((1, 1, 0), r2.copy_tree()) r4 = cnt.grid.insert((0, 1, 0), r2.copy_tree()) # r4.R = 0.56 # cnt.grid.set_origin((0, -1, 0), (0.,-0.5,0.)) cnt.grid.center() if __name__ == '__main__': from pirs.tools.plots import colormap pz = colormap(cnt, plane={'z': 0}) px1 = colormap(cnt, plane={'x': -0.63}, aspect='auto') px2 = colormap(cnt, plane={'x': 0.63}, aspect='auto') py1 = colormap(cnt, plane={'y': -0.63}, aspect='auto') py2 = colormap(cnt, plane={'y': 0.63}, aspect='auto') pz.get_figure().savefig('geom3_pz.pdf') px1.get_figure().savefig('geom3_px1.pdf') px2.get_figure().savefig('geom3_px2.pdf') py1.get_figure().savefig('geom3_py1.pdf') py2.get_figure().savefig('geom3_py2.pdf')
# (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/>. b = Box(X=3, Y=3) c = Cylinder(R=0.4) b.grid.x = 1 b.grid.y = 1 for i in [0, 1]: for j in [0, 1]: cc = c.copy_tree() b.grid.insert((i, j, 0), cc) cc.material = 'm{}{}'.format(i,j) from pirs.tools.plots import colormap colormap(b, filename='ex3_1.pdf') b.grid.center() colormap(b, filename='ex3_2.pdf')
# 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/>. # surrounding water b = Box(material='water') b.X = 1.26 b.Y = b.X b.Z = 400 # clad c = Cylinder(material='steel') c.R = 0.4583 c.Z = 360 # fuel f = Cylinder(material='fuel') f.R = 0.3951 f.Z = 350 # construct model b.insert(c) # put clad into box c.insert(f) # put fuel into clad c.pos.y = 0.1 # shift clad with resp. to container if __name__ == '__main__': from pirs.tools.plots import colormap colormap(b, {'z': 0}, filename='ex2z.pdf') colormap(b, {'x': 0}, filename='ex2x.pdf', aspect='auto')
cld.ct = -1 cld.cp = 'zircaloy' si.materials['steel'] = cld si.materials['zirc'] = cld if __name__ == '__main__': si.wp.prefix = 's3_' si.run('R') from pirs.tools import dump dump('s3_.dump', gm=si.gm) from pirs.tools.plots import colormap fltr = lambda e: e.material not in ['zirc', 'steel'] tz = colormap(si.gm, plane={'z': 1}, var='temp', aspect='auto') # , filter_=fltr tx1 = colormap(si.gm, plane={'x': -0.63}, var='temp', aspect='auto') # , filter_=fltr tx2 = colormap(si.gm, plane={'x': 0.63}, var='temp', 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 #