def solveManyAzim(spacing, nazims, t): f = open('%s.txt' % resultsfile, 'a+') print "Iterating over azimuthal angles....\n\n" f.write("Iterating over azimuthal angles...\n\n") f.close() for nazim in nazims: savepath = pathname + '/nazim_' + str(nazim) + 'track_' + str( t) + 'mesh_' + str(spacing) plotter.mkdir_p(savepath) solveMOC(nazim, spacing, t, savepath)
def solveManyMesh(spacings, nazim, t): f = open('%s.txt' % resultsfile, 'a+') print "Iterating over mesh spacings....\n\n" f.write("Iterating over mesh spacings...\n\n") f.close() for spacing in spacings: savepath = pathname + '/mesh_' + str(spacing) + 'nazim_' + str( nazim) + 'track_' + str(t) plotter.mkdir_p(savepath) solveMOC(nazim, spacing, t, savepath)
def solveManyTrackSpacings(spacing, nazim, ts): f = open('%s.txt' % resultsfile, 'a+') print "Iterating over track spacings....\n\n" f.write("Iterating over track spacings...\n\n") f.close() for t in ts: savepath = pathname + '/track_' + str(t) + 'mesh_' + str( spacing) + 'nazim_' + str(nazim) plotter.mkdir_p(savepath) solveMOC(nazim, spacing, t, savepath)
def solveOrders(spacing, orders): ratio_old = 0 print "Iterating over orders...\n\n" f.write("Iterating over orders...\n\n") for order in orders: savepath = pathname + '/order_' + str(order) plotter.mkdir_p(savepath) result = solveSN(spacing, order, savepath) fluxchg = ((result - ratio_old) / result) * 100 print "flux ratio change: %g" % (fluxchg) f.write("flux ratio change: %g\n\n\n" % (fluxchg)) ratio_old = result
def solveSpacings(spacings, order): ratio_old = 0 print "Iterating over spacings....\n\n" f.write("Iterating over spacings...\n\n") for spacing in spacings: savepath = pathname + '/spacing_' + str(spacing) plotter.mkdir_p(savepath) result = solveSN(spacing, order, savepath) fluxchg = ((result - ratio_old) / result) * 100 print "flux ratio change: %g" % (fluxchg) f.write("flux ratio change: %g\n\n\n" % (fluxchg)) if convergemesh: if fluxchg <= sptol: print "Spatial mesh is converged with spacing of %g" % ( spacing) f.write("Spatial mesh is converged with spacing of %g" % (spacing)) break ratio_old = result
import matplotlib import math from plotter import mkdir_p import time #matplotlib.rcParams['text.usetex'] = True #matplotlib.rcParams['text.latex.unicode'] = True import matplotlib.pyplot as plt plt.rc('text', usetex=True) plt.rc('font', family='serif') lines = True nolines = False gen_time = 'data_plots/' + time.strftime("%Y-%m-%d_%H-%M-%S") mkdir_p(gen_time) def readMOCdata(): """DEPRECATED""" MOCdata = genfromtxt('MOCdata.txt', delimiter='\t') unknowns = MOCdata[:, 0] fm_ratio = MOCdata[:, 1] corner_normalized = MOCdata[:, 2] corner_ratio = MOCdata[:, 3] fmod_error_ratio = MOCdata[:, 4] ln_corner = MOCdata[:, 5] ln_ratio = MOCdata[:, 6] ln_unknowns = MOCdata[:, 7] return unknowns, corner_ratio, fmod_error_ratio
sigma_fuel = (xs_scatter_238 + 2 * xs_scatter_o) * num_density_uo2 * barns sigma_mod = (2 * xs_absorption_h + xs_scatter_o + 2 * xs_scatter_h) * num_density_h2o * barns sigma_mod_scatter = (xs_scatter_o + 2 * xs_scatter_h) * num_density_h2o * barns #set material objects fuel = geometry.Material('fuel', q_fuel, sigma_fuel, sigma_fuel) moderator = geometry.Material('moderator', q_mod, sigma_mod, sigma_mod_scatter) ######################################### ############ RESULTS STORAGE ############ ######################################### #create directory to store plots, results in timestr = time.strftime("%Y-%m-%d_%H-%M") pathname = 'plots/' + timestr plotter.mkdir_p(pathname) savepath = pathname resultsfile = pathname + '/' + timestr + '_results' f = open('%s.txt' % resultsfile, 'w+') f.write("********PROBLEM SETUP********\n") f.write( "cell pitch \t %g\nfuel width \t %g\nfuel source \t %g\nmod source \t %g\n\n" % (pitch, fwidth, q_fuel, q_mod)) f.write("converge tol \t %g\n\n" % (tol)) f.write("fuel total xs \t %g\nmod total xs \t %g\nmod scatter xs \t %g\n\n" "*****************************\n\n" % (sigma_fuel, sigma_mod, sigma_mod_scatter)) #########################################