mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Add a test for non-90-degree periodic BCs
This commit is contained in:
parent
f8c7a74d6c
commit
6ed023c790
3 changed files with 98 additions and 0 deletions
34
tests/regression_tests/periodic_6fold/inputs_true.dat
Normal file
34
tests/regression_tests/periodic_6fold/inputs_true.dat
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="9 10 -11 12" universe="0" />
|
||||
<cell id="2" material="2" region="9 10 -12" universe="0" />
|
||||
<surface boundary="periodic" coeffs="0.4999999999999999 0.8660254037844387 0.0 0.0" id="9" type="plane" />
|
||||
<surface boundary="periodic" coeffs="0.4999999999999999 -0.8660254037844387 0.0 0.0" id="10" type="plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="11" type="x-plane" />
|
||||
<surface coeffs="2.598076211353316 1.4999999999999998 2.0" id="12" type="z-cylinder" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<material id="1">
|
||||
<density units="g/cc" value="1.0" />
|
||||
<nuclide ao="2.0" name="H1" />
|
||||
<nuclide ao="1.0" name="O16" />
|
||||
<sab name="c_H_in_H2O" />
|
||||
</material>
|
||||
<material depletable="true" id="2">
|
||||
<density units="g/cc" 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>4</batches>
|
||||
<inactive>0</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0 0 0 5 5 0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
</settings>
|
||||
2
tests/regression_tests/periodic_6fold/results_true.dat
Normal file
2
tests/regression_tests/periodic_6fold/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.858773E+00 1.550950E-02
|
||||
62
tests/regression_tests/periodic_6fold/test.py
Normal file
62
tests/regression_tests/periodic_6fold/test.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import openmc
|
||||
import numpy as np
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
class Periodic6FoldTest(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
# Define materials
|
||||
water = openmc.Material(1)
|
||||
water.add_nuclide('H1', 2.0)
|
||||
water.add_nuclide('O16', 1.0)
|
||||
water.add_s_alpha_beta('c_H_in_H2O')
|
||||
water.set_density('g/cc', 1.0)
|
||||
|
||||
fuel = openmc.Material(2)
|
||||
fuel.add_nuclide('U235', 1.0)
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
|
||||
materials = openmc.Materials((water, fuel))
|
||||
materials.default_temperature = '294K'
|
||||
materials.export_to_xml()
|
||||
|
||||
# Define the geometry. Note that this geometry is somewhat non-sensical
|
||||
# (it essentially defines a circle of half-cylinders), but it is
|
||||
# designed so that periodic and reflective BCs will give different
|
||||
# answers.
|
||||
theta1 = (-1/6 + 1/2) * np.pi
|
||||
theta2 = (1/6 - 1/2) * np.pi
|
||||
plane1 = openmc.Plane(a=np.cos(theta1), b=np.sin(theta1),
|
||||
boundary_type='periodic')
|
||||
plane2 = openmc.Plane(a=np.cos(theta2), b=np.sin(theta2),
|
||||
boundary_type='periodic')
|
||||
|
||||
x_max = openmc.XPlane(x0=5., boundary_type='reflective')
|
||||
|
||||
z_cyl = openmc.ZCylinder(x0=3*np.cos(np.pi/6), y0=3*np.sin(np.pi/6),
|
||||
r=2.0)
|
||||
|
||||
outside_cyl = openmc.Cell(1, fill=water, region=(
|
||||
+plane1 & +plane2 & -x_max & +z_cyl))
|
||||
inside_cyl = openmc.Cell(2, fill=fuel, region=(
|
||||
+plane1 & +plane2 & -z_cyl))
|
||||
root_universe = openmc.Universe(0, cells=(outside_cyl, inside_cyl))
|
||||
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root_universe
|
||||
geometry.export_to_xml()
|
||||
|
||||
# Define settings
|
||||
settings = openmc.Settings()
|
||||
settings.particles = 1000
|
||||
settings.batches = 4
|
||||
settings.inactive = 0
|
||||
settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
(0, 0, 0), (5, 5, 0)))
|
||||
settings.export_to_xml()
|
||||
|
||||
|
||||
def test_periodic():
|
||||
harness = Periodic6FoldTest('statepoint.4.h5')
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue