Merge branch 'develop' into xml

This commit is contained in:
Bryan Herman 2013-09-03 08:46:04 -04:00
commit c79e21f191
216 changed files with 226668 additions and 223797 deletions

View file

@ -24,7 +24,7 @@ PETSC = no
MPI_DIR = /opt/mpich/3.0.4-$(COMPILER)
HDF5_DIR = /opt/hdf5/1.8.11-$(COMPILER)
PHDF5_DIR = /opt/phdf5/1.8.11-$(COMPILER)
PETSC_DIR = /opt/petsc/3.3-p6-$(COMPILER)
PETSC_DIR = /opt/petsc/3.4.2-$(COMPILER)
#===============================================================================
# Add git SHA-1 hash

View file

@ -1178,8 +1178,14 @@ contains
integer :: NMU ! number of outgoing angles
integer :: JXS4 ! location of elastic energy table
! read secondary energy mode for inelastic scattering
! read secondary energy mode for inelastic scattering and check
table % secondary_mode = NXS(7)
if (table % secondary_mode /= SAB_SECONDARY_EQUAL .and. &
table % secondary_mode /= SAB_SECONDARY_SKEWED) then
message = "Unsupported secondary mode on S(a,b) table " // &
trim(adjustl(table % name)) // ": " // to_str(table % secondary_mode)
call fatal_error()
end if
! read number of inelastic energies and allocate arrays
NE_in = int(XSS(JXS(1)))

View file

@ -17,7 +17,9 @@ contains
! stream.
!===============================================================================
subroutine warning()
subroutine warning(force)
logical, optional :: force ! force write from proc other than master
integer :: i_start ! starting position
integer :: i_end ! ending position
@ -26,7 +28,7 @@ contains
integer :: indent ! length of indentation
! Only allow master to print to screen
if (.not. master) return
if (.not. master .and. .not. present(force)) return
! Write warning at beginning
write(ERROR_UNIT, fmt='(1X,A)', advance='no') 'WARNING: '

View file

@ -1557,7 +1557,7 @@ contains
type(Particle), intent(inout) :: p
! Print warning and write lost particle file
call warning()
call warning(force = .true.)
call write_particle_restart(p)
! Increment number of lost particles

View file

@ -56,7 +56,7 @@ contains
! set up file name
filename = trim(path_output) // 'particle_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_work)) // '.h5'
// '_' // trim(to_str(p % id)) // '.h5'
! create hdf5 file
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, hdf5_particle_file, hdf5_err)
@ -102,7 +102,7 @@ contains
! set up file name
filename = trim(path_output) // 'particle_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_work)) // '.binary'
// '_' // trim(to_str(p % id)) // '.binary'
! create hdf5 file
open(UNIT=UNIT_PARTICLE, FILE=filename, STATUS='replace', &

23
tests/convert_precision.py Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import os
import glob
dirs = glob.glob('test_*')
for adir in dirs:
os.chdir(adir)
files = glob.glob('results.py')
if len(files) > 0:
files = files[0]
with open(files, 'r') as fh:
intxt = fh.read()
intxt = intxt.replace('14.8E', '12.6E')
with open(files, 'w') as fh:
fh.write(intxt)
os.chdir('..')

41
tests/nose_mpi.py Normal file
View file

@ -0,0 +1,41 @@
import os
import logging
from nose.plugins import Plugin
log = logging.getLogger('nose.plugins.nose_mpi')
class NoseMPI(Plugin):
mpi_np = "0"
mpi_exec = "/opt/mpich/3.0.4-gnu/bin/mpiexec"
def options(self, parser, env=os.environ):
"""Define the command line options for plugin."""
super(NoseMPI, self).options(parser, env)
parser.add_option(
"--mpi-np", dest="mpi_np", default=0,
help="Number of MPI processors to execute OpenMC executable.")
parser.add_option(
"--mpi-exec", dest="mpi_exec",
default="/opt/mpich/3.0.4-gnu/bin/mpiexec",
help="Absolute path to mpiexec file.")
def configure(self, options, conf):
"""Configure plugin based on command line options"""
super(NoseMPI, self).configure(options, conf)
try:
mpi_np = int(options.mpi_np)
self.enabled = True
NoseMPI.mpi_np = options.mpi_np
except:
self.enabled = False
return
if not os.path.exists(options.mpi_exec):
print 'Need to specify valid mpiexec path.'
exit()
NoseMPI.mpi_exec = options.mpi_exec

98
tests/run_tests.py Executable file
View file

@ -0,0 +1,98 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import nose
import glob
from subprocess import call
from nose_mpi import NoseMPI
def run_compile():
print('-'*17)
print('Compilation tests')
print('-'*17)
# clean up all previous executables
openmc_exe = glob.glob(pwd + '/../src/openmc*')
for exe in openmc_exe:
os.remove(exe)
# run compile test
result = nose.run(argv=['run_tests.py', 'test_compile'] + flags)
if not result:
print('Did not pass compile tests.')
results.append(('compile', result))
def run_suite(name=None, mpi=False):
print('-'*(len(name) + 6))
print(name + ' tests')
print('-'*(len(name) + 6))
# Set arguments list. Note that the first argument is a dummy argument (the
# script name). It's not actually recursively calling run_tests.py
argv = ['run_tests.py', '--exclude', 'test_compile'] + flags
# Add MPI plugin if set
if mpi:
plugins = [NoseMPI()]
argv += ['--mpi-np', '3', '--mpi-exec', mpiexec]
else:
plugins = None
try:
os.chdir(pwd)
os.rename(pwd + '/../src/openmc-' + name, pwd + '/../src/openmc')
result = nose.run(argv=argv, addplugins=plugins)
finally:
os.rename(pwd + '/../src/openmc', pwd + '/../src/openmc-' + name)
if not result:
print('Did not pass ' + name + ' tests')
results.append((name, result))
# set mpiexec path
mpiexec = '/opt/mpich/3.0.4-gnu/bin/mpiexec'
# get current working directory
pwd = os.getcwd()
sys.path.append(pwd)
# Set list of tests, either default or from command line
flags = []
tests = ['compile', 'gfortran', 'gfortran-dbg', 'gfortran-opt',
'gfortran-hdf5', 'gfortran-mpi', 'gfortran-phdf5',
'gfortran-petsc', 'gfortran-phdf5-petsc',
'gfortran-phdf5-petsc-opt']
if len(sys.argv) > 1:
flags = [i for i in sys.argv[1:] if i.startswith('-')]
tests = [i for i in sys.argv[1:] if not i.startswith('-')]
# Run tests
results = []
for name in tests:
if name == 'compile':
run_compile()
elif name in ['gfortran', 'gfortran-dbg', 'gfortran-opt', 'gfortran-hdf5']:
run_suite(name=name)
elif name in ['gfortran-mpi', 'gfortran-phdf5', 'gfortran-petsc',
'gfortran-phdf5-petsc', 'gfortran-phdf5-petsc-opt']:
run_suite(name=name, mpi=True)
# print out summary of results
print('\n' + '='*54)
print('Summary of Compilation Option Testing:\n')
OK = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
for name, result in results:
print(name + '.'*(50 - len(name)), end='')
if result:
print(BOLD + OK + '[OK]' + ENDC)
else:
print(BOLD + FAIL + '[FAILED]' + ENDC)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.30113528 0.00285456
3.011353E-01 2.854556E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<cmfd>
<mesh>
<lower_left> -10 -1 -1 </lower_left>
<upper_right> 10 1 1 </upper_right>
<dimension> 10 1 1 </dimension>
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
</mesh>
<begin> 5 </begin>
<display> dominance </display>
<solver> power </solver>
<feedback> true </feedback>
</cmfd>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<geometry>
<!-- Definition of Cells -->
<cell id="1">
<universe>0</universe>
<surfaces>-1 2 -3 4 -5 6</surfaces>
<material>1</material>
</cell>
<!-- Defition of Surfaces -->
<surface id="1">
<type>x-plane</type>
<coeffs>10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="2">
<type>x-plane</type>
<coeffs>-10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="3">
<type>y-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="4">
<type>y-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="5">
<type>z-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="6">
<type>z-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
</geometry>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<materials>
<!-- Definition of materials -->
<material id="1">
<density value="19" units="g/cc" />
<nuclide name="U-235" xs="70c" wo="0.21" />
<nuclide name="U-238" xs="70c" wo="0.68" />
<nuclide name="O-16" xs="70c" wo="0.11" />
</material>
</materials>

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python
import sys
import numpy as np
# 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.20.binary')
sp.read_results()
# extract tally results and convert to vector
results1 = sp.tallies[0].results
shape1 = results1.shape
size1 = (np.product(shape1))
results1 = np.reshape(results1, size1)
results2 = sp.tallies[1].results
shape2 = results2.shape
size2 = (np.product(shape2))
results2 = np.reshape(results2, size2)
results3 = sp.tallies[2].results
shape3 = results3.shape
size3 = (np.product(shape3))
results3 = np.reshape(results3, size3)
results4 = sp.tallies[3].results
shape4 = results4.shape
size4 = (np.product(shape4))
results4 = np.reshape(results4, size4)
# 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 out tally results
outstr += 'tally 1:\n'
for item in results1:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 2:\n'
for item in results2:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 3:\n'
for item in results3:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 4:\n'
for item in results4:
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)

View file

@ -0,0 +1,654 @@
k-combined:
1.167124E+00 1.217343E-02
tally 1:
1.126891E+01
1.275755E+01
2.086556E+01
4.369501E+01
2.853629E+01
8.169559E+01
3.404506E+01
1.165019E+02
3.723908E+01
1.389881E+02
3.760048E+01
1.416691E+02
3.455469E+01
1.197186E+02
2.837503E+01
8.086291E+01
2.151789E+01
4.648315E+01
1.194541E+01
1.432331E+01
tally 2:
2.292173E+01
2.650792E+01
1.598183E+01
1.288692E+01
2.194143E+00
2.510557E-01
4.217816E+01
8.938583E+01
2.974466E+01
4.447038E+01
3.939269E+00
7.882413E-01
5.742289E+01
1.654599E+02
4.067581E+01
8.308454E+01
5.566955E+00
1.570072E+00
6.810586E+01
2.331019E+02
4.831543E+01
1.174673E+02
6.244999E+00
1.967938E+00
7.258131E+01
2.646756E+02
5.185146E+01
1.351425E+02
6.622488E+00
2.231695E+00
7.246115E+01
2.641295E+02
5.159542E+01
1.339441E+02
6.702239E+00
2.277825E+00
6.716397E+01
2.266815E+02
4.765063E+01
1.141627E+02
6.384098E+00
2.063760E+00
5.549542E+01
1.545361E+02
3.940819E+01
7.794880E+01
5.183375E+00
1.369483E+00
4.155685E+01
8.679439E+01
2.926744E+01
4.307145E+01
3.938852E+00
7.877949E-01
2.335180E+01
2.758241E+01
1.622683E+01
1.331996E+01
2.248921E+00
2.594934E-01
tally 3:
1.537807E+01
1.193746E+01
1.044189E+00
5.627797E-02
2.861614E+01
4.118322E+01
1.846208E+00
1.729007E-01
3.921462E+01
7.723576E+01
2.427723E+00
2.983153E-01
4.653207E+01
1.089818E+02
3.128394E+00
4.945409E-01
4.989896E+01
1.251503E+02
3.242191E+00
5.330743E-01
4.967378E+01
1.241657E+02
3.184751E+00
5.164524E-01
4.592989E+01
1.061019E+02
2.936424E+00
4.356307E-01
3.783939E+01
7.188489E+01
2.485680E+00
3.117618E-01
2.819358E+01
3.997588E+01
1.875908E+00
1.772000E-01
1.562421E+01
1.236020E+01
1.013140E+00
5.260420E-02
tally 4:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.126365E+00
4.930682E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.456410E+00
1.499416E+00
2.727755E+00
3.788867E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.453480E+00
2.790159E+00
5.240103E+00
1.386895E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.741563E+00
3.830225E+00
7.137968E+00
2.555042E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.221731E+00
4.266573E+00
8.474116E+00
3.604647E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.054937E+00
4.124537E+00
9.066119E+00
4.133833E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.362253E+00
3.517245E+00
9.086548E+00
4.156118E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
6.871573E+00
2.369190E+00
8.399584E+00
3.549784E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.998103E+00
1.258194E+00
7.145296E+00
2.568115E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.716076E+00
3.753568E-01
5.427593E+00
1.484154E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.056645E+00
4.702349E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<!-- Parameters for criticality calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>1000</particles>
</eigenvalue>
<!-- How verbose output should be -->
<verbosity value="7" />
<!-- Starting source -->
<source>
<space>
<type>box</type>
<parameters>-10 -1 -1 10 1 1</parameters>
</space>
</source>
<!-- Shannon Entropy -->
<entropy>
<dimension> 10 1 1 </dimension>
<lower_left> -10.0 -1.0 -1.0 </lower_left>
<upper_right> 10.0 1.0 1.0 </upper_right>
</entropy>
<!-- Run CMFD -->
<run_cmfd> true </run_cmfd>
</settings>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<tallies>
<mesh id="1">
<type>rectangular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>
</mesh>
<tally id="1">
<filter type="mesh" bins="1" />
<scores>flux</scores>
</tally>
</tallies>

View file

@ -0,0 +1,66 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from nose.plugins.skip import SkipTest
from nose_mpi import NoseMPI
pwd = os.path.dirname(__file__)
skipAll = False
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
output = proc.communicate()[0]
print(output)
if 'CMFD is not available' in output:
global skipAll
skipAll = True
raise SkipTest
assert returncode == 0
def test_created_statepoint():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
if skipAll:
raise SkipTest
assert os.path.exists(pwd + '/tallies.out')
def test_results():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
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
def teardown():
output = glob.glob(pwd + '/statepoint.20.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<cmfd>
<mesh>
<lower_left> -10 -1 -1 </lower_left>
<upper_right> 10 1 1 </upper_right>
<dimension> 10 1 1 </dimension>
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
</mesh>
<begin> 5 </begin>
<display> dominance </display>
<solver> power </solver>
<feedback> false </feedback>
</cmfd>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<geometry>
<!-- Definition of Cells -->
<cell id="1">
<universe>0</universe>
<surfaces>-1 2 -3 4 -5 6</surfaces>
<material>1</material>
</cell>
<!-- Defition of Surfaces -->
<surface id="1">
<type>x-plane</type>
<coeffs>10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="2">
<type>x-plane</type>
<coeffs>-10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="3">
<type>y-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="4">
<type>y-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="5">
<type>z-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="6">
<type>z-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
</geometry>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<materials>
<!-- Definition of materials -->
<material id="1">
<density value="19" units="g/cc" />
<nuclide name="U-235" xs="70c" wo="0.21" />
<nuclide name="U-238" xs="70c" wo="0.68" />
<nuclide name="O-16" xs="70c" wo="0.11" />
</material>
</materials>

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python
import sys
import numpy as np
# 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.20.binary')
sp.read_results()
# extract tally results and convert to vector
results1 = sp.tallies[0].results
shape1 = results1.shape
size1 = (np.product(shape1))
results1 = np.reshape(results1, size1)
results2 = sp.tallies[1].results
shape2 = results2.shape
size2 = (np.product(shape2))
results2 = np.reshape(results2, size2)
results3 = sp.tallies[2].results
shape3 = results3.shape
size3 = (np.product(shape3))
results3 = np.reshape(results3, size3)
results4 = sp.tallies[3].results
shape4 = results4.shape
size4 = (np.product(shape4))
results4 = np.reshape(results4, size4)
# 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 out tally results
outstr += 'tally 1:\n'
for item in results1:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 2:\n'
for item in results2:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 3:\n'
for item in results3:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 4:\n'
for item in results4:
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)

View file

@ -0,0 +1,654 @@
k-combined:
1.137460E+00 1.215114E-02
tally 1:
1.168490E+01
1.400522E+01
2.192157E+01
4.824543E+01
2.936949E+01
8.648246E+01
3.435607E+01
1.185184E+02
3.612841E+01
1.309721E+02
3.552232E+01
1.266988E+02
3.314322E+01
1.107274E+02
2.765588E+01
7.705156E+01
2.044445E+01
4.210167E+01
1.125932E+01
1.276689E+01
tally 2:
2.372613E+01
2.862691E+01
1.660400E+01
1.404387E+01
2.237703E+00
2.562122E-01
4.397041E+01
9.722086E+01
3.107800E+01
4.859826E+01
4.052018E+00
8.364586E-01
5.850026E+01
1.715533E+02
4.157400E+01
8.666187E+01
5.420325E+00
1.492090E+00
6.875182E+01
2.377104E+02
4.875600E+01
1.196878E+02
6.167355E+00
1.922001E+00
7.240156E+01
2.639189E+02
5.161800E+01
1.342800E+02
6.657325E+00
2.248300E+00
7.074222E+01
2.516854E+02
5.016500E+01
1.266005E+02
6.598272E+00
2.224189E+00
6.625191E+01
2.209754E+02
4.694400E+01
1.110192E+02
6.197674E+00
1.947375E+00
5.574790E+01
1.561211E+02
3.963100E+01
7.893339E+01
5.104628E+00
1.314367E+00
4.068463E+01
8.316576E+01
2.878400E+01
4.165629E+01
4.000895E+00
8.100229E-01
2.238335E+01
2.532998E+01
1.555300E+01
1.221694E+01
2.312206E+00
2.751529E-01
tally 3:
1.599200E+01
1.304060E+01
1.075546E+00
5.989825E-02
2.991600E+01
4.504778E+01
2.016558E+00
2.060921E-01
4.008500E+01
8.057644E+01
2.465241E+00
3.073562E-01
4.690900E+01
1.108192E+02
3.050094E+00
4.696181E-01
4.972600E+01
1.246434E+02
3.127136E+00
4.939882E-01
4.836400E+01
1.176964E+02
3.102574E+00
4.868820E-01
4.524800E+01
1.031819E+02
2.966738E+00
4.482948E-01
3.809700E+01
7.295318E+01
2.526411E+00
3.226394E-01
2.772600E+01
3.866039E+01
1.852304E+00
1.725388E-01
1.494500E+01
1.129101E+01
9.995136E-01
5.115569E-02
tally 4:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.251000E+00
5.355770E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.759000E+00
1.676451E+00
2.883000E+00
4.269210E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.633000E+00
2.922951E+00
5.354000E+00
1.442474E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.787000E+00
3.871605E+00
7.137000E+00
2.553987E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.343000E+00
4.385923E+00
8.470000E+00
3.603838E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.076000E+00
4.142704E+00
8.977000E+00
4.056459E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.252000E+00
3.428360E+00
8.957000E+00
4.041545E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
6.868000E+00
2.375736E+00
8.404000E+00
3.562144E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.914000E+00
1.211724E+00
7.074000E+00
2.511368E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.634000E+00
3.523220E-01
5.349000E+00
1.437693E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.050000E+00
4.687600E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<!-- Parameters for criticality calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>1000</particles>
</eigenvalue>
<!-- How verbose output should be -->
<verbosity value="7" />
<!-- Starting source -->
<source>
<space>
<type>box</type>
<parameters>-10 -1 -1 10 1 1</parameters>
</space>
</source>
<!-- Shannon Entropy -->
<entropy>
<dimension> 10 1 1 </dimension>
<lower_left> -10.0 -1.0 -1.0 </lower_left>
<upper_right> 10.0 1.0 1.0 </upper_right>
</entropy>
<!-- Run CMFD -->
<run_cmfd> true </run_cmfd>
</settings>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<tallies>
<mesh id="1">
<type>rectangular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>
</mesh>
<tally id="1">
<filter type="mesh" bins="1" />
<scores>flux</scores>
</tally>
</tallies>

View file

@ -0,0 +1,65 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from nose.plugins.skip import SkipTest
from nose_mpi import NoseMPI
pwd = os.path.dirname(__file__)
skipAll = False
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
output = proc.communicate()[0]
print(output)
if 'CMFD is not available' in output:
global skipAll
skipAll = True
raise SkipTest
assert returncode == 0
def test_created_statepoint():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
if skipAll:
raise SkipTest
assert os.path.exists(pwd + '/tallies.out')
def test_results():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
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
def teardown():
output = glob.glob(pwd + '/statepoint.20.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -29,6 +29,7 @@ def test_gfortran_debug():
returncode = run(['make','distclean'])
returncode = run(['make', 'DEBUG=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-dbg')
def test_gfortran_profile():
returncode = run(['make','distclean'])
@ -39,76 +40,43 @@ def test_gfortran_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-opt')
def test_gfortran_mpi():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-mpi')
def test_gfortran_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-hdf5')
def test_gfortran_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-petsc')
def test_gfortran_mpi_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5')
def test_gfortran_mpi_hdf5_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5-petsc')
def test_intel():
def test_gfortran_mpi_hdf5_petsc_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel'])
assert returncode == 0
def test_intel_debug():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'DEBUG=yes'])
assert returncode == 0
def test_intel_profile():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'PROFILE=yes'])
assert returncode == 0
def test_intel_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'OPTIMIZE=yes'])
assert returncode == 0
def test_intel_mpi():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes'])
assert returncode == 0
def test_intel_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'HDF5=yes'])
assert returncode == 0
def test_intel_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'PETSC=yes'])
assert returncode == 0
def test_intel_mpi_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'HDF5=yes'])
assert returncode == 0
def test_intel_mpi_hdf5_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran-phdf5-petsc-opt')
def run(commands):
proc = Popen(commands, stderr=STDOUT, stdout=PIPE)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,5 +1,5 @@
k-combined:
0.29371031 0.00739160
2.937103E-01 7.391597E-03
tallies:
62.67770579
492.80295648
6.267771E+01
4.928030E+02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,27 +13,36 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_created_output():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
output.append(pwd + '/tallies.out')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
1.73961429 0.01281892
1.739614E+00 1.281892E-02

View file

@ -1,33 +1,44 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
1.08146351 0.02283652
1.081464E+00 2.283652E-02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob('statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.80588796 0.00512148
8.058880E-01 5.121476E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.31665691 0.00636741
3.166569E-01 6.367411E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob('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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.7.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.7.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.30043746 0.00230870
3.004375E-01 2.308696E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.7.binary')
statepoint = glob.glob(pwd + '/statepoint.7.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.7.*')
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
def teardown():
output = [pwd + '/statepoint.7.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.7.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.31185079 0.00676453
3.118508E-01 6.764530E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.32430182 0.00096736
3.243018E-01 9.673636E-04

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -16,12 +19,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'entropy:\n'
for item in sp.entropy:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,13 +1,13 @@
k-combined:
0.30113528 0.00285456
3.011353E-01 2.854556E-03
entropy:
7.11451332
8.05560155
8.23397277
8.23557155
8.28448354
8.28984841
8.42007985
8.27943150
8.29999736
8.36396839
7.114513E+00
8.055602E+00
8.233973E+00
8.235572E+00
8.284484E+00
8.289848E+00
8.420080E+00
8.279431E+00
8.299997E+00
8.363968E+00

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
0.00000000
0.00000000
18.82286226
72.03127513
4.03592017
3.30960729
56.15335982
641.42946960
0.000000E+00
0.000000E+00
1.882286E+01
7.203128E+01
4.035920E+00
3.309607E+00
5.615336E+01
6.414295E+02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
0.00000000
0.00000000
91.12132788
1691.91742599
0.00000000
0.00000000
0.00000000
0.00000000
0.000000E+00
0.000000E+00
9.112133E+01
1.691917E+03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
32.64739927
215.66831301
43.90484994
388.17393630
50.74294368
516.93670081
10.05233017
20.30524675
3.264740E+01
2.156683E+02
4.390485E+01
3.881739E+02
5.074294E+01
5.169367E+02
1.005233E+01
2.030525E+01

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
32.68000000
216.39020000
43.50000000
380.24020000
51.33000000
528.74330000
6.62000000
8.82700000
3.268000E+01
2.163902E+02
4.350000E+01
3.802402E+02
5.133000E+01
5.287433E+02
6.620000E+00
8.827000E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,67 +1,67 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
30.03000000
183.35510000
0.00000000
0.00000000
0.04000000
0.00040000
0.00000000
0.00000000
0.00000000
0.00000000
0.77446136
0.12571254
0.00000000
0.00000000
2.15557882
0.96830054
2.65000000
1.41390000
0.00000000
0.00000000
38.97000000
305.38850000
0.00000000
0.00000000
0.00000000
0.00000000
0.27919994
0.01768291
0.00000000
0.00000000
0.67147652
0.09169556
0.00000000
0.00000000
0.00000000
0.00000000
4.49000000
4.03650000
0.00000000
0.00000000
47.94000000
461.47120000
0.01733787
0.00030060
0.00000000
0.00000000
0.08687216
0.00220468
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
3.39000000
2.31650000
0.12897774
0.00405715
6.62000000
8.82700000
0.31877323
0.02168587
3.003000E+01
1.833551E+02
0.000000E+00
0.000000E+00
4.000000E-02
4.000000E-04
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.744614E-01
1.257125E-01
0.000000E+00
0.000000E+00
2.155579E+00
9.683005E-01
2.650000E+00
1.413900E+00
0.000000E+00
0.000000E+00
3.897000E+01
3.053885E+02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.791999E-01
1.768291E-02
0.000000E+00
0.000000E+00
6.714765E-01
9.169556E-02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.490000E+00
4.036500E+00
0.000000E+00
0.000000E+00
4.794000E+01
4.614712E+02
1.733787E-02
3.006016E-04
0.000000E+00
0.000000E+00
8.687216E-02
2.204684E-03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.390000E+00
2.316500E+00
1.289777E-01
4.057153E-03
6.620000E+00
8.827000E+00
3.187732E-01
2.168587E-02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
27.75440762
154.83131712
6.47809111
8.42933435
66.33549411
889.14780763
28.94858797
172.85306981
2.775441E+01
1.548313E+02
6.478091E+00
8.429334E+00
6.633549E+01
8.891478E+02
2.894859E+01
1.728531E+02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

File diff suppressed because it is too large Load diff

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

File diff suppressed because it is too large Load diff

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
76.34206724
1184.75098610
9.28488884
17.65553583
33.12780146
225.26612084
3.62384871
2.75301569
7.634207E+01
1.184751E+03
9.284889E+00
1.765554E+01
3.312780E+01
2.252661E+02
3.623849E+00
2.753016E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -23,7 +26,7 @@ outstr = ''
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,3 +1,3 @@
tallies:
453.85329674
20667.76024307
4.538533E+02
2.066776E+04

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
1.09426709 0.07838238
1.094267E+00 7.838238E-02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
1.01244319 0.02162448
1.012443E+00 2.162448E-02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
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
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
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:

View file

@ -1,2 +1,2 @@
k-combined:
0.30113528 0.00285456
3.011353E-01 2.854556E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,30 +13,42 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_summary_exists():
assert os.path.exists(pwd + '/summary.out')
summary = glob.glob(pwd + '/summary.*')
assert len(summary) == 1
assert summary[0].endswith('out') or summary[0].endswith('h5')
def test_cross_sections_exists():
assert os.path.exists(pwd + '/cross_sections.out')
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/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
def teardown():
output = [pwd + i for i in ['/statepoint.10.binary', '/summary.out',
'/cross_sections.out', '/results_test.dat']]
output = glob.glob(pwd + '/statepoint.10.*') + glob.glob(pwd + '/summary.*')
output.append(pwd + '/summary.out')
output.append(pwd + '/cross_sections.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,26 +7,29 @@ sys.path.append('../../src/utils')
import particle_restart as pr
# read in particle restart file
p = pr.Particle('particle_10_394.binary')
if len(sys.argv) > 1:
p = pr.Particle(sys.argv[1])
else:
p = pr.Particle('particle_10_394.binary')
# set up output string
outstr = ''
# write out properties
outstr += 'current batch:\n'
outstr += "{0:10.8f}\n".format(p.current_batch)
outstr += "{0:12.6E}\n".format(p.current_batch)
outstr += 'current gen:\n'
outstr += "{0:10.8f}\n".format(p.current_gen)
outstr += "{0:12.6E}\n".format(p.current_gen)
outstr += 'particle id:\n'
outstr += "{0:10.8f}\n".format(p.id)
outstr += "{0:12.6E}\n".format(p.id)
outstr += 'particle weight:\n'
outstr += "{0:10.8f}\n".format(p.weight)
outstr += "{0:12.6E}\n".format(p.weight)
outstr += 'particle energy:\n'
outstr += "{0:10.8f}\n".format(p.energy)
outstr += "{0:12.6E}\n".format(p.energy)
outstr += 'particle xyz:\n'
outstr += "{0:10.8f} {1:10.8f} {2:10.8f}\n".format(p.xyz[0],p.xyz[1],p.xyz[2])
outstr += "{0:12.6E} {1:12.6E} {2:12.6E}\n".format(p.xyz[0],p.xyz[1],p.xyz[2])
outstr += 'particle uvw:\n'
outstr += "{0:10.8f} {1:10.8f} {2:10.8f}\n".format(p.uvw[0],p.uvw[1],p.uvw[2])
outstr += "{0:12.6E} {1:12.6E} {2:12.6E}\n".format(p.uvw[0],p.uvw[1],p.uvw[2])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,14 +1,14 @@
current batch:
10.00000000
1.000000E+01
current gen:
1.00000000
1.000000E+00
particle id:
394.00000000
3.940000E+02
particle weight:
1.00000000
1.000000E+00
particle energy:
2.15463975
2.154640E+00
particle xyz:
13.20547715 -26.77009496 -66.17908254
1.320548E+01 -2.677009E+01 -6.617908E+01
particle uvw:
0.34615091 -0.88471641 -0.31218012
3.461509E-01 -8.847164E-01 -3.121801E-01

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -12,28 +13,40 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=PIPE, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=PIPE, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=PIPE, stdout=PIPE)
stdout, stderr = proc.communicate()
assert stderr != ''
assert stderr != ''
def test_created_restart():
assert os.path.exists(pwd + '/particle_10_394.binary')
particle = glob.glob(pwd + '/particle_10_394.*')
assert len(particle) == 1
assert particle[0].endswith('binary') or \
particle[0].endswith('h5')
def test_results():
os.system('python results.py')
particle = glob.glob(pwd + '/particle_10_394.*')
call(['python', 'results.py', particle[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def test_run_restart():
proc = Popen([pwd + '/../../src/openmc -r particle_10_394.binary'],
particle = glob.glob(pwd + '/particle_10_394.*')
proc = Popen([pwd + '/../../src/openmc -r ' + particle[0]],
stderr=PIPE, stdout=PIPE, shell=True)
stdout, stderr = proc.communicate()
assert stderr == ''
def teardown():
output = glob.glob(pwd + '/particle_*.binary') + [pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.*') + \
glob.glob(pwd + '/particle_*') + \
[pwd + '/results_test.dat']
for f in output:
if os.path.exists(f):
os.remove(f)

Some files were not shown because too many files have changed in this diff Show more