Skip to content

Commit 5dea22b

Browse files
added two periodic cylinders with 1/6th symmetry to regression tests. they should generate the same answers, need to run transport to get the results_true.dat
1 parent bcd691a commit 5dea22b

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

tests/regression_tests/periodic_cyls/__init__.py

Whitespace-only changes.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import openmc
2+
import numpy
3+
import pytest
4+
5+
from tests.testing_harness import PyAPITestHarness
6+
7+
8+
@pytest.fixture
9+
def xcyl_model():
10+
model = openmc.Model()
11+
# Define materials
12+
fuel = openmc.Material()
13+
fuel.add_nuclide('U235', 0.2)
14+
fuel.add_nuclide('U238', 0.8)
15+
fuel.set_density('g/cc', 19.1)
16+
model.materials = openmc.Materials([fuel])
17+
18+
# Define geometry
19+
# finite cylinder
20+
x_min = openmc.XPlane(x0=0.0, boundary_type='reflective')
21+
x_max = openmc.XPlane(x0=20.0, boundary_type='reflective')
22+
x_cyl = openmc.XCylinder(r=20.0,boundary_type='vacuum')
23+
# slice cylinder for periodic BC
24+
periodic_bounding_yplane = openmc.YPlane(y0=0, boundary_type='periodic')
25+
periodic_bounding_plane = openmc.Plane(
26+
a=0.0, b=-np.sqrt(3) / 3, c=1, boundary_type='periodic',
27+
)
28+
sixth_cyl_cell = openmc.Cell(1, fill=fuel, region =
29+
+x_min &- x_max & -x_cyl & +periodic_bounding_yplane & +periodic_bounding_plane)
30+
periodic_bounding_yplane.periodic_surface = periodic_bounding_plane
31+
periodic_bounding_plane.periodic_surface = periodic_bounding_yplane
32+
33+
model.geometry = openmc.Geometry([sixth_cyl_cell])
34+
35+
36+
# Define settings
37+
model.settings.particles = 1000
38+
model.settings.batches = 4
39+
model.settings.inactive = 0
40+
model.settings.source = openmc.IndependentSource(space=openmc.stats.Box(
41+
(0, 0, 0), (20, 20, 20))
42+
)
43+
44+
@pytest.fixture
45+
def ycyl_model():
46+
model = openmc.Model()
47+
# Define materials
48+
fuel = openmc.Material()
49+
fuel.add_nuclide('U235', 0.2)
50+
fuel.add_nuclide('U238', 0.8)
51+
fuel.set_density('g/cc', 19.1)
52+
model.materials = openmc.Materials([fuel])
53+
54+
# Define geometry
55+
# finite cylinder
56+
y_min = openmc.YPlane(y0=0.0, boundary_type='reflective')
57+
y_max = openmc.YPlane(y0=20.0, boundary_type='reflective')
58+
y_cyl = openmc.YCylinder(r=20.0,boundary_type='vacuum')
59+
# slice cylinder for periodic BC
60+
periodic_bounding_xplane = openmc.XPlane(x0=0, boundary_type='periodic')
61+
periodic_bounding_plane = openmc.Plane(
62+
a=-np.sqrt(3) / 3, b=0.0, c=1, boundary_type='periodic',
63+
)
64+
sixth_cyl_cell = openmc.Cell(1, fill=fuel, region =
65+
+y_min &- y_max & -y_cyl & +periodic_bounding_xplane & +periodic_bounding_plane)
66+
periodic_bounding_xplane.periodic_surface = periodic_bounding_plane
67+
periodic_bounding_plane.periodic_surface = periodic_bounding_xplane
68+
model.geometry = openmc.Geometry([sixth_cyl_cell])
69+
70+
71+
# Define settings
72+
model.settings.particles = 1000
73+
model.settings.batches = 4
74+
model.settings.inactive = 0
75+
model.settings.source = openmc.IndependentSource(space=openmc.stats.Box(
76+
(0, 0, 0), (20, 20, 20))
77+
)
78+
79+
80+
@pytest.mark.parametrize('cyl_model', ['xcyl_model','ycyl_model'])
81+
def test_periodic(cyl_model):
82+
with change_directory(cyl_model):
83+
harness = PyAPITestHarness('statepoint.4.h5', cyl_model)
84+
harness.main()
85+
assert
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<model>
3+
<materials>
4+
<material id="1" depletable="true">
5+
<density value="19.1" units="g/cc"/>
6+
<nuclide name="U235" ao="0.2"/>
7+
<nuclide name="U238" ao="0.8"/>
8+
</material>
9+
</materials>
10+
<geometry>
11+
<cell id="1" material="1" region="1 -2 -3 4 5" universe="1"/>
12+
<surface id="1" type="x-plane" boundary="reflective" coeffs="0.0"/>
13+
<surface id="2" type="x-plane" boundary="reflective" coeffs="20.0"/>
14+
<surface id="3" type="x-cylinder" boundary="vacuum" coeffs="0.0 0.0 20.0"/>
15+
<surface id="4" type="y-plane" boundary="periodic" coeffs="0" periodic_surface_id="5"/>
16+
<surface id="5" type="plane" boundary="periodic" coeffs="0.0 -0.5773502691896257 1 0.0" periodic_surface_id="4"/>
17+
</geometry>
18+
<settings>
19+
<run_mode>eigenvalue</run_mode>
20+
<particles>1000</particles>
21+
<batches>4</batches>
22+
<inactive>0</inactive>
23+
<source type="independent" strength="1.0" particle="neutron">
24+
<space type="box">
25+
<parameters>0 0 0 20 20 20</parameters>
26+
</space>
27+
</source>
28+
</settings>
29+
</model>

tests/regression_tests/periodic_cyls/xcyl_model/results_true.dat

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<model>
3+
<materials>
4+
<material id="1" depletable="true">
5+
<density value="19.1" units="g/cc"/>
6+
<nuclide name="U235" ao="0.2"/>
7+
<nuclide name="U238" ao="0.8"/>
8+
</material>
9+
</materials>
10+
<geometry>
11+
<cell id="1" material="1" region="1 -2 -3 4 5" universe="1"/>
12+
<surface id="1" type="y-plane" boundary="reflective" coeffs="0.0"/>
13+
<surface id="2" type="y-plane" boundary="reflective" coeffs="20.0"/>
14+
<surface id="3" type="y-cylinder" boundary="vacuum" coeffs="0.0 0.0 20.0"/>
15+
<surface id="4" type="x-plane" boundary="periodic" coeffs="0" periodic_surface_id="5"/>
16+
<surface id="5" type="plane" boundary="periodic" coeffs="-0.5773502691896257 0.0 1 0.0" periodic_surface_id="4"/>
17+
</geometry>
18+
<settings>
19+
<run_mode>eigenvalue</run_mode>
20+
<particles>1000</particles>
21+
<batches>4</batches>
22+
<inactive>0</inactive>
23+
<source type="independent" strength="1.0" particle="neutron">
24+
<space type="box">
25+
<parameters>0 0 0 20 20 20</parameters>
26+
</space>
27+
</source>
28+
</settings>
29+
</model>

tests/regression_tests/periodic_cyls/ycyl_model/results_true.dat

Whitespace-only changes.

0 commit comments

Comments
 (0)