added test for particle restart

This commit is contained in:
Bryan Herman 2013-04-08 08:44:39 -07:00
parent ac1397b3d1
commit ceb5730030
4 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<geometry>
<!-- Nested Cylinders with Tracking Error -->
<surface id="1" type="z-cylinder" coeffs="0.0 0.0 10.0" />
<surface id="2" type="z-cylinder" coeffs="0.0 0.0 20.0" boundary="reflective" />
<surface id="3" type="z-plane" coeffs="5.0" boundary="reflective" />
<surface id="4" type="z-plane" coeffs="-5.0" boundary="reflective" />
<cell id="1" material="1" surfaces="-1 3 -4" />
<cell id="2" material="1" surfaces="1 -2"/>
</geometry>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<materials>
<material id="1">
<density value="4.5" units="g/cc" />
<nuclide name="U-235" xs="70c" ao="1.0" />
</material>
</materials>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<settings>
<eigenvalue>
<batches>10</batches>
<inactive>5</inactive>
<particles>1000</particles>
</eigenvalue>
<source>
<space type="box">
<parameters>-20 -20 -5 20 20 5</parameters>
</space>
</source>
</settings>

View file

@ -0,0 +1,31 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
pwd = os.path.dirname(__file__)
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_run_restart():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_restart():
assert os.path.exists(pwd + '/particle_0.binary')
def teardown():
output = [pwd + '/particle_0.binary']
for f in output:
if os.path.exists(f):
os.remove(f)