From 4783b34fe2aa6a744f38f474f44dcd58e0dddf27 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 13 Feb 2023 07:16:10 -0600 Subject: [PATCH] Fix several failing tests --- .../cpp_driver/results_true.dat | 22 +++++++++---------- .../particle_restart_eigval/results_true.dat | 8 +++---- .../particle_restart_eigval/test.py | 2 +- tests/regression_tests/periodic_6fold/test.py | 18 +++++++-------- tests/testing_harness.py | 7 ++++++ 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/tests/regression_tests/cpp_driver/results_true.dat b/tests/regression_tests/cpp_driver/results_true.dat index e44b45054..c2b0b8d6f 100644 --- a/tests/regression_tests/cpp_driver/results_true.dat +++ b/tests/regression_tests/cpp_driver/results_true.dat @@ -1,13 +1,13 @@ k-combined: -1.902610E+00 1.901530E-02 +1.933305E+00 1.300360E-02 tally 1: -9.580351E+01 -1.031580E+03 -2.745984E+01 -8.430494E+01 -9.422158E+01 -9.919885E+02 -2.174849E+02 -5.292948E+03 -2.174849E+02 -5.292948E+03 +9.552846E+01 +1.019358E+03 +2.887973E+01 +9.308509E+01 +9.732441E+01 +1.059022E+03 +2.217326E+02 +5.486892E+03 +2.217326E+02 +5.486892E+03 diff --git a/tests/regression_tests/particle_restart_eigval/results_true.dat b/tests/regression_tests/particle_restart_eigval/results_true.dat index 64101d770..bd81920ca 100644 --- a/tests/regression_tests/particle_restart_eigval/results_true.dat +++ b/tests/regression_tests/particle_restart_eigval/results_true.dat @@ -3,14 +3,14 @@ current batch: current generation: 1.000000E+00 particle id: -9.020000E+02 +2.540000E+02 run mode: eigenvalue particle weight: 1.000000E+00 particle energy: -3.691964E+06 +2.220048E+06 particle xyz: --5.047439E+01 2.730535E+01 -2.619863E+01 +-4.820850E+01 2.432936E+01 4.397668E+01 particle uvw: --6.278670E-01 1.419818E-01 -7.652609E-01 +-3.148565E-01 9.184190E-01 2.395245E-01 diff --git a/tests/regression_tests/particle_restart_eigval/test.py b/tests/regression_tests/particle_restart_eigval/test.py index e526e5003..f9d22edb8 100644 --- a/tests/regression_tests/particle_restart_eigval/test.py +++ b/tests/regression_tests/particle_restart_eigval/test.py @@ -2,5 +2,5 @@ from tests.testing_harness import ParticleRestartTestHarness def test_particle_restart_eigval(): - harness = ParticleRestartTestHarness('particle_11_902.h5') + harness = ParticleRestartTestHarness('particle_11_254.h5') harness.main() diff --git a/tests/regression_tests/periodic_6fold/test.py b/tests/regression_tests/periodic_6fold/test.py index 555ab24f9..69712eb5a 100644 --- a/tests/regression_tests/periodic_6fold/test.py +++ b/tests/regression_tests/periodic_6fold/test.py @@ -1,5 +1,6 @@ +from math import sin, cos, pi + import openmc -import numpy as np import pytest from tests.testing_harness import PyAPITestHarness @@ -24,17 +25,14 @@ def model(): # (it essentially defines a circle of half-cylinders), but it is # designed so that periodic and reflective BCs will give different # answers. - theta1 = (-1/6 + 1/2) * np.pi - theta2 = (1/6 - 1/2) * np.pi - plane1 = openmc.Plane(a=np.cos(theta1), b=np.sin(theta1), - boundary_type='periodic') - plane2 = openmc.Plane(a=np.cos(theta2), b=np.sin(theta2), - boundary_type='periodic') + theta1 = (-1/6 + 1/2) * pi + theta2 = (1/6 - 1/2) * pi + plane1 = openmc.Plane(a=cos(theta1), b=sin(theta1), boundary_type='periodic') + plane2 = openmc.Plane(a=cos(theta2), b=sin(theta2), boundary_type='periodic') - x_max = openmc.XPlane(x0=5., boundary_type='reflective') + x_max = openmc.XPlane(5., boundary_type='reflective') - z_cyl = openmc.ZCylinder(x0=3*np.cos(np.pi/6), y0=3*np.sin(np.pi/6), - r=2.0) + z_cyl = openmc.ZCylinder(x0=3*cos(pi/6), y0=3*sin(pi/6), r=2.0) outside_cyl = openmc.Cell(1, fill=water, region=( +plane1 & +plane2 & -x_max & +z_cyl)) diff --git a/tests/testing_harness.py b/tests/testing_harness.py index 9a6db2a2e..0525dd476 100644 --- a/tests/testing_harness.py +++ b/tests/testing_harness.py @@ -276,6 +276,13 @@ class ParticleRestartTestHarness(TestHarness): return outstr + def _cleanup(self): + """Delete particle restart files.""" + super()._cleanup() + output = glob.glob('particle*.h5') + for f in output: + os.remove(f) + class PyAPITestHarness(TestHarness): def __init__(self, statepoint_name, model=None, inputs_true=None):