Skip to content

Commit

Permalink
Merge pull request #25 from anu1217/r2s_config
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke authored Sep 18, 2024
2 parents 97a50cf + 32dc4f7 commit f12d63b
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
Binary file added DAGMC_Geometry.h5m
Binary file not shown.
36 changes: 36 additions & 0 deletions WC_Layers/Conversion_h5m.py
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')
19 changes: 19 additions & 0 deletions WC_Layers/PyNE_Lib.py
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)
43 changes: 43 additions & 0 deletions WC_Layers/config.ini
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

0 comments on commit f12d63b

Please sign in to comment.