Skip to content

Commit 938a880

Browse files
committed
Add hex mesh to tests
1 parent c7134f1 commit 938a880

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

tests/unit_tests/test_mesh.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,22 +488,38 @@ def test_umesh(run_in_tmpdir, simple_umesh, export_type):
488488
simple_umesh.write_data_to_vtk(datasets={'mean': ref_data[:-2]}, filename=filename)
489489

490490

491+
vtkhdf_tests = [
492+
(
493+
Path("test_mesh_dagmc_tets.vtk"),
494+
"moab"
495+
),
496+
(
497+
Path("test_mesh_hexes.exo"),
498+
"libmesh"
499+
)
500+
]
491501
@pytest.mark.skipif(not openmc.lib._dagmc_enabled(), reason="DAGMC not enabled.")
492-
def test_write_vtkhdf(request):
502+
@pytest.mark.parametrize('mesh_file, mesh_library', vtkhdf_tests)
503+
def test_write_vtkhdf(mesh_file, mesh_library, request, run_in_tmpdir):
493504
"""Performs a minimal UnstructuredMesh simulation, reads in the resulting
494505
statepoint file and writes the mesh data to vtk and vtkhdf files. It is
495506
necessary to read in the unstructured mesh from a statepoint file to ensure
496507
it has all the required attributes
497508
"""
509+
if mesh_library == 'moab' and not openmc.lib._dagmc_enabled():
510+
pytest.skip("DAGMC not enabled.")
511+
if mesh_library == 'libmesh' and not openmc.lib._libmesh_enabled():
512+
pytest.skip("LibMesh not enabled.")
513+
498514
model = openmc.Model()
499515

500516
surf1 = openmc.Sphere(r=1000.0, boundary_type="vacuum")
501517
cell1 = openmc.Cell(region=-surf1)
502518
model.geometry = openmc.Geometry([cell1])
503519

504520
umesh = openmc.UnstructuredMesh(
505-
request.path.parent / "test_mesh_dagmc_tets.vtk",
506-
"moab",
521+
request.path.parent / mesh_file,
522+
mesh_library,
507523
mesh_id = 1
508524
)
509525
mesh_filter = openmc.MeshFilter(umesh)
@@ -512,6 +528,8 @@ def test_write_vtkhdf(request):
512528
mesh_tally = openmc.Tally(name="test_tally")
513529
mesh_tally.filters = [mesh_filter]
514530
mesh_tally.scores = ["flux"]
531+
if mesh_library == "libmesh":
532+
mesh_tally.estimator = "collision"
515533

516534
model.tallies = [mesh_tally]
517535

0 commit comments

Comments
 (0)