mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Merge pull request #647 from paulromano/periodic
Add periodic boundary conditions
This commit is contained in:
commit
af82534e8d
12 changed files with 333 additions and 34 deletions
1
tests/test_periodic/inputs_true.dat
Normal file
1
tests/test_periodic/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
af589996f2930337afe34ba9894098ff5efe3b29b6e927117220b718bf29b630ffdbc931754d465a8e8100125a8aa997dbe10aab322b43f69d59710573996a6d
|
||||
2
tests/test_periodic/results_true.dat
Normal file
2
tests/test_periodic/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.040109E+00 6.527490E-02
|
||||
14
tests/test_periodic/tallies.xml
Normal file
14
tests/test_periodic/tallies.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
<mesh id="1">
|
||||
<type>regular</type>
|
||||
<lower_left>-200. -1e50</lower_left>
|
||||
<upper_right>200. 1e50</upper_right>
|
||||
<dimension>50 1</dimension>
|
||||
</mesh>
|
||||
<tally id="1">
|
||||
<estimator>collision</estimator>
|
||||
<filter type="mesh" bins="1" />
|
||||
<scores>fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
60
tests/test_periodic/test_periodic.py
Normal file
60
tests/test_periodic/test_periodic.py
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
|
||||
class PeriodicTest(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
# Define materials
|
||||
water = openmc.Material(1)
|
||||
water.add_nuclide('H-1', 2.0)
|
||||
water.add_nuclide('O-16', 1.0)
|
||||
water.add_s_alpha_beta('HH2O', '71t')
|
||||
water.set_density('g/cc', 1.0)
|
||||
|
||||
fuel = openmc.Material(2)
|
||||
fuel.add_nuclide('U-235', 1.0)
|
||||
fuel.set_density('g/cc', 4.5)
|
||||
|
||||
materials = openmc.Materials((water, fuel))
|
||||
materials.default_xs = '71c'
|
||||
materials.export_to_xml()
|
||||
|
||||
# Define geometry
|
||||
x_min = openmc.XPlane(1, x0=-5., boundary_type='periodic')
|
||||
x_max = openmc.XPlane(2, x0=5., boundary_type='periodic')
|
||||
x_max.periodic_surface = x_min
|
||||
|
||||
y_min = openmc.YPlane(3, y0=-5., boundary_type='periodic')
|
||||
y_max = openmc.YPlane(4, y0=5., boundary_type='periodic')
|
||||
|
||||
z_min = openmc.ZPlane(5, z0=-5., boundary_type='reflective')
|
||||
z_max = openmc.ZPlane(6, z0=5., boundary_type='reflective')
|
||||
z_cyl = openmc.ZCylinder(7, x0=-2.5, y0=2.5, R=2.0)
|
||||
|
||||
outside_cyl = openmc.Cell(1, fill=water, region=(
|
||||
+x_min & -x_max & +y_min & -y_max & +z_min & -z_max & +z_cyl))
|
||||
inside_cyl = openmc.Cell(2, fill=fuel, region=+z_min & -z_max & -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(
|
||||
*outside_cyl.region.bounding_box))
|
||||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = PeriodicTest('statepoint.4.h5')
|
||||
harness.main()
|
||||
|
|
@ -133,9 +133,10 @@ class TestHarness(object):
|
|||
|
||||
def _cleanup(self):
|
||||
"""Delete statepoints, tally, and test files."""
|
||||
output = glob.glob(os.path.join(os.getcwd(), 'statepoint.*.*'))
|
||||
output = glob.glob(os.path.join(os.getcwd(), 'statepoint.*.h5'))
|
||||
output.append(os.path.join(os.getcwd(), 'tallies.out'))
|
||||
output.append(os.path.join(os.getcwd(), 'results_test.dat'))
|
||||
output.append(os.path.join(os.getcwd(), 'summary.h5'))
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue