OpenMC/tests/regression_tests/dagmc/uwuw/test.py
2024-04-24 11:05:11 -05:00

38 lines
1.1 KiB
Python

import openmc
import openmc.lib
from openmc.stats import Box
import pytest
from tests.testing_harness import PyAPITestHarness
pytestmark = pytest.mark.skipif(
not openmc.lib._uwuw_enabled(),
reason="UWUW is not enabled.")
class UWUWTest(PyAPITestHarness):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# settings
self._model.settings.batches = 5
self._model.settings.inactive = 0
self._model.settings.particles = 100
source = openmc.IndependentSource(space=Box([-4, -4, -4],
[ 4, 4, 4]))
self._model.settings.source = source
# geometry
dag_univ = openmc.DAGMCUniverse("dagmc.h5m")
self._model.geometry = openmc.Geometry(root=dag_univ)
# tally
tally = openmc.Tally()
tally.scores = ['total']
tally.filters = [openmc.CellFilter(1)]
self._model.tallies = [tally]
def test_uwuw():
harness = UWUWTest('statepoint.5.h5', model=openmc.Model())
harness.main()