why i can’t visualize the plenume and the top or bottom nozzle here
from math import log10
import openmc.mgxs
from IPython.display import Image
import numpy as np
import matplotlib.pyplot as plt
import openmc
Create materials for the problem
uo2 = openmc.Material(name=‘UO2 fuel at 4.95% wt enrichment’)
uo2.set_density(‘g/cm3’, 10.53)
uo2.add_element(‘U’, 1., enrichment=4.95)
uo2.add_element(‘O’, 2.)
Create Helium gas material for fuel pin gap
helium = openmc.Material(name=‘Helium for gap’)
helium.set_density(‘g/cm3’, 0.0015981 )
helium.add_element(‘He’, 2.4044e-4)
Create air material for instrument tubes
air_instrument = openmc.Material(name=‘Air’)
air_instrument.set_density(‘g/cc’, 0.00616)
air_instrument.add_element(‘O’, 0.2095, ‘ao’)
air_instrument.add_element(‘N’, 0.7809, ‘ao’)
air_instrument.add_element(‘Ar’, 0.00933, ‘ao’)
air_instrument.add_element(‘C’, 0.00027, ‘ao’)
Create M5 alloy material
m5_niobium = 0.01 # http://publications.jrc.ec.europa.eu/repository/bitstream/JRC100644/lcna28366enn.pdf
m5_oxygen = 0.00135 # http://publications.jrc.ec.europa.eu/repository/bitstream/JRC100644/lcna28366enn.pdf
m5_density = 6.494 # 10.1039/C5DT03403E
m5_alloy = openmc.Material(name=‘M5’)
m5_alloy.add_element(‘Zr’, 1.0 - m5_niobium - m5_oxygen)
m5_alloy.add_element(‘Nb’, m5_niobium)
m5_alloy.add_element(‘O’, m5_oxygen)
m5_alloy.set_density(‘g/cm3’, m5_density)
Create inconel 718 material
inconel_718 = openmc.Material(name=‘Inconel’)
inconel_718.set_density(‘g/cc’, 8.2)
inconel_718.add_element(‘Si’, 0.0035, ‘wo’)
inconel_718.add_element(‘Cr’, 0.1896, ‘wo’)
inconel_718.add_element(‘Mn’, 0.0087, ‘wo’)
inconel_718.add_element(‘Fe’, 0.2863, ‘wo’)
inconel_718.add_element(‘Ni’, 0.5119, ‘wo’)
Create light water for coolant / moderator
coolant = openmc.Material(name=‘Coolant’)
coolant.set_density(‘g/cm3’, 0.997)
coolant.add_element(‘H’, 2.0)
coolant.add_element(‘O’, 1.0)
coolant.add_s_alpha_beta(‘c_H_in_H2O’)
Create stainless steel material
SS304 = openmc.Material(name=‘SS304’)
SS304.set_density(‘g/cc’, 8.03)
SS304.add_element(‘Si’, 0.0060, ‘wo’)
SS304.add_element(‘Cr’, 0.1900, ‘wo’)
SS304.add_element(‘Mn’, 0.0200, ‘wo’)
SS304.add_element(‘Fe’, 0.6840, ‘wo’)
SS304.add_element(‘Ni’, 0.1000, ‘wo’)
Create Ag-In-Cd control rod material
AIC= openmc.Material(name=‘Ag-In-Cd’)
AIC.set_density(‘g/cc’, 10.16)
AIC.add_element(‘Ag’, 0.80, ‘wo’)
AIC.add_element(‘In’, 0.15, ‘wo’)
AIC.add_element(‘Cd’, 0.05, ‘wo’)
Create stainless steel 302
SS302= openmc.Material(name=‘SS302’)
SS302.set_density(‘g/cm3’, 7.86)
SS302.add_element(‘Si’, 0.01, ‘wo’)
SS302.add_element(‘Cr’, 0.18, ‘wo’)
SS302.add_element(‘Mn’, 0.02, ‘wo’)
SS302.add_element(‘Fe’, 0.70, ‘wo’)
SS302.add_element(‘Ni’, 0.09, ‘wo’)
Create zircaloy 4 material
zircaloy_4 = openmc.Material(name=‘Zircaloy-4’)
zircaloy_4.set_density(‘g/cc’, 6.55)
zircaloy_4.add_element(‘O’, 0.00125, ‘wo’)
zircaloy_4.add_element(‘Cr’, 0.0010, ‘wo’)
zircaloy_4.add_element(‘Fe’, 0.0021, ‘wo’)
zircaloy_4.add_element(‘Zr’, 0.98115, ‘wo’)
zircaloy_4.add_element(‘Sn’, 0.0145, ‘wo’)
materials = openmc.Materials([uo2, helium, inconel_718, m5_alloy, coolant, SS304, SS302, zircaloy_4, AIC, air_instrument])
materials.export_to_xml()
Define problem geometry
INCHES=2.54
h_fuel=200
plenum_length = 13.4899
h_fuel_rod = 215.9
h_lower_end_cap = 1.4606
pitch = 1.2598
h_total=230
top_nozzle_height = 3.551*INCHES
top_nozzle_width = 0.25
bottom_lower_nozzle = h_fuel + plenum_length
top_lower_nozzle = bottom_lower_nozzle +top_nozzle_height
bottom_upper_nozzle = h_fuel + plenum_length
top_upper_nozzle = bottom_upper_nozzle +top_nozzle_height
Create cylindrical surfaces
fuel_or = openmc.ZCylinder(r=0.405765, name=‘Fuel OR’)
fuel_t_plan = openmc.ZPlane(z0=h_fuel/2)
fuel_b_plan = openmc.ZPlane(z0=-h_fuel/2)
clad_ir = openmc.ZCylinder( r=0.41402, name=‘Clad IR’)
clad_or = openmc.ZCylinder(r=0.47498, name=‘Clad OR’)
plenum_or = openmc.ZCylinder(r=0.06459 , name=‘Plenum OR’)
plenum_t_plan = openmc.ZPlane(z0=h_fuel+plenum_length)
top_nozzle = openmc.ZCylinder(r=top_nozzle_height /2 , name=‘Top nozzle’)
top_upper_nozzle_plane = openmc.ZPlane(z0=top_upper_nozzle )
bottom_upper_nozzle_plane = openmc.ZPlane(z0=bottom_upper_nozzle)
top_lower_nozzle_plane = openmc.ZPlane(z0= -top_lower_nozzle )
bottom_lower_nozzle_plane = openmc.ZPlane(z0= -bottom_lower_nozzle)
Create cells, mapping materials to regions
def fuel_pin():
“”“Returns a fuel pin universe.”“”
fuel_cell = openmc.Cell(name=‘Fuel’, fill=uo2, region=-fuel_or & -fuel_t_plan & +fuel_b_plan)
gap_cell = openmc.Cell(name=‘Gap’, fill=helium, region=+fuel_or & -clad_ir & -fuel_t_plan & +fuel_b_plan)
clad_cell = openmc.Cell(name=‘Clad’, fill=m5_alloy, region=+clad_ir & -clad_or& -fuel_t_plan & +fuel_b_plan)
moderator_cell = openmc.Cell(name=‘Moderator’, fill=coolant, region=+clad_or & -fuel_t_plan & +fuel_b_plan )
univ = openmc.Universe(name='Fuel Pin')
univ.add_cells([fuel_cell, gap_cell, clad_cell, moderator_cell])
return univ
def plenum():
“”“Returns a plenum part universe.”“”
plenum_cell = openmc.Cell(fill=SS302, region= -plenum_or )
pl_gap_cell = openmc.Cell(fill=helium, region= +plenum_or & -clad_ir)
pl_clad_cell = openmc.Cell(fill=m5_alloy, region=+clad_ir & -clad_or)
pl_moderator_cell = openmc.Cell(fill=coolant,region=+clad_or & +fuel_t_plan & -plenum_t_plan )
univ = openmc.Universe(name='Plenum Part')
univ.add_cells([plenum_cell, pl_gap_cell, pl_clad_cell, pl_moderator_cell])
return univ
def Top_nozzle():
“”“Returns a top nozzle part universe.”“”
t_nozz_cell = openmc.Cell(fill=SS304, region= -top_nozzle )
t_n_moderator_cell = openmc.Cell(fill=coolant,region= +top_nozzle & -top_upper_nozzle_plane & +bottom_upper_nozzle_plane )
univ = openmc.Universe(name='Top nozzle part')
univ.add_cells([t_nozz_cell, t_n_moderator_cell])
return univ
def Bot_nozzle():
“”“Returns a bot nozzle part universe.”“”
b_nozz_cell = openmc.Cell(fill=SS304, region= -top_nozzle )
b_n_moderator_cell = openmc.Cell( fill = coolant, region= +top_nozzle & +top_lower_nozzle_plane & -bottom_lower_nozzle_plane)
univ = openmc.Universe(name='Bot nozzle part')
univ.add_cells([ b_nozz_cell, b_n_moderator_cell])
return univ
def setup_root_universe():
fuel_pin_universe = fuel_pin()
plenum_universe = plenum()
top_nozzle_universe = Top_nozzle()
bot_nozzle_universe = Bot_nozzle()
container_universe = openmc.Universe(name='Container Universe')
fuel_pin_cell = openmc.Cell(name='Fuel Pin Cell', fill=fuel_pin_universe)
plenum_cell = openmc.Cell(name='Plenum Cell', fill=plenum_universe)
T_noz_cell = openmc.Cell(name='Top nozzle', fill=top_nozzle_universe)
B_noz_cell = openmc.Cell(name='Bot nozzle', fill=bot_nozzle_universe)
container_universe.add_cells([fuel_pin_cell, plenum_cell, T_noz_cell, B_noz_cell])
root_cell = openmc.Cell(name='Root Cell', fill=container_universe)
# Boundary planes
min_x = openmc.XPlane(x0=-pitch/2, boundary_type='reflective')
max_x = openmc.XPlane(x0=pitch/2, boundary_type='reflective')
min_y = openmc.YPlane(y0=-pitch/2, boundary_type='reflective')
max_y = openmc.YPlane(y0=pitch/2, boundary_type='reflective')
min_z = openmc.ZPlane(z0=-300/2, boundary_type='reflective')
max_z = openmc.ZPlane(z0=300/2, boundary_type='reflective')
root_cell.region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
root_universe = openmc.Universe(name='Root Universe')
root_universe.add_cell(root_cell)
geometry = openmc.Geometry(root_universe)
geometry.export_to_xml()
setup_root_universe()
##################################################################################################
Plot in the XY-plane
plot_xy = openmc.Plot()
plot_xy.filename = ‘plot_xy’
plot_xy.origin = [0, 0, 0] # Centered at the origin
plot_xy.width = [pitch, pitch] # Width in X and Y
plot_xy.pixels = [200, 200]
plot_xy.basis = ‘xy’
plot_xy.color_by = ‘material’
plot_xy.colors = {uo2: ‘yellow’, coolant: ‘blue’, helium:‘pink’ , SS302:‘red’}
Plot in the XZ-plane
plot_xz = openmc.Plot()
plot_xz.filename = ‘plot_xz’
plot_xz.origin = [0, 0, -35] # Centered along the XZ-plane at y=0
plot_xz.width = [2, 350] # Width in X and Z
plot_xz.pixels = [200, 2000]
plot_xz.basis = ‘xz’
plot_xz.color_by = ‘material’
plot_xz.colors = {uo2: ‘yellow’, coolant: ‘blue’,helium:‘pink’ , SS302:‘red’}
Plot in the YZ-plane
plot_yz = openmc.Plot()
plot_yz.filename = ‘plot_yz’
plot_yz.origin = [0, 0, -35]
plot_yz.width = [2., 350]
plot_yz.basis = ‘yz’
plot_yz.pixels = [200, 2000]
plot_yz.color_by = ‘material’
plot_yz.colors = {uo2: ‘yellow’, coolant: ‘blue’, helium:‘pink’ , SS302:‘red’}
Instantiate a Plots collection, add plots, and export to XML
plot_file = openmc.Plots([plot_xy, plot_xz, plot_yz])
plot_file.export_to_xml()
openmc.plot_inline(plot_file)
settings = openmc.Settings()
settings.batches = 100
settings.inactive = 10
settings.particles = 1000
Create an initial uniform spatial source distribution over fissionable zones
lower_left = (-pitch/2, -pitch/2, -1)
upper_right = (pitch/2, pitch/2, 1)
uniform_dist = openmc.stats.Box(lower_left, upper_right, only_fissionable=True)
settings.source = openmc.IndependentSource(space=uniform_dist)
settings.export_to_xml()