Skip to content

Commit

Permalink
var names
Browse files Browse the repository at this point in the history
  • Loading branch information
drunsinn committed Dec 16, 2024
1 parent 6cdfc7a commit 29066af
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 50 deletions.
2 changes: 0 additions & 2 deletions pyXSteam/Tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,6 @@ class Sub_psh12:
class Sub_psh3:
"""class with table data from SUB psh12"""

# TODO check table 3!
Table3_I = [0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 6, 7, 8, 10, 10, 14, 18, 20, 22, 22, 24, 28, 28, 32, 32]
Table3_J = [0, 1, 5, 0, 3, 4, 8, 14, 6, 16, 0, 2, 3, 0, 1, 4, 5, 28, 28, 24, 1, 32, 36, 22, 28, 36, 16, 28, 36, 16, 36, 10, 28]
Table3_n = [
Expand Down Expand Up @@ -1088,7 +1087,6 @@ class Sub_psh3:
3.77121605943324e40,
]

# TODO check table 4!
Table4_I = [
-12,
-12,
Expand Down
106 changes: 58 additions & 48 deletions tests/test_Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@


class Region1Tester(unittest.TestCase):
"""tests for functions in region 1"""

def setUp(self):
self.maxError = 1e-8
self.max_error = 1e-8
# The accumulated Error is bigger than the error of each single function
self.maxMatrixError = 2e-8
self.max_matrix_error = 2e-8

def tearDown(self):
pass
Expand Down Expand Up @@ -46,9 +48,9 @@ def test_pT_functions(self):
Region1_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97))
self.assertLess(
Region1_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of p,T Functions for Region 1 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": Region1_error, "max": self.maxMatrixError},
" %(max)e" % {"error": Region1_error, "max": self.max_matrix_error},
)

def test_ph_function(self):
Expand All @@ -64,9 +66,9 @@ def test_ph_function(self):
T1_ph_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97))
self.assertLess(
T1_ph_error,
self.maxError,
self.max_error,
"Test of T(p,h) Function for Region 1 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T1_ph_error, "max": self.maxError},
" %(max)e" % {"error": T1_ph_error, "max": self.max_error},
)

def test_ps_function(self):
Expand All @@ -82,9 +84,9 @@ def test_ps_function(self):
T1_ps_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97))
self.assertLess(
T1_ps_error,
self.maxError,
self.max_error,
"Test of T(p,s) Function for Region 1 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T1_ps_error, "max": self.maxError},
" %(max)e" % {"error": T1_ps_error, "max": self.max_error},
)

def test_hs_function(self):
Expand All @@ -102,17 +104,19 @@ def test_hs_function(self):
p1_hs_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97))
self.assertLess(
p1_hs_error,
self.maxError,
self.max_error,
"Test of p(h,s) Function for Region 1 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": p1_hs_error, "max": self.maxError},
" %(max)e" % {"error": p1_hs_error, "max": self.max_error},
)


class Region2Tester(unittest.TestCase):
"""tests for functions in region 2"""

def setUp(self):
self.maxError = 1e-8
self.max_error = 1e-8
# The accumulated Error is bigger than the error of each single function
self.maxMatrixError = 2e-8
self.max_matrix_error = 2e-8

def tearDown(self):
pass
Expand Down Expand Up @@ -145,9 +149,9 @@ def test_pT_function(self):
Region2_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97))
self.assertLess(
Region2_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of p,T Functions for Region 2 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": Region2_error, "max": self.maxMatrixError},
" %(max)e" % {"error": Region2_error, "max": self.max_matrix_error},
)

def test_pT_meta_function(self):
Expand Down Expand Up @@ -177,9 +181,9 @@ def test_pT_meta_function(self):
Region2_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97))
self.assertLess(
Region2_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of p,T Functions for Region 2 in the metastable-vapor region failed. Error was %(error)e allowed:"
" %(max)e" % {"error": Region2_error, "max": self.maxMatrixError},
" %(max)e" % {"error": Region2_error, "max": self.max_matrix_error},
)

def test_ph_function(self):
Expand Down Expand Up @@ -214,9 +218,9 @@ def test_ph_function(self):
T2_ph_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97))
self.assertLess(
T2_ph_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of ph Function for Region 2 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T2_ph_error, "max": self.maxMatrixError},
" %(max)e" % {"error": T2_ph_error, "max": self.max_matrix_error},
)

def test_ps_function(self):
Expand All @@ -241,9 +245,9 @@ def test_ps_function(self):
T2_ps_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97))
self.assertLess(
T2_ps_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of ps Function for Region 2 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T2_ps_error, "max": self.maxMatrixError},
" %(max)e" % {"error": T2_ps_error, "max": self.max_matrix_error},
)

def test_hs_function(self):
Expand All @@ -269,17 +273,19 @@ def test_hs_function(self):
p2_hs_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97))
self.assertLess(
p2_hs_error,
self.maxError,
self.max_error,
"Test of hs Function for Region 2 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": p2_hs_error, "max": self.maxError},
" %(max)e" % {"error": p2_hs_error, "max": self.max_error},
)


class Region3Tester(unittest.TestCase):
"""tests for functions in region 3"""

def setUp(self):
self.maxError = 1e-8
self.max_error = 1e-8
# The accumulated Error is bigger than the error of each single function
self.maxMatrixError = 2e-8
self.max_matrix_error = 2e-8

def tearDown(self):
pass
Expand Down Expand Up @@ -313,9 +319,9 @@ def test_rhoT_function(self):
Region3_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97))
self.assertLess(
Region3_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of rhoT Function for Region 3 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": Region3_error, "max": self.maxMatrixError},
" %(max)e" % {"error": Region3_error, "max": self.max_matrix_error},
)

def test_T_ph_function(self):
Expand All @@ -337,9 +343,9 @@ def test_T_ph_function(self):
T3_ph_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97))
self.assertLess(
T3_ph_error,
self.maxError,
self.max_error,
"Test of T(p,h) Function for Region 3 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T3_ph_error, "max": self.maxError},
" %(max)e" % {"error": T3_ph_error, "max": self.max_error},
)

def test_v_ph_function(self):
Expand Down Expand Up @@ -384,9 +390,9 @@ def test_T_ps_function(self):
T3_ps_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97))
self.assertLess(
T3_ps_error,
self.maxError,
self.max_error,
"Test of T(p,s) Function for Region 3 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T3_ps_error, "max": self.maxError},
" %(max)e" % {"error": T3_ps_error, "max": self.max_error},
)

def test_v_ps_function(self):
Expand All @@ -408,9 +414,9 @@ def test_v_ps_function(self):
v3_ps_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97))
self.assertLess(
v3_ps_error,
self.maxError,
self.max_error,
"Test of v(p,s) Function for Region 3 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": v3_ps_error, "max": self.maxError},
" %(max)e" % {"error": v3_ps_error, "max": self.max_error},
)

def test_hs_function(self):
Expand All @@ -432,9 +438,9 @@ def test_hs_function(self):
p3_hs_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97))
self.assertLess(
p3_hs_error,
self.maxError,
self.max_error,
"Test of p(h,s) Function for Region 3 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": p3_hs_error, "max": self.maxError},
" %(max)e" % {"error": p3_hs_error, "max": self.max_error},
)

def test_pT_function(self):
Expand All @@ -455,10 +461,12 @@ def test_pT_function(self):


class Region4Tester(unittest.TestCase):
"""tests for functions in region 4"""

def setUp(self):
self.maxError = 1e-7
self.max_error = 1e-7
# The accumulated Error is bigger than the error of each single function
self.maxMatrixError = 2e-8
self.max_matrix_error = 2e-8

def tearDown(self):
pass
Expand All @@ -474,9 +482,9 @@ def test_T_function(self):
p4_t_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97))
self.assertLess(
p4_t_error,
self.maxError,
self.max_error,
"Test of p(T) Function for Region 4 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": p4_t_error, "max": self.maxError},
" %(max)e" % {"error": p4_t_error, "max": self.max_error},
)

def test_p_functions(self):
Expand All @@ -489,9 +497,9 @@ def test_p_functions(self):
T4_p_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97))
self.assertLess(
T4_p_error,
self.maxError,
self.max_error,
"Test of T(p) Function for Region 4 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T4_p_error, "max": self.maxError},
" %(max)e" % {"error": T4_p_error, "max": self.max_error},
)

def test_s_functions(self):
Expand All @@ -517,17 +525,19 @@ def test_s_functions(self):
h4_s_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97))
self.assertLess(
h4_s_error,
self.maxError,
self.max_error,
"Test of h(s) Function for Region 4 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": h4_s_error, "max": self.maxError},
" %(max)e" % {"error": h4_s_error, "max": self.max_error},
)


class Region5Tester(unittest.TestCase):
"""tests for functions in region 5"""

def setUp(self):
self.maxError = 1e-8
self.max_error = 1e-8
# The accumulated Error is bigger than the error of each single function
self.maxMatrixError = 2e-8
self.max_matrix_error = 2e-8

def tearDown(self):
pass
Expand Down Expand Up @@ -557,9 +567,9 @@ def test_pT_function(self):
Region5_error = numpy.sum(numpy.absolute((R5 - IF97) / IF97))
self.assertLess(
Region5_error,
self.maxMatrixError,
self.max_matrix_error,
"Test of p,T Function for Region 5 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": Region5_error, "max": self.maxMatrixError},
" %(max)e" % {"error": Region5_error, "max": self.max_matrix_error},
)

def test_ph_function(self):
Expand All @@ -574,9 +584,9 @@ def test_ph_function(self):
T5_ph_error = numpy.sum(numpy.absolute((R5 - IF97) / IF97))
self.assertLess(
T5_ph_error,
self.maxError,
self.max_error,
"Test of T(p,h) Function for Region 5 failed. Error was %(error)e allowed:"
" %(max)e" % {"error": T5_ph_error, "max": self.maxError},
" %(max)e" % {"error": T5_ph_error, "max": self.max_error},
)

def test_ps_function(self):
Expand Down

0 comments on commit 29066af

Please sign in to comment.