12
12
from geophires_x_client import GeophiresInputParameters
13
13
from geophires_x_client import GeophiresXClient
14
14
from geophires_x_client import GeophiresXResult
15
+ from geophires_x_client import ImmutableGeophiresInputParameters
15
16
from tests .base_test_case import BaseTestCase
16
17
17
18
18
19
class ReservoirTestCase (BaseTestCase ):
20
+
19
21
def test_lithostatic_pressure (self ):
20
22
p = static_pressure_MPa (2700 , 3000 )
21
23
self .assertEqual (79.433865 , p )
@@ -32,6 +34,30 @@ def test_reservoir_lithostatic_pressure(self):
32
34
self .assertAlmostEqual (79.433865 , p .magnitude , places = 3 )
33
35
self .assertEqual ('megapascal' , p .units )
34
36
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
+
35
61
# noinspection PyMethodMayBeStatic
36
62
def _new_model (self , input_file = None ) -> Model :
37
63
stash_cwd = Path .cwd ()
0 commit comments