diff --git a/test/tests/ver-1dc/test.py b/test/tests/ver-1dc/test.py index 2bf2da65..cba5b233 100755 --- a/test/tests/ver-1dc/test.py +++ b/test/tests/ver-1dc/test.py @@ -1,8 +1,16 @@ -#!/usr/bin/env python3 - import mms -df1 = mms.run_spatial('mms.i', 4, y_pp=['L2u']) +import unittest +from mooseutils import fuzzyEqual, fuzzyAbsoluteEqual + +class TestMMS(unittest.TestCase): + def test(self): + df1 = mms.run_spatial('mms.i', 4, y_pp=['L2u']) + fig = mms.ConvergencePlot(xlabel=r'$\Delta$t', ylabel='$L_2$ Error') + fig.plot(df1, label=['L2u'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) + fig.save('mms_spatial.png') + for key,value in fig.label_to_slope.items(): + print("%s, %f" % (key, value)) + self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1)) -fig = mms.ConvergencePlot(xlabel=r'$\Delta$t', ylabel='$L_2$ Error') -fig.plot(df1, label=['L2u'], marker='o', markersize=8) -fig.save('mms_spatial.png') +if __name__ == '__main__': + unittest.main(__name__, verbosity=2) diff --git a/test/tests/ver-1dc/tests b/test/tests/ver-1dc/tests index 8057d7bc..ed13e92a 100644 --- a/test/tests/ver-1dc/tests +++ b/test/tests/ver-1dc/tests @@ -32,4 +32,14 @@ requirement = 'The system shall be able to generate comparison plots between the analytical solution and simulated solutions of verification cases 1dc, modeling a breakthrough problem of multiple traps.' required_python_packages = 'matplotlib numpy pandas os' [] + [ver-1dc-mms] + type = PythonUnitTest + input = test.py + test_case = TestMMS + requirement = 'The system shall show second order spatial convergence for a diffusion-trapping-release test case.' + method = '!dbg' + required_python_packages = 'pandas matplotlib' + # skip test if test is being run out-of-tree. Issue Ref: idaholab/moose#25279 + installation_type = in_tree + [] []