Skip to content

Commit

Permalink
changing fvkernels/mms/advection-outflow test logic to ensure that co…
Browse files Browse the repository at this point in the history
…nvergence is at leaste the required order of convergence Refs #28891
  • Loading branch information
tanoret committed Oct 29, 2024
1 parent 076ba98 commit 15559c5
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions test/tests/fvkernels/mms/advective-outflow/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import mms
import unittest
from mooseutils import fuzzyAbsoluteEqual

def bottom_bound(value, order, tolerance):
return value > (order - tolerance)

class TestOutflow(unittest.TestCase):
def test(self):
Expand All @@ -15,9 +17,9 @@ def test(self):
fig.save('outflow.png')
for label,value in fig.label_to_slope.items():
if label == 'L2u':
self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
self.assertTrue(bottom_bound(value, 1., .05))
else:
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class TestOutflowMinMod(unittest.TestCase):
def test(self):
Expand All @@ -39,9 +41,9 @@ def test(self):
fig.save('outflow-min-mod.png')
for label,value in fig.label_to_slope.items():
if label == 'L2u':
self.assertTrue(fuzzyAbsoluteEqual(value, 1.5, .05))
self.assertTrue(bottom_bound(value, 1.5, .05))
else:
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class TestExtrapolation(unittest.TestCase):
def test(self):
Expand All @@ -56,9 +58,9 @@ def test(self):
fig.save('extrapolation.png')
for label,value in fig.label_to_slope.items():
if label == 'L2u':
self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
self.assertTrue(bottom_bound(value, 1., .05))
else:
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class UpwindLimiter(unittest.TestCase):
def test(self):
Expand All @@ -72,7 +74,7 @@ def test(self):
slope_precision=1)
fig.save('upwind-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
self.assertTrue(bottom_bound(value, 1., .05))

class CentralDifferenceLimiter(unittest.TestCase):
def test(self):
Expand All @@ -86,7 +88,7 @@ def test(self):
slope_precision=1)
fig.save('cd-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class VanLeerLimiter(unittest.TestCase):
def test(self):
Expand All @@ -100,7 +102,7 @@ def test(self):
slope_precision=1)
fig.save('vanLeer-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class MinModLimiter(unittest.TestCase):
def test(self):
Expand All @@ -114,7 +116,7 @@ def test(self):
slope_precision=1)
fig.save('min-mod-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class SOULimiter(unittest.TestCase):
def test(self):
Expand All @@ -128,7 +130,7 @@ def test(self):
slope_precision=1)
fig.save('sou-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class QUICKLimiter(unittest.TestCase):
def test(self):
Expand All @@ -142,7 +144,7 @@ def test(self):
slope_precision=1)
fig.save('quick-limiter.png')
for label,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))

class KTLimitedCD(unittest.TestCase):
def test(self):
Expand All @@ -156,7 +158,7 @@ def test(self):
slope_precision=1)
fig.save('kt-cd-limiter.png')
for key,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
self.assertTrue(bottom_bound(value, 2., .05))
print("%s slope, %f" % (key, value))

class KTLimitedUpwind(unittest.TestCase):
Expand All @@ -171,7 +173,7 @@ def test(self):
slope_precision=1)
fig.save('kt-upwind-limiter.png')
for key,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
self.assertTrue(bottom_bound(value, 1., .05))
print("%s slope, %f" % (key, value))

class KTLimitedVanLeer(unittest.TestCase):
Expand All @@ -186,5 +188,5 @@ def test(self):
slope_precision=1)
fig.save('kt-van-leer-limiter.png')
for key,value in fig.label_to_slope.items():
self.assertTrue(fuzzyAbsoluteEqual(value, 2.5, .05))
self.assertTrue(bottom_bound(value, 2.5, .05))
print("%s slope, %f" % (key, value))

0 comments on commit 15559c5

Please sign in to comment.