1+ from __future__ import annotations
2+
13import os
24import sys
35from pathlib import Path
79from geophires_x .GeoPHIRESUtils import static_pressure_MPa
810from geophires_x .Model import Model
911from geophires_x .Reservoir import Reservoir
12+ from geophires_x_client import GeophiresInputParameters
13+ from geophires_x_client import GeophiresXClient
14+ from geophires_x_client import GeophiresXResult
1015from tests .base_test_case import BaseTestCase
1116
1217
@@ -27,6 +32,7 @@ def test_reservoir_lithostatic_pressure(self):
2732 self .assertAlmostEqual (79.433865 , p .magnitude , places = 3 )
2833 self .assertEqual ('megapascal' , p .units )
2934
35+ # noinspection PyMethodMayBeStatic
3036 def _new_model (self , input_file = None ) -> Model :
3137 stash_cwd = Path .cwd ()
3238 stash_sys_argv = sys .argv
@@ -45,3 +51,45 @@ def _new_model(self, input_file=None) -> Model:
4551 os .chdir (stash_cwd )
4652
4753 return m
54+
55+ def test_number_of_fractures (self ):
56+ def _get_result (num_fractures : int ) -> GeophiresXResult :
57+ return GeophiresXClient ().get_geophires_result (
58+ GeophiresInputParameters (
59+ from_file_path = self ._get_test_file_path ('generic-egs-case.txt' ),
60+ params = {
61+ 'Reservoir Volume Option' : '1, -- FRAC_NUM_SEP' ,
62+ 'Fracture Shape' : '3, -- Square' ,
63+ 'Fracture Height' : 165 ,
64+ 'Number of Fractures' : num_fractures ,
65+ },
66+ )
67+ )
68+
69+ def _fractures_lcoe_net (r : GeophiresXResult ) -> tuple [int , float , float ]:
70+ return (
71+ r .result ['RESERVOIR PARAMETERS' ]['Number of fractures' ]['value' ],
72+ r .result ['SUMMARY OF RESULTS' ]['Electricity breakeven price' ]['value' ],
73+ r .result ['SUMMARY OF RESULTS' ]['Average Net Electricity Production' ]['value' ],
74+ )
75+
76+ fractures , lcoe , net_production = _fractures_lcoe_net (_get_result (10_000 ))
77+
78+ self .assertEqual (10_000 , fractures )
79+
80+ self .assertGreater (lcoe , 0 )
81+ self .assertLess (lcoe , 400 )
82+
83+ self .assertGreater (net_production , 0 )
84+ self .assertLess (net_production , 500 )
85+
86+ max_fractures = 99_999
87+ fractures , lcoe , net_production = _fractures_lcoe_net (_get_result (max_fractures ))
88+
89+ self .assertEqual (max_fractures , fractures )
90+
91+ self .assertGreater (lcoe , 0 )
92+ self .assertLess (lcoe , 400 )
93+
94+ self .assertGreater (net_production , 0 )
95+ self .assertLess (net_production , 500 )
0 commit comments