mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
removed tally tests
This commit is contained in:
parent
3233ffc759
commit
c58465214b
1 changed files with 0 additions and 63 deletions
|
|
@ -1,7 +1,4 @@
|
|||
import numpy as np
|
||||
import pytest
|
||||
import vtk
|
||||
from os.path import exists
|
||||
|
||||
import openmc
|
||||
|
||||
|
|
@ -42,63 +39,3 @@ def test_xml_roundtrip(run_in_tmpdir):
|
|||
assert new_tally.triggers[0].trigger_type == tally.triggers[0].trigger_type
|
||||
assert new_tally.triggers[0].threshold == tally.triggers[0].threshold
|
||||
assert new_tally.triggers[0].scores == tally.triggers[0].scores
|
||||
|
||||
def run_dummy_sim(tally):
|
||||
mat = openmc.Material()
|
||||
mat.add_nuclide('Zr90', 1.0)
|
||||
mat.set_density('g/cm3', 1.0)
|
||||
|
||||
model = openmc.Model()
|
||||
sph = openmc.Sphere(r=25.0, boundary_type='vacuum')
|
||||
cell = openmc.Cell(fill=mat, region=-sph)
|
||||
model.geometry = openmc.Geometry([cell])
|
||||
|
||||
model.settings.run_mode = 'fixed source'
|
||||
model.settings.batches = 2
|
||||
model.settings.particles = 50
|
||||
|
||||
model.tallies = openmc.Tallies([tally])
|
||||
|
||||
model.run()
|
||||
|
||||
cylinder_mesh = openmc.CylindricalMesh()
|
||||
cylinder_mesh.r_grid = np.linspace(1, 2, num=30)
|
||||
cylinder_mesh.phi_grid = np.linspace(0, np.pi / 2, num=50)
|
||||
cylinder_mesh.z_grid = np.linspace(0, 1, num=30)
|
||||
|
||||
regular_mesh = openmc.RegularMesh()
|
||||
regular_mesh.lower_left = [0, 0, 0]
|
||||
regular_mesh.upper_right = [1, 1, 1]
|
||||
regular_mesh.dimension = [10, 5, 6]
|
||||
|
||||
rectilinear_mesh = openmc.RectilinearMesh()
|
||||
rectilinear_mesh.x_grid = np.linspace(0, 1)
|
||||
rectilinear_mesh.y_grid = np.linspace(0, 1)
|
||||
rectilinear_mesh.z_grid = np.linspace(0, 1)
|
||||
|
||||
spherical_mesh = openmc.SphericalMesh()
|
||||
spherical_mesh.r_grid = np.linspace(1, 2)
|
||||
spherical_mesh.phi_grid = np.linspace(1, 2)
|
||||
spherical_mesh.theta_grid = np.linspace(1, 2)
|
||||
|
||||
@pytest.mark.parametrize("mesh", [cylinder_mesh, regular_mesh, rectilinear_mesh, spherical_mesh])
|
||||
def test_write_to_vtk(mesh, tmpdir):
|
||||
# build
|
||||
tally = openmc.Tally()
|
||||
tally.filters = [openmc.MeshFilter(mesh)]
|
||||
filename = tmpdir / "out.vtk"
|
||||
run_dummy_sim(tally)
|
||||
# run
|
||||
tally.write_to_vtk(filename)
|
||||
# test
|
||||
assert exists(filename)
|
||||
|
||||
|
||||
def test_write_to_vtk_raises_error_when_no_meshfilter():
|
||||
# build
|
||||
tally = openmc.Tally()
|
||||
|
||||
# test
|
||||
expected_err_msg = "write_to_vtk requires a MeshFilter in the tally filters"
|
||||
with pytest.raises(ValueError, match=expected_err_msg):
|
||||
tally.write_to_vtk("out.vtk")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue