Convert eigenvalue_genperbatch test to use PyAPITestHarness

This commit is contained in:
Paul Romano 2020-01-07 12:26:15 -06:00
parent 55ca9fe7f8
commit 9128f3e0ac
5 changed files with 54 additions and 36 deletions

View file

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<geometry>
<!-- Sphere with radius 10 -->
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
<cell id="1" material="1" region="-1" />
</geometry>

View file

@ -0,0 +1,25 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="1" material="1" region="-1" universe="1" />
<surface boundary="vacuum" coeffs="0.0 0.0 0.0 10.0" id="1" type="sphere" />
</geometry>
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material depletable="true" id="1">
<density units="g/cm3" value="4.5" />
<nuclide ao="1.0" name="U235" />
</material>
</materials>
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>eigenvalue</run_mode>
<particles>1000</particles>
<batches>7</batches>
<inactive>3</inactive>
<generations_per_batch>3</generations_per_batch>
<source strength="1.0">
<space type="box">
<parameters>-4.0 -4.0 -4.0 4.0 4.0 4.0</parameters>
</space>
</source>
</settings>

View file

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

View file

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<settings>
<run_mode>eigenvalue</run_mode>
<batches>7</batches>
<inactive>3</inactive>
<particles>1000</particles>
<generations_per_batch>3</generations_per_batch>
<source>
<space type="box">
<parameters>-4 -4 -4 4 4 4</parameters>
</space>
</source>
</settings>

View file

@ -1,6 +1,32 @@
from tests.testing_harness import TestHarness
import openmc
import pytest
from tests.testing_harness import PyAPITestHarness
def test_eigenvalue_genperbatch():
harness = TestHarness('statepoint.7.h5')
@pytest.fixture
def model():
model = openmc.model.Model()
m = openmc.Material()
m.set_density('g/cm3', 4.5)
m.add_nuclide('U235', 1.0)
model.materials.append(m)
sph = openmc.Sphere(r=10.0, boundary_type='vacuum')
c = openmc.Cell(fill=m, region=-sph)
model.geometry = openmc.Geometry([c])
model.settings.particles = 1000
model.settings.inactive = 3
model.settings.batches = 7
model.settings.generations_per_batch = 3
space = openmc.stats.Box((-4.0, -4.0, -4.0), (4.0, 4.0, 4.))
model.settings.source = openmc.Source(space=space)
return model
def test_eigenvalue_genperbatch(model):
harness = PyAPITestHarness('statepoint.7.h5', model)
harness.main()