ksrc = 'ksrc ' for c in f.heat.element_coords('abs'): ksrc += ' {0} {1} {2}'.format(*c) MI.adc[1] = ksrc # mesh for shannon entrophy MI.adc.append('HSRC 2 -{0} {0} 2 -{0} {0} 30 -{1} {1}'.format(b.X/2., b.Z/2.)) MI.wp.prefix = 'jnter' # MI.wp.exe = 'mpirun ' + MI.wp.exe Ntasks = 4 f.temp.set_values(900) MI.run('R', tasks=Ntasks) dump('jnter09.dump', r=MI.gm) MI.xsdir.read(MI.xsdir.datapath + '/xsd900') # xsdir without xs for 900 K MI.run('R', tasks=Ntasks) dump('jnter09i.dump', r=MI.gm) exit() f.temp.set_values(800) MI.run('R', tasks=Ntasks) dump('jnter08.dump', r=MI.gm) f.temp.set_values(1000) MI.run('R', tasks=Ntasks) dump('jnter10.dump', r=MI.gm)
for l1 in f: l2 = f.next() l3 = f.next() key = eval(l1) grid = eval(l2) temp = eval(l3) fuel = Tres.get_child(key) fuel.temp.set_grid(grid) fuel.temp.set_values(temp) if len(sys.argv) > 1 and sys.argv[1] == 'dump': dump('TFUEL_AT.dump', scf_result=Tres, Keff=[-1.], Kerr=[-1.], Ic='Anton last iteration') # get alex results: his = True if his: tecplot_file = 'TECPLOT_TFUEL.dat' d = read_tecplot(tecplot_file) Ires = minicore.copy_tree() for c in Ires.children: i, j = eval(c.local_key.split()[-1]) i += 1 j += 1 for cc in c.children: if cc.local_key == 'fuel':
# 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']
Ic = 0 # iteration counter # store MCNP input for initial state: MI.gm = model MI.run('r') # SCF run to get initial temperature distribution SI.gm = model for e in SI.gm.values(): if e.name == 'fuel': e.heat.clear() e.heat.set_grid([1.] * Nz) e.heat.set_values(1.0) SI.run('R') dump(prefix + 'init.dump', SI=SI) # 'initial' values for Keff and std.dev. To simplify comparison # to "previous" at the first iteration. Keff = [1.] Kerr = [1.] Krel = [0.] # for relaxed Keff dTf = 10. dTc = 1.0 if 'ic2' in node: Ntasks = 16 if 'mpirun' not in MI.wp.exe: MI.wp.exe = 'mpirun ' + MI.wp.exe elif 'hc3' in node:
mi.wp.prefix = 'cm_' si.wp.prefix = 'cs_' I = 0 while I < 5: # mcnp run mi.gm = si.gm.copy_tree() mr = mi.run('R', tasks=3) # relaxed power for (em, es) in zip(mr.heats(), si.gm.heats()): h = 0.5 * em.heat + 0.5 * es.heat es.heat.update(h) # scf run si.run('R') # store results dump('{}_coupling.dump'.format(I), Keff=mi.keff(), mr=mr, sr=si.gm, I=I) I += 1 dtmax = 0 dtpos = None for (em, es) in zip(mr.heats(), si.gm.heats()): dt = em.temp - es.temp for v in dt.values(): v = abs(v) if dtmax < v: dtmax = v dtpos = em.abspos() print 'Iteration {}, Keff={}'.format(I, mi.keff()) print 'dTmax {} at {}'.format(dtmax, dtpos)
krel = a * keff + (1. - a) * Krel[-1] Krel.append(krel) # ---------------------------------------------------------------------- # TH-RUN # ---------------------------------------------------------------------- SI.run('R') # ---------------------------------------------------------------------- # dump iteration results # ---------------------------------------------------------------------- MI.clear() MI.wp.inp.string = '' SI.clear() SI.wp.input.string = '' dump(prefix + 'iteration_{0:03d}.dump'.format(Ic), dTf=dTf, dTc=dTc, Ic=Ic, s1=s1, Ss=Ss, a=a, MI=MI, SI=SI, Keff=Keff, Kerr=Kerr, Krel=Krel, prefix=prefix) gc.collect()
cld = RodMaterial() cld.fp = 'benpwr' cld.fd = -1 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') #