Skip to content

Commit

Permalink
Make MMS into a regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Jan 29, 2025
1 parent d182c76 commit 5bb27b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/tests/ver-1dc/test.py
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions test/tests/ver-1dc/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
[]
[]

0 comments on commit 5bb27b2

Please sign in to comment.