1212from geophires_x_client import GeophiresInputParameters
1313from geophires_x_client import GeophiresXClient
1414from geophires_x_client import GeophiresXResult
15+ from geophires_x_client import ImmutableGeophiresInputParameters
1516from tests .base_test_case import BaseTestCase
1617
1718
1819class ReservoirTestCase (BaseTestCase ):
20+
1921 def test_lithostatic_pressure (self ):
2022 p = static_pressure_MPa (2700 , 3000 )
2123 self .assertEqual (79.433865 , p )
@@ -32,6 +34,30 @@ def test_reservoir_lithostatic_pressure(self):
3234 self .assertAlmostEqual (79.433865 , p .magnitude , places = 3 )
3335 self .assertEqual ('megapascal' , p .units )
3436
37+ def test_gringarten_stehfest_precision (self ):
38+ def _get_result (gringarten_stehfest_precision : int ) -> GeophiresXResult :
39+ return GeophiresXClient (enable_caching = False ).get_geophires_result (
40+ ImmutableGeophiresInputParameters (
41+ from_file_path = self ._get_test_file_path ('generic-egs-case.txt' ),
42+ params = {'Gringarten-Stehfest Precision' : gringarten_stehfest_precision },
43+ )
44+ )
45+
46+ _ = _get_result (15 ) # warm up any caching
47+ result_15 = _get_result (15 )
48+ result_8 = _get_result (8 )
49+
50+ def calc_time (r : GeophiresXResult ) -> float :
51+ return r .result ['Simulation Metadata' ]['Calculation Time' ]['value' ]
52+
53+ calc_time_15_sec = calc_time (result_15 )
54+ calc_time_8_sec = calc_time (result_8 )
55+
56+ msg = f'calc_time_15_sec={ calc_time_15_sec } , calc_time_8_sec={ calc_time_8_sec } '
57+ print (f'[DEBUG] { msg } ' )
58+
59+ self .assertLess (calc_time_8_sec , calc_time_15_sec )
60+
3561 # noinspection PyMethodMayBeStatic
3662 def _new_model (self , input_file = None ) -> Model :
3763 stash_cwd = Path .cwd ()
0 commit comments