Skip to content

Commit

Permalink
Added hex_lattice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smharper committed Sep 6, 2014
1 parent fdba574 commit f6b7f5f
Show file tree
Hide file tree
Showing 14 changed files with 12,927 additions and 0 deletions.
12,422 changes: 12,422 additions & 0 deletions tests/test_lattice_hex/geometry.xml

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions tests/test_lattice_hex/materials.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<materials>

<!-- Material 01: Water -->
<material id="01">
<density value="0.998" units="g/cc"/>
<nuclide name="H-1" xs="71c" ao="2.0"/>
<nuclide name="O-16" xs="71c" ao="1.0"/>
<nuclide name="B-10" xs="71c" ao="0.00085"/>
</material>

<!-- Material 13: Fuel (3.30%) -->
<material id="13">
<density value="10.371" units="g/cc"/>
<nuclide name="U-235" xs="71c" ao="0.033408078"/>
<nuclide name="U-238" xs="71c" ao="0.966591922"/>
<nuclide name="O-16" xs="71c" ao="2.0"/>
</material>

<!-- Material 21: Zircaloy -->
<material id="21">
<density value="6.44" units="g/cc" />
<nuclide name="Zr-90" xs="71c" wo="0.501807"/>
<nuclide name="Zr-91" xs="71c" wo="0.110712"/>
<nuclide name="Zr-92" xs="71c" wo="0.170991"/>
<nuclide name="Zr-94" xs="71c" wo="0.177057"/>
<nuclide name="Zr-96" xs="71c" wo="0.029133"/>
</material>

<!-- Material 22: Steel -->
<material id="22">
<density value="7.9" units="g/cc"/>
<nuclide name="Mn-55" xs="71c" wo="2"/>
<nuclide name="Ni-58" xs="71c" wo="6.83"/>
<nuclide name="Ni-60" xs="71c" wo="2.61"/>
<nuclide name="Cr-53" xs="71c" wo="1.71"/>
<nuclide name="Fe-54" xs="71c" wo="3.98257"/>
<nuclide name="Fe-56" xs="71c" wo="63.03447"/>
<nuclide name="Fe-57" xs="71c" wo="1.4763"/>
</material>

</materials>
32 changes: 32 additions & 0 deletions tests/test_lattice_hex/plots.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<plots>

<plot id="1" type="slice" basis="xy" color="cell">
<filename>xy_cell</filename>
<origin>0 0 0</origin>
<width>30 30</width>
<pixels>500 500</pixels>
</plot>

<plot id="2" type="slice" basis="xy" color="material">
<filename>xy_material</filename>
<origin>0 0 0</origin>
<width>30 30</width>
<pixels>500 500</pixels>
</plot>

<plot id="3" type="slice" basis="yz" color="cell">
<filename>yz_cell</filename>
<origin>0 0 0</origin>
<width>50 400</width>
<pixels>500 4000</pixels>
</plot>

<plot id="4" type="slice" basis="yz" color="material">
<filename>yz_material</filename>
<origin>0 0 0</origin>
<width>5 5</width>
<pixels>500 500</pixels>
</plot>

</plots>
25 changes: 25 additions & 0 deletions tests/test_lattice_hex/results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python

import sys

# import statepoint
sys.path.append('../../src/utils')
import statepoint

# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()

# set up output string
outstr = ''

# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])

# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)
2 changes: 2 additions & 0 deletions tests/test_lattice_hex/results_true.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
k-combined:
9.449180E-01 5.083389E-02
15 changes: 15 additions & 0 deletions tests/test_lattice_hex/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<eigenvalue>
<batches>10</batches>
<inactive>5</inactive>
<particles>500</particles>
</eigenvalue>

<source>
<space type="box">
<parameters>-8.0 -8.0 -176
8.0 8.0 176</parameters>
</space>
</source>
</settings>
59 changes: 59 additions & 0 deletions tests/test_lattice_hex/test_lattice_hex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python

import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from optparse import OptionParser

parser = OptionParser()
parser.add_option('--mpi_exec', dest='mpi_exec', default='')
parser.add_option('--mpi_np', dest='mpi_np', default='3')
parser.add_option('--exe', dest='exe')
(opts, args) = parser.parse_args()
cwd = os.getcwd()

def test_run():
if opts.mpi_exec != '':
proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE)
print(proc.communicate()[0])
returncode = proc.returncode
assert returncode == 0, 'OpenMC did not exit successfully.'

def test_created_statepoint():
statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
'Statepoint file is not a binary or hdf5 file.'

def test_results():
statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare, 'Results do not agree.'

def teardown():
output = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
output.append(os.path.join(cwd, 'results_test.dat'))
for f in output:
if os.path.exists(f):
os.remove(f)

if __name__ == '__main__':

# test for openmc executable
if opts.exe is None:
raise Exception('Must specify OpenMC executable from command line with --exe.')

# run tests
try:
test_run()
test_created_statepoint()
test_results()
finally:
teardown()
155 changes: 155 additions & 0 deletions tests/test_lattice_mixed/geometry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
This geometry approximately describes a Russian-style VVER-1000 fuel assembly.
-->

<geometry>
<surface id="001" type="z-plane" coeffs="-10000"/>

<!-- Universe 011: Fuel pellet -->
<surface id="011" type="z-cylinder" coeffs="0.0 0.0 0.06"/>
<surface id="012" type="z-cylinder" coeffs="0.0 0.0 0.378"/>
<surface id="013" type="z-cylinder" coeffs="0.0 0.0 0.3865"/>
<surface id="014" type="z-cylinder" coeffs="0.0 0.0 0.455"/>
<surface id="015" type="sphere" coeffs="0.0 0.0 -2.5639 2.0"/>
<surface id="016" type="sphere" coeffs="0.0 0.0 2.5639 2.0"/>

<cell id="011" universe="011" material="void" surfaces="-011"/>
<cell id="012" universe="011" material="13" surfaces="011 -012 015 016"/>
<cell id="013" universe="011" material="void" surfaces="011 -012 -015"/>
<cell id="014" universe="011" material="void" surfaces="011 -012 -016"/>
<cell id="015" universe="011" material="void" surfaces="012 -013"/>
<cell id="016" universe="011" material="21" surfaces="013 -014"/>
<cell id="017" universe="011" material="01" surfaces="014"/>


<!-- Universe 051: Central guide tube -->
<surface id="051" type="z-cylinder" coeffs="0.0 0.0 0.44"/>
<surface id="052" type="z-cylinder" coeffs="0.0 0.0 0.515"/>
<cell id="051" universe="051" material="01" surfaces="-051"/>
<cell id="052" universe="051" material="21" surfaces="051 -052"/>
<cell id="053" universe="051" material="01" surfaces="052"/>


<!-- Universe 055: Cluster tube -->
<surface id="155" type="z-cylinder" coeffs="0.0 0.0 0.55"/>
<surface id="156" type="z-cylinder" coeffs="0.0 0.0 0.63"/>
<cell id="155" universe="055" material="01" surfaces="-155"/>
<cell id="156" universe="055" material="22" surfaces="155 -156"/>
<cell id="157" universe="055" material="01" surfaces="156"/>




<!-- Lattice 101: Fuel assembly pins -->
<hex_lattice id="101" outside="01" n_rings="11"
center="0.0 0.0" pitch="0.6325">
<universes>
011
011 011
011 011 011
011 011 011 011
011 011 011 011 011
011 011 011 011 011 011
011 011 011 011 011 011 011
011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 055 011 011 011 011 011
011 011 011 055 011 011 055 011 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 055 011 011 055 011 055 011 011
011 011 011 011 055 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 055 011 011 011
011 011 055 011 011 051 011 011 055 011 011
011 011 011 055 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 055 011 011 011 011
011 011 055 011 055 011 011 055 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011 011
011 011 011 055 011 011 055 011 011 011
011 011 011 011 011 055 011 011 011 011 011
011 011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011 011
011 011 011 011 011 011 011 011
011 011 011 011 011 011 011
011 011 011 011 011 011
011 011 011 011 011
011 011 011 011
011 011 011
011 011
011
</universes>
</hex_lattice>

<cell id="102" universe="102" fill="101" surfaces="001"/>

<lattice id="103" outside="01" dimension="1 1 294"
lower_left="-25.0 -25.0 -177.0" pitch="50.0 50.0 1.2">
<universes>
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102

102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102

102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102 102 102 102 102 102 102
102 102 102 102
</universes>
</lattice>




<!-- Universe 0 -->
<surface id="1001" type="plane" coeffs="1.0 0.0 0.0 11.8"
boundary="reflective"/>
<surface id="1002" type="plane" coeffs="0.5 0.866 0.0 11.8"
boundary="reflective"/>
<surface id="1003" type="plane" coeffs="-0.5 0.866 0.0 11.8"
boundary="reflective"/>
<surface id="1004" type="plane" coeffs="-1.0 0.0 0.0 11.8"
boundary="reflective"/>
<surface id="1005" type="plane" coeffs="-0.5 -0.866 0.0 11.8"
boundary="reflective"/>
<surface id="1006" type="plane" coeffs="0.5 -0.866 0.0 11.8"
boundary="reflective"/>
<surface id="1007" type="z-plane" coeffs="-177.4" boundary="vacuum"/>
<surface id="1008" type="z-plane" coeffs="177.4" boundary="vacuum"/>

<cell id="1001" universe="0" fill="103"
surfaces="-1001 -1002 -1003 -1004 -1005 -1006 1007 -1008"/>

</geometry>
42 changes: 42 additions & 0 deletions tests/test_lattice_mixed/materials.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<materials>

<!-- Material 01: Water -->
<material id="01">
<density value="0.998" units="g/cc"/>
<nuclide name="H-1" xs="71c" ao="2.0"/>
<nuclide name="O-16" xs="71c" ao="1.0"/>
<nuclide name="B-10" xs="71c" ao="0.00085"/>
</material>

<!-- Material 13: Fuel (3.30%) -->
<material id="13">
<density value="10.371" units="g/cc"/>
<nuclide name="U-235" xs="71c" ao="0.033408078"/>
<nuclide name="U-238" xs="71c" ao="0.966591922"/>
<nuclide name="O-16" xs="71c" ao="2.0"/>
</material>

<!-- Material 21: Zircaloy -->
<material id="21">
<density value="6.44" units="g/cc" />
<nuclide name="Zr-90" xs="71c" wo="0.501807"/>
<nuclide name="Zr-91" xs="71c" wo="0.110712"/>
<nuclide name="Zr-92" xs="71c" wo="0.170991"/>
<nuclide name="Zr-94" xs="71c" wo="0.177057"/>
<nuclide name="Zr-96" xs="71c" wo="0.029133"/>
</material>

<!-- Material 22: Steel -->
<material id="22">
<density value="7.9" units="g/cc"/>
<nuclide name="Mn-55" xs="71c" wo="2"/>
<nuclide name="Ni-58" xs="71c" wo="6.83"/>
<nuclide name="Ni-60" xs="71c" wo="2.61"/>
<nuclide name="Cr-53" xs="71c" wo="1.71"/>
<nuclide name="Fe-54" xs="71c" wo="3.98257"/>
<nuclide name="Fe-56" xs="71c" wo="63.03447"/>
<nuclide name="Fe-57" xs="71c" wo="1.4763"/>
</material>

</materials>
Loading

0 comments on commit f6b7f5f

Please sign in to comment.