-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from anu1217/r2s_config
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import openmc | ||
import numpy as np | ||
import pymoab | ||
from pymoab import core, types, rng | ||
import matplotlib.pyplot as plt | ||
|
||
# Load the statepoint file | ||
sp = openmc.StatePoint("statepoint.10.h5") | ||
|
||
mb = core.Core() | ||
mb.load_file('OpenMC_Mesh.h5m') | ||
|
||
# Retrieve the tally | ||
tally = sp.get_tally(id=2) | ||
|
||
# Load the mesh | ||
mesh = sp.meshes[1] | ||
|
||
tally_data = tally.get_reshaped_data(value='mean') | ||
|
||
#Summing over cell filter: | ||
flux_spectra_on_mesh = tally_data.sum(axis=0) | ||
|
||
ebounds = tally.find_filter(openmc.EnergyFilter).bins | ||
|
||
plt.xlabel('Energy [eV]') | ||
plt.ylabel('Flux [n/cm^2-s]') | ||
plt.loglog(ebounds[:,0],flux_sum_en[0,:,0,0]) | ||
plt.savefig("Flux_Graph.png") | ||
|
||
# get all tets from the MOAB mesh | ||
all_tets = mb.get_entities_by_type(0, types.MBTET) | ||
n_flux_tag = mb.tag_get_handle('FLUX_MESH', 175, types.MB_TYPE_DOUBLE, types.MB_TAG_DENSE, create_if_missing=True) | ||
mb.tag_set_data(n_flux_tag, all_tets, flux_spectra_on_mesh[:,:,0,0]) # the shape of the data will need to be checked here | ||
|
||
mb.write_file('Mesh_with_Tally.h5m') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Sep 2 01:08:06 2024 | ||
@author: Anupama Rajendra | ||
""" | ||
|
||
from pyne.material import Material | ||
from pyne.material_library import MaterialLibrary | ||
|
||
W=Material({"W":1}) | ||
W.density=19.3 | ||
Graphite=Material({"C":1}) | ||
Graphite.density=2.62 | ||
|
||
MatLib = MaterialLibrary() | ||
MatLib["W"]=W | ||
MatLib["Graphite"]=Graphite | ||
MatLib.write_hdf5("PyNE_Lib_WC.h5", h5_overwrite=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[general] | ||
# Specify whether this problem uses structured or unstructured mesh | ||
structured: False | ||
# Specify whether this problem uses sub-voxel r2s | ||
sub_voxel: False | ||
|
||
[step1] | ||
# Path to MCNP MESHTAL file containing neutron fluxes or a DAG-MCNP5 | ||
# unstructured mesh tally .h5m file. | ||
meshtal: Mesh_with_Tally.h5m | ||
# Tally number within the meshtal file containing the fluxes for activation. | ||
tally_num: 2 | ||
# The name of the tag used to store flux data on the mesh. For unstructured | ||
# mesh this tag must already exist within the file specified in <meshtal>. | ||
flux_tag: FLUX_MESH | ||
# Path to the DAGMC material-laden geometry file (.h5m). | ||
geom: DAGMC_Geometry.h5m | ||
# If True the fluxes in the fluxin file will be printed in the reverse | ||
# order of how they appear within the flux vector tag. Since MCNP and | ||
# the Meshtal class order fluxes from low energy to high energy, this | ||
# option should be true if the transmutation data being used is | ||
# ordered from high-energy to low-energy. | ||
reverse: True | ||
# Number of rays to fire down each mesh row in each direction to calculate | ||
# cell volume fractions. | ||
num_rays: 100 | ||
# If true, rays will be fired down mesh rows in evenly spaced intervals. | ||
# In this case <num_rays> must be a perfect square. If false, rays are fired | ||
# down mesh rows in random intervals. | ||
grid: False | ||
|
||
[step2] | ||
# List of decays times, seperated by commas. These strings much match exactly | ||
# with their counterparts in the phtn_src file produced in step1. No spaces | ||
# should appear in this line except the space between the time and the time unit | ||
# for each entry. | ||
decay_times:24 h,2.6864e+6 s | ||
# The prefix of the .h5m files containing the source density distributations for | ||
# each decay time. | ||
output: source | ||
# The name of the output files containing the total photon source intensities for | ||
# each decay time | ||
tot_phtn_src_intensities : total_photon_source_intensities.txt |