Skip to content

Commit 4c21d3f

Browse files
committed
update regression test function names
1 parent 3496790 commit 4c21d3f

File tree

4 files changed

+54
-3
lines changed
  • tests/regression_tests
    • random_ray_auto_convert_kinetic
    • random_ray_fixed_source_domain_kinetic
    • random_ray_k_eff_kinetic
    • random_ray_k_eff_mesh_kinetic

4 files changed

+54
-3
lines changed

tests/regression_tests/random_ray_auto_convert_kinetic/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _cleanup(self):
3030
("infinite_medium",
3131
"propagation"),
3232
])
33-
def test_random_ray_auto_convert(generation_method, time_method):
33+
def test_random_ray_auto_convert_kinetic(generation_method, time_method):
3434
with change_directory(f'{generation_method}/{time_method}'):
3535
openmc.reset_auto_ids()
3636

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import os
2+
3+
import openmc
4+
from openmc.utility_funcs import change_directory
5+
from openmc.examples import random_ray_three_region_cube
6+
import pytest
7+
8+
from tests.testing_harness import TolerantPyAPITestHarness
9+
10+
11+
class MGXSTestHarness(TolerantPyAPITestHarness):
12+
def _cleanup(self):
13+
super()._cleanup()
14+
f = 'mgxs.h5'
15+
if os.path.exists(f):
16+
os.remove(f)
17+
18+
19+
@pytest.mark.parametrize("domain_type", ["cell", "material", "universe"])
20+
def test_random_ray_fixed_source(domain_type):
21+
with change_directory(domain_type):
22+
openmc.reset_auto_ids()
23+
model = random_ray_three_region_cube()
24+
25+
# Based on the parameter, we need to adjust
26+
# the particle source constraints
27+
source = model.settings.source[0]
28+
constraints = source.constraints
29+
30+
if domain_type == 'cell':
31+
cells = model.geometry.get_all_cells()
32+
for key, cell in cells.items():
33+
print(cell.name)
34+
if cell.name == 'infinite source region':
35+
constraints['domain_type'] = 'cell'
36+
constraints['domain_ids'] = [cell.id]
37+
elif domain_type == 'material':
38+
materials = model.materials
39+
for material in materials:
40+
if material.name == 'source':
41+
constraints['domain_type'] = 'material'
42+
constraints['domain_ids'] = [material.id]
43+
elif domain_type == 'universe':
44+
universes = model.geometry.get_all_universes()
45+
for key, universe in universes.items():
46+
if universe.name == 'source universe':
47+
constraints['domain_type'] = 'universe'
48+
constraints['domain_ids'] = [universe.id]
49+
50+
harness = MGXSTestHarness('statepoint.10.h5', model)
51+
harness.main()

tests/regression_tests/random_ray_k_eff_kinetic/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _cleanup(self):
1818

1919
@pytest.mark.parametrize("time_method", ["isotropic",
2020
"propagation"])
21-
def test_random_ray_time_dependent(time_method):
21+
def test_random_ray_basic_kinetic(time_method):
2222
with change_directory(time_method):
2323
openmc.reset_auto_ids()
2424
model = random_ray_pin_cell(kinetic=True)

tests/regression_tests/random_ray_k_eff_mesh_kinetic/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _cleanup(self):
1818

1919
@pytest.mark.parametrize("time_method", ["isotropic",
2020
"propagation"])
21-
def test_random_ray_k_eff_mesh(time_method):
21+
def test_random_ray_k_eff_mesh_kinetic(time_method):
2222
with change_directory(time_method):
2323
model = random_ray_lattice(kinetic=True)
2424
model.settings.timestep_parameters['n_timesteps'] = 5

0 commit comments

Comments
 (0)