Ejemplo n.º 1
0
# Loop over assemblies
for assembly in assemblies:

    print 'Exporting ' + assembly

    # Create an HDF5 group for this assembly in our 'targets.h5' file
    assembly_group = f.create_group(assembly)
    high_energy = assembly_group.create_group('High Energy')
    low_energy = assembly_group.create_group('Low Energy')

    # Import the OpenMC results for this assembly
    sp = StatePoint('../openmc-input/'+assembly+'/pinwise/statepoint.1250.h5')
    sp.read_results()

    # Extract 2D numpy arrays of the batch means for each type of tally
    flux = sp.extract_results(1, 'flux')['mean']
    tot_rxn_rate = sp.extract_results(1, 'total')['mean']
    abs_rxn_rate = sp.extract_results(1, 'absorption')['mean']
    fiss_rxn_rate = sp.extract_results(1, 'fission')['mean']
    nufiss_rxn_rate = sp.extract_results(1, 'nu-fission')['mean']

    # Reshape to grid with energy group as third index
    flux = np.reshape(flux, (x, y, groups))
    tot_rxn_rate = np.reshape(tot_rxn_rate, (x, y, groups))
    abs_rxn_rate = np.reshape(abs_rxn_rate, (x, y, groups))
    fiss_rxn_rate = np.reshape(fiss_rxn_rate, (x, y, groups))
    nufiss_rxn_rate = np.reshape(nufiss_rxn_rate, (x, y, groups))

    # Compute group cross-sections for both energy groups
    tot_xs = np.nan_to_num(tot_rxn_rate / flux)
    abs_xs = np.nan_to_num(abs_rxn_rate / flux)
Ejemplo n.º 2
0
# Mesh is 17x17 or 51x51
mesh_x_dim = 17
mesh_y_dim = 17


################################################################################
# Create plot of initial data to start animation
################################################################################

# Instantiate statepoint for the first batch of tally data
print directory + 'statepoint.' + str(batch_start) + '.h5'
sp = StatePoint(directory + 'statepoint.' + str(batch_start) + '.h5')
sp.read_results()
tallyid = 1
tally1_data = sp.extract_results(tallyid, score1)
tally2_data = sp.extract_results(tallyid, score2)

tally1_means = tally1_data['mean']
tally1_std_dev = np.nan_to_num(tally1_data['CI95'])
tally2_means = tally2_data['mean']
tally2_std_dev = np.nan_to_num(tally2_data['CI95'])

# Reshape to grid with energy as third index
tally1_means = np.reshape(tally1_means,(mesh_x_dim, mesh_y_dim, num_groups))
tally1_std_dev = np.reshape(tally1_std_dev,(mesh_x_dim, mesh_y_dim, num_groups))
tally2_means = np.reshape(tally2_means,(mesh_x_dim, mesh_y_dim, num_groups))
tally2_std_dev = np.reshape(tally2_std_dev,(mesh_x_dim, mesh_y_dim, num_groups))

# Instantiate a PyPlot figure and turn on Matplotlib's interactive mode
fig = plt.figure(num=1,dpi=160)