OpenMC/tests/regression_tests/random_ray_fixed_source_linear/test.py
John Tramm 5bc04b5d78
Alternative Random Ray Volume Estimators (#3060)
Co-authored-by: Olek <45364492+yardasol@users.noreply.github.com>
2024-08-23 11:56:26 -05:00

29 lines
841 B
Python

import os
import numpy as np
import openmc
from openmc.utility_funcs import change_directory
from openmc.examples import random_ray_three_region_cube
import pytest
from tests.testing_harness import TolerantPyAPITestHarness
class MGXSTestHarness(TolerantPyAPITestHarness):
def _cleanup(self):
super()._cleanup()
f = 'mgxs.h5'
if os.path.exists(f):
os.remove(f)
@pytest.mark.parametrize("shape", ["linear", "linear_xy"])
def test_random_ray_fixed_source_linear(shape):
with change_directory(shape):
openmc.reset_auto_ids()
model = random_ray_three_region_cube()
model.settings.random_ray['source_shape'] = shape
model.settings.inactive = 20
model.settings.batches = 40
harness = MGXSTestHarness('statepoint.40.h5', model)
harness.main()