OpenMC/tests/regression_tests/weightwindows_fw_cadis/test.py
John Tramm a8768b7845
FW-CADIS Weight Window Generation with Random Ray (#3273)
Co-authored-by: Olek <45364492+yardasol@users.noreply.github.com>
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
2025-01-27 22:54:32 -06:00

33 lines
914 B
Python

import os
import openmc
from openmc.examples import random_ray_three_region_cube
from tests.testing_harness import WeightWindowPyAPITestHarness
class MGXSTestHarness(WeightWindowPyAPITestHarness):
def _cleanup(self):
super()._cleanup()
f = 'mgxs.h5'
if os.path.exists(f):
os.remove(f)
def test_random_ray_adjoint_fixed_source():
model = random_ray_three_region_cube()
ww_mesh = openmc.RegularMesh()
n = 6
width = 30.0
ww_mesh.dimension = (n, n, n)
ww_mesh.lower_left = (0.0, 0.0, 0.0)
ww_mesh.upper_right = (width, width, width)
wwg = openmc.WeightWindowGenerator(
method="fw_cadis", mesh=ww_mesh, max_realizations=model.settings.batches)
model.settings.weight_window_generators = wwg
model.settings.random_ray['volume_estimator'] = 'naive'
harness = MGXSTestHarness('statepoint.10.h5', model)
harness.main()