Updating lattice_hex_coincident test to use Python API.

This commit is contained in:
Patrick Shriwise 2019-04-03 11:05:58 -05:00
parent 7351773b29
commit 33c1f64100
5 changed files with 227 additions and 83 deletions

View file

@ -1,34 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="1" material="1" region="-1 2 -3" universe="1" />
<cell id="2" material="2" region="1" universe="1" />
<cell id="3" material="6" region="-4 2 -3" universe="2" />
<cell id="4" material="7" region="4 -5 2 -3" universe="2" />
<cell id="5" material="4" region="5 -6 2 -3" universe="2" />
<cell id="6" material="2" region="6 2 -3" universe="2" />
<cell id="7" material="2" universe="3" />
<cell fill="4" id="8" name="container cell" region="-7 8 -9 10 11 -12 2 -3" universe="5" />
<hex_lattice id="4" n_rings="2">
<pitch>1.4</pitch>
<outer>3</outer>
<center>0.0 0.0</center>
<universes>
2
2 2
1
2 2
2</universes>
</hex_lattice>
<surface coeffs="0.0 0.0 0.7" id="1" type="z-cylinder" />
<surface boundary="reflective" coeffs="0.0" id="2" type="z-plane" />
<surface boundary="reflective" coeffs="10.0" id="3" type="z-plane" />
<surface coeffs="0.0 0.0 0.293" id="4" type="z-cylinder" />
<surface coeffs="0.0 0.0 0.35" id="5" type="z-cylinder" />
<surface coeffs="0.0 0.0 0.352" id="6" type="z-cylinder" />
<surface boundary="reflective" coeffs="1.4" id="7" type="y-plane" />
<surface boundary="reflective" coeffs="-1.4" id="8" type="y-plane" />
<surface boundary="reflective" coeffs="1.7320508075688772 1.0 0.0 2.8" id="9" type="plane" />
<surface boundary="reflective" coeffs="-1.7320508075688772 1.0 0.0 -2.8" id="10" type="plane" />
<surface boundary="reflective" coeffs="1.7320508075688772 1.0 0.0 -2.8" id="11" type="plane" />
<surface boundary="reflective" coeffs="-1.7320508075688772 1.0 0.0 2.8" id="12" type="plane" />
</geometry>

View file

@ -0,0 +1,81 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="13" material="13" region="-9 10 -11" universe="9" />
<cell id="14" material="14" region="9" universe="9" />
<cell id="15" material="16" name="coolant" region="-12 10 -11" universe="10" />
<cell id="16" material="17" name="zirconium_shell" region="12 -13 10 -11" universe="10" />
<cell id="17" material="15" name="lead_shell" region="13 -14 10 -11" universe="10" />
<cell id="18" material="14" name="matrix coolant surround" region="14 10 -11" universe="10" />
<cell id="19" material="14" universe="11" />
<cell fill="12" id="20" name="container cell" region="-15 16 -17 18 19 -20 10 -11" universe="13" />
<hex_lattice id="12" n_rings="2" name="regular fuel assembly">
<pitch>1.4</pitch>
<outer>11</outer>
<center>0.0 0.0</center>
<universes>
10
10 10
9
10 10
10</universes>
</hex_lattice>
<surface coeffs="0.0 0.0 0.7" id="9" type="z-cylinder" />
<surface boundary="reflective" coeffs="0.0" id="10" type="z-plane" />
<surface boundary="reflective" coeffs="10.0" id="11" type="z-plane" />
<surface coeffs="0.0 0.0 0.293" id="12" type="z-cylinder" />
<surface coeffs="0.0 0.0 0.35" id="13" type="z-cylinder" />
<surface coeffs="0.0 0.0 0.352" id="14" type="z-cylinder" />
<surface boundary="reflective" coeffs="1.4" id="15" type="y-plane" />
<surface boundary="reflective" coeffs="-1.4" id="16" type="y-plane" />
<surface boundary="reflective" coeffs="1.7320508075688772 1.0 0.0 2.8" id="17" type="plane" />
<surface boundary="reflective" coeffs="-1.7320508075688772 1.0 0.0 -2.8" id="18" type="plane" />
<surface boundary="reflective" coeffs="1.7320508075688772 1.0 0.0 -2.8" id="19" type="plane" />
<surface boundary="reflective" coeffs="-1.7320508075688772 1.0 0.0 2.8" id="20" type="plane" />
</geometry>
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material depletable="true" id="13">
<density units="sum" />
<nuclide ao="0.0049817" name="U235" />
</material>
<material id="14">
<density units="atom/b-cm" value="0.087742" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
<material id="15" name="Lead">
<density units="g/cm3" value="10.32" />
<nuclide ao="0.014" name="Pb204" />
<nuclide ao="0.241" name="Pb206" />
<nuclide ao="0.221" name="Pb207" />
<nuclide ao="0.524" name="Pb208" />
</material>
<material id="16">
<density units="atom/b-cm" value="0.00054464" />
<nuclide ao="1.0" name="He4" />
</material>
<material id="17" name="Zirc4">
<density units="sum" />
<nuclide ao="0.02217" name="Zr90" />
<nuclide ao="0.004781" name="Zr91" />
<nuclide ao="0.007228" name="Zr92" />
<nuclide ao="0.007169" name="Zr94" />
<nuclide ao="0.001131" name="Zr96" />
</material>
</materials>
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>eigenvalue</run_mode>
<particles>1000</particles>
<batches>10</batches>
<inactive>5</inactive>
<source strength="1.0">
<space type="box">
<parameters>-0.9899494936611666 -0.9899494936611666 0.0 0.9899494936611666 0.9899494936611666 10.0</parameters>
</space>
</source>
<output>
<summary>false</summary>
</output>
<seed>22</seed>
</settings>

View file

@ -1,31 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material depletable="true" id="1">
<density units="sum" />
<nuclide ao="0.0049817" name="U235" />
</material>
<material id="2">
<density units="atom/b-cm" value="0.087742" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
<material id="4">
<density units="g/cm3" value="10.32" />
<nuclide ao="0.014" name="Pb204" />
<nuclide ao="0.241" name="Pb206" />
<nuclide ao="0.221" name="Pb207" />
<nuclide ao="0.524" name="Pb208" />
</material>
<material id="6">
<density units="atom/b-cm" value="0.00054464" />
<nuclide ao="1.0" name="He4" />
</material>
<material id="7">
<density units="sum" />
<nuclide ao="0.02217" name="Zr90" />
<nuclide ao="0.004781" name="Zr91" />
<nuclide ao="0.007228" name="Zr92" />
<nuclide ao="0.007169" name="Zr94" />
<nuclide ao="0.001131" name="Zr96" />
</material>
</materials>

View file

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>eigenvalue</run_mode>
<particles>1000</particles>
<batches>10</batches>
<inactive>5</inactive>
<source strength="1.0">
<space type="box">
<parameters>-0.9899494936611666 -0.9899494936611666 0.0 0.9899494936611666 0.9899494936611666 10.0</parameters>
</space>
</source>
<output>
<summary>false</summary>
</output>
<seed>22</seed>
</settings>

View file

@ -1,6 +1,150 @@
from tests.testing_harness import TestHarness
import numpy as np
import openmc
from tests.testing_harness import PyAPITestHarness
class HexLatticeCoincidentTestHarness(PyAPITestHarness):
def _build_inputs(self):
materials = openmc.Materials()
fuel_mat = openmc.Material()
fuel_mat.add_nuclide('U235', 4.9817E-03, 'ao')
materials.append(fuel_mat)
matrix = openmc.Material()
matrix.set_density('atom/b-cm', 8.7742E-02)
matrix.add_element('C', 1.0, 'ao')
matrix.add_s_alpha_beta('c_Graphite')
materials.append(matrix)
lead = openmc.Material(name="Lead")
lead.set_density('g/cm3', 10.32)
lead.add_nuclide('Pb204', 0.014, 'ao')
lead.add_nuclide('Pb206', 0.241, 'ao')
lead.add_nuclide('Pb207', 0.221, 'ao')
lead.add_nuclide('Pb208', 0.524, 'ao')
materials.append(lead)
coolant = openmc.Material()
coolant.set_density('atom/b-cm', 5.4464E-04)
coolant.add_nuclide('He4', 1.0, 'ao')
materials.append(coolant)
zirc = openmc.Material(name="Zirc4")
zirc.add_nuclide('Zr90', 2.217E-02, 'ao')
zirc.add_nuclide('Zr91', 4.781E-03, 'ao')
zirc.add_nuclide('Zr92', 7.228E-03, 'ao')
zirc.add_nuclide('Zr94', 7.169E-03, 'ao')
zirc.add_nuclide('Zr96', 1.131E-03, 'ao')
materials.append(zirc)
materials.export_to_xml()
### Geometry ###
pin_rad = 0.7 # cm
assembly_pitch = 1.4 # cm
cool_rad = 0.293 # cm
zirc_clad_thickness = 0.057 # cm
zirc_ir = cool_rad # cm
zirc_or = cool_rad + zirc_clad_thickness # cm
lead_thickness = 0.002 # cm
lead_ir = zirc_or # cm
lead_or = zirc_or + lead_thickness # cm
cyl = openmc.ZCylinder(x0=0., y0=0., r=pin_rad)
fuel_btm = openmc.ZPlane(z0=0.0, boundary_type = 'reflective')
fuel_top = openmc.ZPlane(z0=10.0, boundary_type = 'reflective')
region = -cyl & +fuel_btm & -fuel_top
container = openmc.Cell(region=region)
container.fill = fuel_mat
fuel_outside = openmc.Cell()
fuel_outside.region = +cyl
fuel_outside.fill = matrix
fuel_ch_univ = openmc.Universe(cells=[container, fuel_outside])
# Coolant Channel
cool_outer = openmc.ZCylinder(x0=0.0, y0=0.0, r=cool_rad)
zirc_outer = openmc.ZCylinder(x0=0.0, y0=0.0, r=zirc_or)
lead_outer = openmc.ZCylinder(x0=0.0, y0=0.0, r=lead_or)
coolant_ch = openmc.Cell(name="coolant")
coolant_ch.region = -cool_outer & +fuel_btm & -fuel_top
coolant_ch.fill = coolant
zirc_shell = openmc.Cell(name="zirconium_shell")
zirc_shell.region = +cool_outer & -zirc_outer & +fuel_btm & -fuel_top
zirc_shell.fill = zirc
lead_shell = openmc.Cell(name="lead_shell")
lead_shell.region = +zirc_outer & -lead_outer & +fuel_btm & -fuel_top
lead_shell.fill = lead
coolant_matrix = openmc.Cell(name="matrix coolant surround")
coolant_matrix.region = +lead_outer & +fuel_btm & -fuel_top
coolant_matrix.fill = matrix
coolant_channel = [coolant_ch, zirc_shell, lead_shell, coolant_matrix]
coolant_univ = openmc.Universe(name="coolant universe")
coolant_univ.add_cells(coolant_channel)
half_width = assembly_pitch # cm
edge_length = (2./np.sqrt(3.0)) * half_width
inf_mat = openmc.Cell()
inf_mat.fill = matrix
inf_mat_univ = openmc.Universe(cells=[inf_mat,])
# a hex surface for the core to go inside of
hexprism = openmc.model.get_hexagonal_prism(edge_length=edge_length,
origin=(0.0, 0.0),
boundary_type = 'reflective',
orientation='x')
pincell_only_lattice = openmc.HexLattice(name="regular fuel assembly")
pincell_only_lattice.center = (0., 0.)
pincell_only_lattice.pitch = (assembly_pitch,)
pincell_only_lattice.outer = inf_mat_univ
# setup hex rings
ring0 = [fuel_ch_univ]
ring1 = [coolant_univ] * 6
pincell_only_lattice.universes = [ring1, ring0]
pincell_only_cell = openmc.Cell(name="container cell")
pincell_only_cell.region = hexprism & +fuel_btm & -fuel_top
pincell_only_cell.fill = pincell_only_lattice
root_univ = openmc.Universe(name="root universe", cells=[pincell_only_cell,])
geom = openmc.Geometry(root_univ)
geom.export_to_xml()
### Settings ###
settings = openmc.Settings()
settings.run_mode = 'eigenvalue'
source = openmc.Source()
corner_dist = np.sqrt(2) * pin_rad
ll = [-corner_dist, -corner_dist, 0.0]
ur = [corner_dist, corner_dist, 10.0]
source.space = openmc.stats.Box(ll, ur)
source.strength = 1.0
settings.source = source
settings.output = {'summary' : False}
settings.batches = 10
settings.inactive = 5
settings.particles = 1000
settings.seed = 22
settings.export_to_xml()
def test_lattice_hex_coincident_surf():
harness = TestHarness('statepoint.10.h5')
harness = HexLatticeCoincidentTestHarness('statepoint.10.h5')
harness.main()