OpenMC/tests/regression_tests/ifp/groupwise/test.py
Alex Nellis 781dbf9c12
Multi-group capability for kinetics parameter calculations with Iterated Fission Probability (#3425)
Co-authored-by: GuySten <guyste@post.bgu.ac.il>
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
2025-09-26 16:27:05 +00:00

40 lines
1.1 KiB
Python

"""Test the Iterated Fission Probability (IFP) method to compute adjoint-weighted
kinetics parameters using dedicated tallies."""
import openmc
import pytest
from tests.testing_harness import PyAPITestHarness
@pytest.fixture()
def ifp_model():
# Material
material = openmc.Material(name="core")
material.add_nuclide("U235", 1.0)
material.set_density('g/cm3', 16.0)
# Geometry
radius = 10.0
sphere = openmc.Sphere(r=radius, boundary_type="vacuum")
cell = openmc.Cell(region=-sphere, fill=material)
geometry = openmc.Geometry([cell])
# Settings
settings = openmc.Settings()
settings.particles = 1000
settings.batches = 20
settings.inactive = 5
settings.ifp_n_generation = 5
model = openmc.Model(settings=settings, geometry=geometry)
space = openmc.stats.Box(*cell.bounding_box)
model.settings.source = openmc.IndependentSource(
space=space, constraints={'fissionable': True})
model.add_kinetics_parameters_tallies(num_groups=6)
return model
def test_iterated_fission_probability(ifp_model):
harness = PyAPITestHarness("statepoint.20.h5", model=ifp_model)
harness.main()