-
Notifications
You must be signed in to change notification settings - Fork 22
/
GEOPHIRESv2.py
2861 lines (2597 loc) · 155 KB
/
GEOPHIRESv2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 6 10:34:04 2017
@author: kbeckers
"""
#GEOPHIRES v2.0
#build date: December 9th 2018
#https://github.com/kfbeckers/GEOPHIRES
#import functions
import math
import datetime
import numpy as np
import time
from mpmath import *
import os
import sys
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# specify path of input file
fname = os.path.join('Examples','example4.txt')
tic = time.time()
#user-defined functions
def densitywater(Twater):
T = Twater+273.15
rhowater = ( .7983223 + (1.50896E-3 - 2.9104E-6*T) * T) * 1E3 #water density correlation as used in Geophires v1.2 [kg/m3]
return rhowater;
def viscositywater(Twater):
muwater = 2.414E-5*np.power(10,247.8/(Twater+273.15-140)) #accurate to within 2.5% from 0 to 370 degrees C [Ns/m2]
#xp = np.linspace(5,150,30)
#fp = np.array([1519.3, 1307.0, 1138.3, 1002.0, 890.2, 797.3, 719.1, 652.7, 596.1, 547.1, 504.4, 467.0, 433.9, 404.6, 378.5, 355.1, 334.1, 315.0, 297.8, 282.1, 267.8, 254.4, 242.3, 231.3, 221.3, 212.0, 203.4, 195.5, 188.2, 181.4])
#muwater = np.interp(Twater,xp,fp)
return muwater;
def heatcapacitywater(Twater):
Twater = (Twater + 273.15)/1000
A = -203.6060
B = 1523.290
C = -3196.413
D = 2474.455
E = 3.855326
cpwater = (A + B*Twater + C*Twater**2 + D*Twater**3 + E/(Twater**2))/18.02*1000 #water specific heat capacity in J/kg-K
return cpwater;
def vaporpressurewater(Twater):
if Twater < 100:
A = 8.07131
B = 1730.63
C = 233.426
else:
A = 8.14019
B = 1810.94
C = 244.485
vaporpressurewater = 133.322*(10**(A-B/(C+Twater)))/1000 #water vapor pressure in kPa using Antione Equation
return vaporpressurewater;
#read input data (except temperature profile from reservoir)
try:
with open(fname, encoding='UTF-8') as f:
content = f.readlines()
except:
print("Error: GEOPHIRES could not read input file ("+fname+") and will abort simulation.")
sys.exit()
#potential other parameters to be read in
# external reservoir output filename
# tough2file name
# distance for surface pipe
#enduseoption
#enduseoption = 1: electricity
#enduseoption = 2: direct-use heat
#enduseoption = 3: cogen topping cycle
#enduseoption = 4: cogen bottoming cycle
#enduseoption = 5: cogen split of mass flow rate
try:
enduseoption = int(content[[i for i, s in enumerate(content) if 'End-Use Option,' in s][0]].split(',')[1].strip('\n'))
if not (enduseoption in [1,2,31,32,41,42,51,52]):
enduseoption = 1
print("Warning: Provided end-use option is not 1, 2, 31, 32, 41, 42, 51, or 52. GEOPHIRES will assume default end-use option (1: electricity)")
except:
enduseoption = 1
print("Warning: No valid end-use option provided. GEOPHIRES will assume default end-use option (1: electricity)")
#pptype: power plant type
#pptype = 1: Subcritical ORC
#pptype = 2: Supercritical ORC
#pptype = 3: Single-Flash
#pptype = 4: Double-Flash
if enduseoption in [1,31,32,41,42,51,52]:
try:
pptype = int(content[[i for i, s in enumerate(content) if 'Power Plant Type,' in s][0]].split(',')[1].strip('\n'))
if not (pptype in [1,2,3,4]):
pptype = 1
print("Warning: Provided power plant type is not 1, 2, 3 or 4. GEOPHIRES will assume default power plant type (1: subcritical ORC)")
except:
pptype = 1
print("Warning: No valid power plant type provided. GEOPHIRES will assume default power plant type (1: subcritical ORC)")
#pumpeff: pump efficiency (-)
try:
pumpeff = float(content[[i for i, s in enumerate(content) if 'Circulation Pump Efficiency,' in s][0]].split(',')[1].strip('\n'))
if pumpeff < 0.1 or pumpeff > 1:
pumpeff = 0.75
print("Warning: Provided circulation pump efficiency outside of range 0.1-1. GEOPHIRES will assume default circulation pump efficiency (0.75)")
except:
pumpeff = 0.75
print("Warning: No valid circulation pump efficiency provided. GEOPHIRES will assume default circulation pump efficiency (0.75)")
#utilfactor: utilization factor (-)
try:
utilfactor = float(content[[i for i, s in enumerate(content) if 'Utilization Factor,' in s][0]].split(',')[1].strip('\n'))
if utilfactor < 0.1 or utilfactor > 1:
utilfactor = 0.9
print("Warning: Provided utilization factor outside of range 0.1-1. GEOPHIRES will assume default utilization factor (0.9)")
except:
utilfactor = 0.9
print("Warning: No valid utilization factor provided. GEOPHIRES will assume default utilization factor (0.9)")
#enduseefficiencyfactor: end-use efficiency for direct-use heat component [-]
if enduseoption in [2,31,32,41,42,51,52]:
try:
enduseefficiencyfactor = float(content[[i for i, s in enumerate(content) if 'End-Use Efficiency Factor,' in s][0]].split(',')[1].strip('\n'))
if enduseefficiencyfactor < 0.1 or enduseefficiencyfactor > 1:
enduseefficiencyfactor = 0.9
print("Warning: Provided end-use efficiency factor outside of range 0.1-1. GEOPHIRES will assume default end-use efficiency factor (0.9)")
except:
enduseefficiencyfactor = 0.9
print("Warning: No valid end-use efficiency factor provided. GEOPHIRES will assume default end-use efficiency factor (0.9)")
#chpfraction: fraction of flow rate going to direct-use heat application (only used in CHP parallel cycle)
if enduseoption in [51,52]:
try:
chpfraction = float(content[[i for i, s in enumerate(content) if 'CHP Fraction,' in s][0]].split(',')[1].strip('\n'))
if chpfraction < 0.0001 or chpfraction > 0.9999:
chpfraction = 0.5
print("Warning: Provided CHP fraction outside of range 0.0001-0.9999. GEOPHIRES will assume default CHP fraction (0.5)")
except:
chpfraction = 0.5
print("Warning: No valid CHP fraction provided. GEOPHIRES will assume default CHP fraction (0.5)")
#Tinj: injection temperature (C)
try:
Tinj = float(content[[i for i, s in enumerate(content) if 'Injection Temperature,' in s][0]].split(',')[1].strip('\n'))
if Tinj < 0 or Tinj > 200:
Tinj = 70
print("Warning: Provided injection temperature outside range of 0-200. GEOPHIRES will assume default injection temperature (70 deg.C)")
except:
Tinj = 70
print("Warning: No valid injection temperature provided. GEOPHIRES will assume default injection temperature (70 deg.C)")
#Tmax: Maximum allowable Reservoir Temperature (C)
try:
Tmax = float(content[[i for i, s in enumerate(content) if 'Maximum Temperature,' in s][0]].split(',')[1].strip('\n'))
if Tmax < 50 or Tmax > 1000:
Tmax = 400
print("Warning: Provided maximum temperature outside of range 50-1000. GEOPHIRES will assume default maximum temperature (400 deg.C)")
except:
Tmax = 400
print("Warning: No valid maximum temperature provided. GEOPHIRES will assume default maximum temperature (400 deg.C)")
#Tchpbottom: power plant entering temperature in the CHP Bottom cycle (in deg.C)
if enduseoption in [41,42]:
try:
Tchpbottom = float(content[[i for i, s in enumerate(content) if 'CHP Bottoming Entering Temperature,' in s][0]].split(',')[1].strip('\n'))
if Tchpbottom < Tinj or Tchpbottom > Tmax:
Tchpbottom = 150
print("Warning: Provided CHP bottoming entering temperature outside of range Tinj-Tmax. GEOPHIRES will assume default CHP bottom temperature (150 deg.C)")
except:
Tchpbottom = 150
print("Warning: Provided CHP bottoming entering temperature outside of range Tinj-Tmax. GEOPHIRES will assume default CHP bottom temperature (150 deg.C)")
#Tsurf: surface temperature used for calculating bottomhole temperature (in deg.C)
try:
Tsurf = float(content[[i for i, s in enumerate(content) if 'Surface Temperature,' in s][0]].split(',')[1].strip('\n'))
if Tsurf < -50 or Tsurf > 50:
Tsurf = 15
print("Warning: Provided surface temperature outside of range -50 to 50. GEOPHIRES will assume default surface temperature (15 deg.C)")
except:
Tsurf = 15
print("Warning: No valid surface temperature provided. GEOPHIRES will assume default surface temperature (15 deg.C)")
#Tenv: ambient temperature (in deg.C)
if enduseoption in [1,31,32,41,42,51,52]:
try:
Tenv = float(content[[i for i, s in enumerate(content) if 'Ambient Temperature,' in s][0]].split(',')[1].strip('\n'))
if Tenv < -50 or Tenv > 50:
Tenv = 15
print("Warning: Provided ambient temperature outside of range -50 to 50. GEOPHIRES will assume default ambient temperature (15 deg.C)")
except:
Tenv = 15
print("Warning: No valid ambient temperature provided. GEOPHIRES will assume default ambient temperature (15 deg.C)")
#resoption: Reservoir Option
# resoption = 1 Multiple parallel fractures model (LANL)
# resoption = 2 Volumetric block model (1D linear heat sweep model (Stanford))
# resoption = 3 Drawdown parameter model (Tester)
# resoption = 4 Thermal drawdown percentage model (GETEM)
# resoption = 5 Generic user-provided temperature profile
# resoption = 6 TOUGH2 is called
try:
resoption = int(content[[i for i, s in enumerate(content) if 'Reservoir Model,' in s][0]].split(',')[1].strip('\n'))
except:
resoption = 4
print("Warning: Parameter 'Reservoir Model' not found. GEOPHIRES will run default reservoir model (Thermal Drawdown Percentage Model)")
if not (resoption in [1,2,3,4,5,6]):
print("Warning: Selected Reservoir Model not valid. GEOPHIRES will run default reservoir model (Thermal Drawdown Percentage Model)")
resoption = 4
#drawdp: Drawdown parameter
# used in both resopt 3 and 4
# if resoption = 3: drawdp is in units of kg/s/m2
# if resoption = 4: drawdp is in units of 1/year
if resoption == 3 or resoption == 4:
try:
drawdp = float(content[[i for i, s in enumerate(content) if 'Drawdown Parameter,' in s][0]].split(',')[1].strip('\n'))
if drawdp < 0 or drawdp > 0.2:
if resoption == 3:
drawdp = 0.0001
print("Warning: Provided drawdown parameter outside of range 0-0.2. GEOPHIRES will assume default drawdown parameter (0.0001 kg/s/m2) for reservoir model 3")
elif resoption == 4:
drawdp = 0.005
print("Warning: Provided drawdown parameter outside of range 0-0.2. GEOPHIRES will assume default drawdown parameter (0.5 %/year) for reservoir model 4")
except:
if resoption == 3:
drawdp = 0.0001
print("Warning: No valid drawdown parameter found. GEOPHIRES will assume default drawdown parameter (0.0001 kg/s/m2) for reservoir model 3")
elif resoption == 4:
drawdp = 0.005
print("Warning: No valid drawdown parameter found. GEOPHIRES will assume default drawdown parameter (0.5 %/year) for reservoir model 4")
#read file name of reservoir output in case reservoir model 5 is selected
if resoption == 5:
try:
filenamereservoiroutput = content[[i for i, s in enumerate(content) if 'Reservoir Output File Name,' in s][0]].split(',')[1].strip('\n')
except:
filenamereservoiroutput = 'ReservoirOutput.txt'
print("Warning: No valid file name reservoir output found. GEOPHIRES will assume default reservoir output file name (ReservoirOutput.txt)")
#read TOUGH2 file name if reservoir model 6 is selected. If written 'Doublet', GEOPHIRES will run built-in TOUGH2 doublet model.
if resoption == 6:
try:
tough2modelfilename = content[[i for i, s in enumerate(content) if 'TOUGH2 Model/File Name,' in s][0]].split(',')[1].strip('\n')
except:
tough2modelfilename = 'Doublet'
print("Warning: No valid TOUGH2 model or file name provided. GEOPHIRES will assume default built-in TOUGH2 model (Doublet).")
if tough2modelfilename == 'Doublet':
usebuiltintough2model = 1
else:
usebuiltintough2model = 0
#depth: Measured depth of the well (provided in km by user and converted here to m).
try:
depth = float(content[[i for i, s in enumerate(content) if 'Reservoir Depth,' in s][0]].split(',')[1].strip('\n'))
if depth < 0.1 or depth > 15:
depth = 3.
print("Warning: Provided reservoir depth outside of range 0.1-15. GEOPHIRES will assume default reservoir depth (3 km)")
except:
depth = 3.
print("Warning: No reservoir depth found. GEOPHIRES will assume default reservoir depth (3 km)")
depth = depth*1000
#numseg: number of segments
try:
numseg = int(content[[i for i, s in enumerate(content) if 'Number of Segments,' in s][0]].split(',')[1].strip('\n'))
if not (numseg in [1,2,3,4]):
print("Warning: Provided number of segments outside of range 1-4. GEOPHIRES will assume default number of segments (1)")
except:
numseg = 1
print("Warning: No valid number of segments provided. GEOPHIRES will assume default number of segments (1)")
#gradient(i): geothermal gradient of layer i (provided in C/km and converted to C/m)
#layerthickness(i): thickness of layer i (provided in km and converted to m)
gradient = [0,0,0,0];
layerthickness = [0,0,0,0];
try:
gradient[0] = float(content[[i for i, s in enumerate(content) if 'Gradient 1,' in s][0]].split(',')[1].strip('\n'))/1000
if gradient[0] < 0 or gradient[0] > 0.5:
print("Warning: Provided geothermal gradient for layer 1 outside of range 0-500. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
gradient[0] = 50./1000
except:
gradient[0] = 50./1000
print("Warning: No valid geothermal gradient for layer 1 provided. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
if numseg>1:
try:
gradient[1] = float(content[[i for i, s in enumerate(content) if 'Gradient 2,' in s][0]].split(',')[1].strip('\n'))/1000
if gradient[1] < 0 or gradient[1] > 0.5:
print("Warning: Provided geothermal gradient for layer 2 outside of range 0-500. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
gradient[1] = 50./1000
except:
gradient[1] = 50./1000
print("Warning: No valid geothermal gradient for layer 2 provided. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
try:
layerthickness[0] = float(content[[i for i, s in enumerate(content) if 'Thickness 1,' in s][0]].split(',')[1].strip('\n'))*1000
if layerthickness[0] < 10 or layerthickness[0] > 100000:
print("Warning: Provided thickness for layer 1 outside of range 0.01-100. GEOPHIRES will assume default layer thickness (2 km)")
layerthickness[0] = 2.*1000
except:
layerthickness[0] = 2.*1000
print("Warning: No valid thickness for layer 1 provided. GEOPHIRES will assume default layer thickness (2 km)")
if numseg > 2:
try:
gradient[2] = float(content[[i for i, s in enumerate(content) if 'Gradient 3,' in s][0]].split(',')[1].strip('\n'))/1000
if gradient[2] < 0 or gradient[2] > 0.5:
print("Warning: Provided geothermal gradient for layer 3 outside of range 0-500. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
gradient[2] = 50./1000
except:
gradient[2] = 50./1000
print("Warning: No valid geothermal gradient for layer 3 provided. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
try:
layerthickness[1] = float(content[[i for i, s in enumerate(content) if 'Thickness 2,' in s][0]].split(',')[1].strip('\n'))*1000
if layerthickness[1] < 10 or layerthickness[1] > 100000:
print("Warning: Provided thickness for layer 2 outside of range 0.01-100. GEOPHIRES will assume default layer thickness (2 km)")
layerthickness[1] = 2.*1000
except:
layerthickness[1] = 2.*1000
print("Warning: No valid thickness for layer 2 provided. GEOPHIRES will assume default layer thickness (2 km)")
if numseg > 3:
try:
gradient[3] = float(content[[i for i, s in enumerate(content) if 'Gradient 4,' in s][0]].split(',')[1].strip('\n'))/1000
if gradient[3] < 0 or gradient[3] > 0.5:
print("Warning: Provided geothermal gradient for layer 4 outside of range 0-500. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
gradient[3] = 50./1000
except:
gradient[3] = 50./1000
print("Warning: No valid geothermal gradient for layer 4 provided. GEOPHIRES will assume default geothermal gradient (50 deg.C/km)")
try:
layerthickness[2] = float(content[[i for i, s in enumerate(content) if 'Thickness 3,' in s][0]].split(',')[1].strip('\n'))*1000
if layerthickness[2] < 10 or layerthickness[2] > 100000:
print("Warning: Provided thickness for layer 3 outside of range 0.01-100. GEOPHIRES will assume default layer thickness (2 km)")
layerthickness[2] = 2.*1000
except:
layerthickness[2] = 2.*1000
print("Warning: No valid thickness for layer 3 provided. GEOPHIRES will assume default layer thickness (2 km)")
# set thickness of bottom segment to large number to override lower, unused segments
layerthickness[numseg-1] = 100000
# convert 0 C/m gradients to very small number, avoids divide by zero errors later
gradient = [1e-6 if x==0 else x for x in gradient]
#nprod: number of production wells
#ninj: number of injection wells
try:
nprod = float(content[[i for i, s in enumerate(content) if 'Number of Production Wells,' in s][0]].split(',')[1].strip('\n'))
if not (nprod in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]):
print("Warning: Provided number of production wells is outside range 1-20. GEOPHIRES will assume default number of production wells (2)")
nprod = 2
except:
print("Warning: No valid number of production wells provided. GEOPHIRES will assume default number of production wells (2)")
nprod = 2
try:
ninj = float(content[[i for i, s in enumerate(content) if 'Number of Injection Wells,' in s][0]].split(',')[1].strip('\n'))
if not (ninj in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]):
print("Warning: Provided number of injection wells is outside range 1-20. GEOPHIRES will assume default number of injection wells (2)")
ninj = 2
except:
print("Warning: No valid number of injection wells provided. GEOPHIRES will assume default number of injection wells (2)")
ninj = 2
#prodwelldiam: production well diameter (input as inch and converted to m)
#injwelldiam: injection well diameter (input as inch and converted to m)
try:
prodwelldiam = float(content[[i for i, s in enumerate(content) if 'Production Well Diameter,' in s][0]].split(',')[1].strip('\n'))*0.0254
if prodwelldiam/0.0254 < 1 or prodwelldiam/0.0254 > 30:
prodwelldiam = 8*0.0254
print("Warning: Provided production well diameter is outside range 1-30. GEOPHIRES will assume default production well diameter (8 inch)")
except:
prodwelldiam = 8*0.0254
print("Warning: No valid production well diameter provided. GEOPHIRES will assume default production well diameter (8 inch)")
try:
injwelldiam = float(content[[i for i, s in enumerate(content) if 'Injection Well Diameter,' in s][0]].split(',')[1].strip('\n'))*0.0254
if injwelldiam/0.0254 < 1 or injwelldiam/0.0254 > 30:
injwelldiam = 8*0.0254
print("Warning: Provided injection well diameter is outside range 1-30. GEOPHIRES will assume default injection well diameter (8 inch)")
except:
injwelldiam = 8*0.0254
print("Warning: No valid injection well diameter provided. GEOPHIRES will assume default injection well diameter (8 inch)")
#rameyoptionprod
#rameyoptionprod = 0: use tempdrop to calculate production well temperature drop
#rameyoptionprod = 1: use Ramey model to calculate production well temperature drop
try:
rameyoptionprod = int(content[[i for i, s in enumerate(content) if 'Ramey Production Wellbore Model,' in s][0]].split(',')[1].strip('\n'))
if not (rameyoptionprod in [0,1]):
rameyoptionprod = 1
print("Warning: Selected Ramey Production Wellbore Model parameter not valid. GEOPHIRES will assume default production wellbore model (Ramey model active)")
except:
rameyoptionprod = 1
print("Warning: No valid Ramey Production Wellbore Model parameter provided. GEOPHIRES will assume default productino wellbore model (Ramey model active)")
#tempdropprod: temperature drop in production well in deg. C (if Ramey model is not used)
if rameyoptionprod == 0:
try:
tempdropprod = float(content[[i for i, s in enumerate(content) if 'Production Wellbore Temperature Drop,' in s][0]].split(',')[1].strip('\n'))
if tempdropprod <-5 or tempdropprod > 50:
print("Warning: Provided production wellbore temperature drop outside of range -5 to 50. GEOPHIRES will assume default production wellbore temperature drop (5deg.C)")
tempdropprod = 5
except:
tempdropprod = 5
print("Warning: No valid production wellbore temperature drop provided. GEOPHIRES will assume default production wellbore temperature drop (5deg.C)")
try:
tempgaininj = float(content[[i for i, s in enumerate(content) if 'Injection Wellbore Temperature Gain,' in s][0]].split(',')[1].strip('\n'))
if tempgaininj <-5 or tempgaininj > 50:
print("Warning: Provided injection wellbore temperature gain outside of range -5 to 50. GEOPHIRES will assume default injection wellbore temperature gain (0deg.C)")
tempgaininj = 0
except:
tempgaininj = 0
print("Warning: No valid injection wellbore temperature gain provided. GEOPHIRES will assume default injection wellbore temperature gain (0deg.C)")
#prodwellflowrate: flow rate per production well (kg/s)
try:
prodwellflowrate = float(content[[i for i, s in enumerate(content) if 'Production Flow Rate per Well,' in s][0]].split(',')[1].strip('\n'))
if prodwellflowrate < 1 or prodwellflowrate > 500:
prodwellflowrate = 50
print("Warning: Provided production wellbore flow rate is outside of range 1-500. GEOPHIRES will assume default flow rate per production well (50 kg/s)")
except:
prodwellflowrate = 50
print("Warning: No valid production wellbore flow rate is provided. GEOPHIRES will assume default flow rate per production well (50 kg/s)")
#resvoloption: Rock mass volume option
# resvoloption = 1 Specify fracnumb, fracsep
# resvoloption = 2 specify resvol, fracsep
# resvoloption = 3 Specify resvol, fracnumb
# resvoloption = 4: Specify resvol only (sufficient for reservoir models 3, 4, 5 and 6)
try:
resvoloption = int(content[[i for i, s in enumerate(content) if 'Reservoir Volume Option,' in s][0]].split(',')[1].strip('\n'))
if not resvoloption in [1,2,3,4]:
if resoption in [1,2]:
resvoloption = 3
print("Warning: Reservoir volume option should be 1, 2 or 3. GEOPHIRES will assume default reservoir volume option (3)")
else:
resvoloption = 4
print("Warning: Reservoir volume option should be 1, 2, 3, or 4. GEOPHIRES will assume default reservoir volume option (4)")
except:
if resoption in [1,2]:
resvoloption = 3
print("Warning: No valid reservoir volume option provided. GEOPHIRES will assume default reservoir volume option (3)")
else:
resvoloption = 4
print("Warning: No valid reservoir volume option provided. GEOPHIRES will assume default reservoir volume option (4)")
if resvoloption == 4 and resoption in [1,2]:
resvoloption = 3
print("Warning: If user-selected reservoir model is 1 or 2, then user-selected reservoir volume option cannot be 4 but should be 1, 2, or 3. GEOPHIRES will assume reservoir volume option 3.")
if resoption in [1,2] or resvoloption in [1,2,3] : #the first two reservoir models require fracture geometry
#fracshape: Shape of fractures
# fracshape = 1 Circular fracture with known area
# fracshape = 2 Circular fracture with known diameter
# fracshape = 3 Square fracture
# fracshape = 4 Rectangular fracture
try:
fracshape = int(content[[i for i, s in enumerate(content) if 'Fracture Shape,' in s][0]].split(',')[1].strip('\n'))
if not (fracshape in [1,2,3,4]):
fracshape = 1
print("Warning: Provided fracture shape should be 1, 2, 3, or 4. GEOPHIRES will assume default fracture shape (1)")
except:
fracshape = 1
print("Warning: No valid fracture shape provided. GEOPHIRES will assume default fracture shape (1)")
#fracarea: Effective heat transfer area per fracture (m2) (required if fracshape = 1)
if fracshape == 1:
try:
fracarea = float(content[[i for i, s in enumerate(content) if 'Fracture Area,' in s][0]].split(',')[1].strip('\n'))
if fracarea < 1 or fracarea > 100000000:
fracarea = 250000
print("Warning: Provided fracture area outside of range 1-100000000. GEOPHIRES will assume default fracture area (250,000 m2)")
except:
fracarea = 250000
print("Warning: No valid fracture area provided. GEOPHIRES will assume default fracture area (250,000 m2)")
#fracheight: Height of fracture = well separation (m)
if fracshape in [2,3,4]:
try:
fracheight = float(content[[i for i, s in enumerate(content) if 'Fracture Height,' in s][0]].split(',')[1].strip('\n'))
if fracheight < 1 or fracheight > 10000:
fracheight = 500
print("Warning: Provided fracture height outside of range 1-10000. GEOPHIRES will assume default fracture height (500 m)")
except:
fracheight = 500
print("Warning: No valid fracture height provided. GEOPHIRES will assume default fracture height (500 m)")
#fracwidth: Width of fracture (m)
if fracshape == 4:
try:
fracwidth = float(content[[i for i, s in enumerate(content) if 'Fracture Width,' in s][0]].split(',')[1].strip('\n'))
if fracwidth < 1 or fracwidth > 10000:
fracwidth = 500
print("Warning: Provided fracture width outside of range 1-10000. GEOPHIRES will assume default fracture width (500 m)")
except:
fracwidth = 500
print("Warning: No valid fracture width provided. GEOPHIRES will assume default fracture width (500 m)")
#calculate fracture geometry:
#fracshape = 1: calculate diameter of circular fracture
#fracshape = 2: calculate area of circular fracture
#fracshape = 3: calculate area of square fracture
#fracshape = 4: calculate area of rectangular fracture
if fracshape == 1:
fracheight = math.sqrt(4/math.pi*fracarea)
fracwidth = fracheight
elif fracshape == 2:
fracwidth = fracheight
fracarea = math.pi/4*fracheight*fracheight
elif fracshape == 3:
fracwidth = fracheight
fracarea = fracheight*fracwidth
elif fracshape == 4:
fracarea = fracheight*fracwidth
#fracnumb: number of fractures
if resvoloption in [1,3]:
try:
fracnumb = int(content[[i for i, s in enumerate(content) if 'Number of Fractures,' in s][0]].split(',')[1].strip('\n'))
if not (fracnumb in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]):
fracnumb = 10
print("Warning: Provided number of fractures outside of range 1-20. GEOPHIRES will assume default number of fractures (10)")
except:
fracnumb = 10
print("Warning: No valid number of fractures provided. GEOPHIRES will assume default number of fractures (10)")
#fracsep: fracture separation [m]
if resvoloption in [1,2]:
try:
fracsep = float(content[[i for i, s in enumerate(content) if 'Fracture Separation,' in s][0]].split(',')[1].strip('\n'))
if fracsep < 1 or fracsep > 10000:
print("Warning: Provided fracture separation outside of range 1-10000. GEOPHIRES will assume default fracture separation (50 m)")
fracsep = 50
except:
fracsep = 50
print("Warning: No valid fracture separation provided. GEOPHIRES will assume default fracture separation (50 m)")
#resvol: reservoir volume [m^3]
if resvoloption in [2,3,4]:
try:
resvol = float(content[[i for i, s in enumerate(content) if 'Reservoir Volume,' in s][0]].split(',')[1].strip('\n'))
if resvol < 10 or resvol > 10000*10000*10000:
print("Warning: Provided reservoir volume outside of range 10-1E12. GEOPHIRES will assume default reservoir volume (1.25E8 m3)")
resvol = 500.*500*500
except:
resvol = 500.*500*500
print("Warning: No valid reservoir volume provided. GEOPHIRES will assume default reservoir volume (1.25E8 m3)")
#calculate reservoir geometry:
#resvoloption = 1: calculate volume of fractured rock mass
#resvoloption = 2: calculate number of fractures
#resvoloption = 3: calculate fracture separation
if resvoloption == 1:
resvol = (fracnumb-1)*fracarea*fracsep
elif resvoloption == 2:
fracnumb = resvol/fracarea/fracsep+1
elif resvoloption == 3:
fracsep = resvol/fracarea/(fracnumb-1)
#waterloss: fraction of water lost = (total geofluid lost)/(total geofluid produced)
try:
waterloss = float(content[[i for i, s in enumerate(content) if 'Water Loss Fraction,' in s][0]].split(',')[1].strip('\n'))
if waterloss < 0 or waterloss > 0.99:
waterloss = 0
print("Warning: Provided water loss fraction outside of range 0-0.99. GEOPHIRES will assume default water loss fraction (0)")
except:
waterloss = 0
print("Warning: No valid water loss fraction provided. GEOPHIRES will assume default water loss fraction (0)")
impedancemodelallowed = 1
productionwellpumping = 1
setinjectionpressurefixed = 0
if enduseoption == 1:
if pptype in [3,4]: #simple single- or double-flash power plant assumes no production well pumping
impedancemodelallowed = 0
productionwellpumping = 0
setinjectionpressurefixed = 1
elif enduseoption in [31,32]:
if pptype in [3,4]: #co-generation topping cycle with single- or double-flash power plant assumes no production well pumping
impedancemodelallowed = 0
productionwellpumping = 0
setinjectionpressurefixed = 1
elif enduseoption in [41,42]:
if pptype in [3,4]: #co-generation bottoming cycle with single- or double-flash power plant assumes production well pumping
impedancemodelallowed = 0
setinjectionpressurefixed = 1
elif enduseoption in [51,52]:
if pptype in [3,4]: #co-generation parallel cycle with single- or double-flash power plant assumes production well pumping
impedancemodelallowed = 0
setinjectionpressurefixed = 1
impedancemodelused = 0
if impedancemodelallowed == 1:
try:
#impedance: impedance per wellpair (input as GPa*s/m^3 and converted to KPa/kg/s (assuming 1000 for density; density will be corrected for later))
impedance = float(content[[i for i, s in enumerate(content) if 'Reservoir Impedance,' in s][0]].split(',')[1].strip('\n'))*1E6/1E3
impedancemodelused = 1
if impedance < 0.0001*1000 or impedance > 10000:
impedance = 0.1*1E6/1E3
print("Warning: Provided reservoir impedance outside of range 0.0001-1000. GEOPHIRES will assume default reservoir impedance (0.1 GPa*s/m3)")
except:
impedancemodelused = 0
if impedancemodelallowed == 0 or impedancemodelused == 0:
try:
#reservoir hydrostatic pressure [kPa]
Phydrostatic = float(content[[i for i, s in enumerate(content) if 'Reservoir Hydrostatic Pressure,' in s][0]].split(',')[1].strip('\n'))
usebuiltinhydrostaticpressurecorrelation = 0
if Phydrostatic < 100 or Phydrostatic > 100000:
usebuiltinhydrostaticpressurecorrelation = 1
print("Warning: Provided reservoir hydrostatic pressure outside of range 100-100000 kPa. GEOPHIRES will assume built-in reservoir hydrostatic pressure correlation")
except:
usebuiltinhydrostaticpressurecorrelation = 1
print("Warning: No valid reservoir hydrostatic pressure provided. GEOPHIRES will assume built-in reservoir hydrostatic pressure correlation")
try:
#injectivity index [kg/s/bar]
II = float(content[[i for i, s in enumerate(content) if 'Injectivity Index,' in s][0]].split(',')[1].strip('\n'))
if II < 0.01 or II > 10000:
II = 10
print("Warning: Provided injectivity index outside of range 0.01-10000. GEOPHIRES will assume default injectivity index (10 kg/s/bar)")
except:
II = 10
print("Warning: No valid injectivity index provided. GEOPHIRES will assume default injectivity index (10 kg/s/bar)")
if productionwellpumping == 1:
try:
#productivity index [kg/s/bar]
PI = float(content[[i for i, s in enumerate(content) if 'Productivity Index,' in s][0]].split(',')[1].strip('\n'))
if PI < 0.01 or PI > 10000:
PI = 10
print("Warning: Provided productivity index outside of range 0.01-10000. GEOPHIRES will assume default productivity index (10 kg/s/bar)")
except:
PI = 10
print("Warning: No valid productivity index provided. GEOPHIRES will assume default productivity index (10 kg/s/bar)")
try:
#production wellhead pressure [kPa]
ppwellhead = float(content[[i for i, s in enumerate(content) if 'Production Wellhead Pressure,' in s][0]].split(',')[1].strip('\n'))
usebuiltinppwellheadcorrelation = 0
if ppwellhead < 0 or ppwellhead > 10000:
usebuiltinppwellheadcorrelation = 1
print("Warning: Provided production wellhead pressure outside of range 0-10000 kPa. GEOPHIRES will calculate production wellhead pressure using built-in correlation")
except:
usebuiltinppwellheadcorrelation = 1
print("Warning: No valid production wellhead pressure provided. GEOPHIRES will calculate production wellhead pressure using built-in correlation")
try:
#plant outlet pressure [kPa]
Pplantoutlet = float(content[[i for i, s in enumerate(content) if 'Plant Outlet Pressure,' in s][0]].split(',')[1].strip('\n'))
usebuiltinoutletplantcorrelation = 0
if Pplantoutlet < 0 or Pplantoutlet > 10000:
if setinjectionpressurefixed == 1:
Pplantoutlet = 100
print("Warning: Provided plant outlet pressure outside of range 0-10000. GEOPHIRES will assume default plant outlet pressure (100 kPa)")
else:
usebuiltinoutletplantcorrelation = 1
print("Warning: Provided plant outlet pressure outside of range 0-10000 kPa. GEOPHIRES will calculate plant outlet pressure based on production wellhead pressure and surface equipment pressure drop of 10 psi")
except:
if setinjectionpressurefixed == 1:
usebuiltinoutletplantcorrelation = 0
Pplantoutlet = 100
print("Warning: No valid plant outlet pressure provided. GEOPHIRES will assume default plant outlet pressure (100 kPa)")
else:
usebuiltinoutletplantcorrelation = 1
print("Warning: No valid plant outlet pressure provided. GEOPHIRES will calculate plant outlet pressure based on production wellhead pressure and surface equipment pressure drop of 10 psi")
#impedance: impedance per wellpair (input as GPa*s/m^3 and converted to KPa/kg/s (assuming 1000 for density))
#try:
# impedance = float(content[[i for i, s in enumerate(content) if 'Reservoir Impedance,' in s][0]].split(',')[1].strip('\n'))*1E6/1E3
# if impedance < 0.0001*1000 or impedance > 10000:
# impedance = 0.1*1E6/1E3
# print("Warning: Provided reservoir impedance outside of range 0.0001-1000. GEOPHIRES will assume default reservoir impedance (0.1 GPa*s/m3)")
#except:
# impedance = 0.1*1E6/1E3
# print("Warning: No valid reservoir impedance provided. GEOPHIRES will assume default reservoir impedance (0.1 GPa*s/m3)")
#maxdrawdown: maximum allowable drawdown before redrilling (only works with built in reservoir models)
if resoption in [1,2,3,4]:
try:
maxdrawdown = float(content[[i for i, s in enumerate(content) if 'Maximum Drawdown,' in s][0]].split(',')[1].strip('\n'))
if maxdrawdown <0 or maxdrawdown > 1:
maxdrawdown = 1
print("Warning: Provided maximum drawdown outside of range 0-1. GEOPHIRES will assume default maximum drawdown (1)")
except:
maxdrawdown = 1
print("Warning: No valid maximum drawdown provided. GEOPHIRES will assume default maximum drawdown (1)")
#cprock: reservoir heat capacity (in J/kg/K)
try:
cprock = float(content[[i for i, s in enumerate(content) if 'Reservoir Heat Capacity,' in s][0]].split(',')[1].strip('\n'))
if cprock < 100 or cprock > 10000:
cprock = 1000
print("Warning: Provided reservoir heat capacity outside of range 100-10000. GEOPHIRES will assume default reservoir heat capacity (1000 J/kg/K)")
except:
cprock = 1000
print("Warning: No valid reservoir heat capacity provided. GEOPHIRES will assume default reservoir heat capacity (1000 J/kg/K)")
#rhorock: reservoir density (in kg/m3)
try:
rhorock = float(content[[i for i, s in enumerate(content) if 'Reservoir Density,' in s][0]].split(',')[1].strip('\n'))
if rhorock < 100 or rhorock > 20000:
rhorock = 2700
print("Warning: Provided reservoir density outside of range 100-10000. GEOPHIRES will assume default reservoir density (2700 J/kg/K)")
except:
rhorock = 2700
print("Warning: No valid reservoir density provided. GEOPHIRES will assume default reservoir density (2700 J/kg/K)")
#krock: reservoir thermal conductivity (in W/m/K)
if rameyoptionprod == 1 or resoption in [1,2,3] or (resoption == 6 and usebuiltintough2model == 1):
try:
krock = float(content[[i for i, s in enumerate(content) if 'Reservoir Thermal Conductivity,' in s][0]].split(',')[1].strip('\n'))
if krock < 0.01 or krock > 100:
krock = 3
print("Warning: Provided reservoir thermal conductivity outside of range 0.01-100. GEOPHIRES will assume default reservoir thermal conductivity (3 W/m/K)")
except:
krock = 3
print("Warning: No valid reservoir thermal conductivity provided. GEOPHIRES will assume default reservoir thermal conductivity (3 W/m/K)")
#porrock: reservoir porosity (-)
if resoption == 2 or (resoption == 6 and usebuiltintough2model == 1):
try:
porrock = float(content[[i for i, s in enumerate(content) if 'Reservoir Porosity,' in s][0]].split(',')[1].strip('\n'))
if porrock < 0.001 or porrock > 0.99:
porrock = 0.04
print("Warning: Provided reservoir porosity outside of range 0.001-0.99. GEOPHIRES will assume default reservoir porosity (0.04)")
except:
porrock = 0.04
print("Warning: No valid reservoir porosity provided. GEOPHIRES will assume default reservoir porosity (0.04)")
#permrock: reservoir permeability (m2)
if resoption == 6 and usebuiltintough2model == 1:
try:
permrock = float(content[[i for i, s in enumerate(content) if 'Reservoir Permeability,' in s][0]].split(',')[1].strip('\n'))
if permrock < 1E-20 or permrock > 1E-5:
permrock = 1E-13
print("Warning: Provided reservoir permeability outside of range 1E-20 to 1E-5. GEOPHIRES will assume default reservoir permeability (1E-13 m^2)")
except:
permrock = 1E-13
print("Warning: No valid reservoir permeability provided. GEOPHIRES will assume default reservoir permeability (1E-13 m^2)")
#resthickness: reservoir thickness (m)
if resoption == 6 and usebuiltintough2model == 1:
try:
resthickness = float(content[[i for i, s in enumerate(content) if 'Reservoir Thickness,' in s][0]].split(',')[1].strip('\n'))
if resthickness < 10 or resthickness > 10000:
resthickness = 250
print("Warning: Provided reservoir thickness outside of range 10-10000. GEOPHIRES will assume default reservoir thickness (250 m)")
except:
resthickness = 250
print("Warning: No valid reservoir thickness provided (necessary for using built-in TOUGH2 model). GEOPHIRES will assume default reservoir thickness (250 m)")
#reswidth: reservoir width (m)
if resoption == 6 and usebuiltintough2model == 1:
try:
reswidth = float(content[[i for i, s in enumerate(content) if 'Reservoir Width,' in s][0]].split(',')[1].strip('\n'))
if reswidth < 10 or reswidth > 10000:
reswidth = 500
print("Warning: Provided reservoir width outside of range 10-10000. GEOPHIRES will assume default reservoir width (500 m)")
except:
reswidth = 500
print("Warning: No valid reservoir width provided (necessary for using built-in TOUGH2 model). GEOPHIRES will assume default reservoir width (500 m)")
#wellsep: well separation (m)
if resoption == 6 and usebuiltintough2model == 1:
try:
wellsep = float(content[[i for i, s in enumerate(content) if 'Well Separation,' in s][0]].split(',')[1].strip('\n'))
if wellsep < 10 or wellsep > 10000:
wellsep = 1000
print("Warning: Provided well seperation outside of range 10-10000. GEOPHIRES will assume default well seperation (1000 m)")
except:
wellsep = 1000
print("Warning: No valid well seperation provided (necessary for using built-in TOUGH2 model). GEOPHIRES will assume default well seperation (1000 m)")
#plantlifetime: plant lifetime (years)
try:
plantlifetime = int(content[[i for i, s in enumerate(content) if 'Plant Lifetime,' in s][0]].split(',')[1].strip('\n'))
if not (plantlifetime in list(range(1,101))):
plantlifetime = 30
print("Warning: Provided plant lifetime outside of range 1-100. GEOPHIRES will assume default plant lifetime (30 years)")
except:
plantlifetime = 30
print("Warning: No valid plant lifetime provided. GEOPHIRES will assume default plant lifetime (30 years)")
#econmodel
#econmodel = 1: use Fixed Charge Rate Model (requires an FCR)
#econmodel = 2: use standard LCOE/LCOH calculation as found on wikipedia (requries an interest rate).
#econmodel = 3: use Bicycle LCOE/LCOH model (requires several financial input parameters)
try:
econmodel = int(content[[i for i, s in enumerate(content) if 'Economic Model,' in s][0]].split(',')[1].strip('\n'))
if not (econmodel in [1,2,3]):
econmodel = 2
print("Warning: Provided economic model should be 1, 2, or 3. GEOPHIRES will assume default economic model (2)")
except:
econmodel = 2
print("Warning: No valid economic model provided. GEOPHIRES will assume default economic model (2)")
#FCR: fixed charge rate required if econmodel = 1
if econmodel == 1:
try:
FCR = float(content[[i for i, s in enumerate(content) if 'Fixed Charge Rate,' in s][0]].split(',')[1].strip('\n'))
if FCR < 0 or FCR > 1:
FCR = 0.1
print("Warning: Provided fixed charge rate is outside of range 0-1. GEOPHIRES will assume default fixed charge rate (0.1)")
except:
FCR = 0.1
print("Warning: No valid fixed charge rate provided. GEOPHIRES will assume default fixed charge rate (0.1)")
#discountrate: discount rate required if econmodel = 2
if econmodel == 2:
try:
discountrate = float(content[[i for i, s in enumerate(content) if 'Discount Rate,' in s][0]].split(',')[1].strip('\n'))
if discountrate < 0 or discountrate > 1:
discountrate = 0.07
print("Warning: Provided discount rate is outside of range 0-1. GEOPHIRES will assume default discount rate (0.07)")
except:
discountrate = 0.07
print("Warning: No valid discount rate provided. GEOPHIRES will assume default discount rate (0.07)")
#a whole bunch of BICYCLE parameters provided if econmodel = 3
if econmodel == 3:
#bicycle parameters
#FIB: fraction of investment in bonds (-)
try:
FIB = float(content[[i for i, s in enumerate(content) if 'Fraction of Investment in Bonds,' in s][0]].split(',')[1].strip('\n'))
if FIB < 0 or FIB > 1:
FIB = 0.5
print("Warning: Provided fraction of investment in bonds is outside of range 0-1. GEOPHIRES will assume default fraction of investment in bonds (0.5)")
except:
FIB = 0.5
print("Warning: No valid fraction of investment in bonds provided. GEOPHIRES will assume default fraction of investment in bonds (0.5)")
#BIR: inflated bonds interest rate (-)
try:
BIR = float(content[[i for i, s in enumerate(content) if 'Inflated Bond Interest Rate,' in s][0]].split(',')[1].strip('\n'))
if BIR < 0 or BIR > 1:
BIR = 0.05
print("Warning: Provided inflated bond interest rate is outside of range 0-1. GEOPHIRES will assume default inflated bond interest rate (0.05)")
except:
BIR = 0.05
print("Warning: No valid inflated bond interest rate provided. GEOPHIRES will assume default inflated bond interest rate (0.05)")
#EIR: inflated equity interest rate (-)
try:
EIR = float(content[[i for i, s in enumerate(content) if 'Inflated Equity Interest Rate,' in s][0]].split(',')[1].strip('\n'))
if EIR < 0 or EIR > 1:
EIR = 0.1
print("Warning: Provided inflated equity interest rate is outside of range 0-1. GEOPHIRES will assume default inflated equity interest rate (0.1)")
except:
EIR = 0.1
print("Warning: No valid inflated equity interest rate provided. GEOPHIRES will assume default inflated equity interest rate (0.1)")
#RINFL: inflation rate (-)
try:
RINFL = float(content[[i for i, s in enumerate(content) if 'Inflation Rate,' in s][0]].split(',')[1].strip('\n'))
if RINFL < -0.1 or RINFL > 1:
RINFL = 0.02
print("Warning: Provided inflation rate is outside of range -0.1 to 1. GEOPHIRES will assume default inflation rate (0.02)")
except:
RINFL = 0.02
print("Warning: No valid inflation rate provided. GEOPHIRES will assume default inflation rate (0.02)")
#CTR: combined income tax rate in fraction (-)
try:
CTR = float(content[[i for i, s in enumerate(content) if 'Combined Income Tax Rate,' in s][0]].split(',')[1].strip('\n'))
if CTR < 0 or CTR > 1:
CTR = 0.3
print("Warning: Provided combined income tax rate is outside of range 0 to 1. GEOPHIRES will assume default combined income tax rate (0.3)")
except:
CTR = 0.3
print("Warning: No valid combined income tax rate provided. GEOPHIRES will assume default combined income tax rate (0.3)")
#GTR: gross revenue tax rate in fraction (-)
try:
GTR = float(content[[i for i, s in enumerate(content) if 'Gross Revenue Tax Rate,' in s][0]].split(',')[1].strip('\n'))
if GTR < 0 or GTR > 1:
GTR = 0
print("Warning: Provided gross revenue tax rate is outside of range 0 to 1. GEOPHIRES will assume default gross revenue tax rate (0)")
except:
GTR = 0
print("Warning: No valid gross revenue tax rate provided. GEOPHIRES will assume default gross revenue tax rate (0)")
#RITC: investment tax credit rate in fraction (-)
try:
RITC = float(content[[i for i, s in enumerate(content) if 'Investment Tax Credit Rate,' in s][0]].split(',')[1].strip('\n'))
if RITC < 0 or RITC > 1:
RITC = 0
print("Warning: Provided investment tax credit rate is outside of range 0 to 1. GEOPHIRES will assume default investment tax credit rate (0)")
except:
RITC = 0
print("Warning: No valid investment tax credit rate provided. GEOPHIRES will assume default investment tax credit rate (0)")
#PTR: property tax rate in fraction (-)
try:
PTR = float(content[[i for i, s in enumerate(content) if 'Property Tax Rate,' in s][0]].split(',')[1].strip('\n'))
if PTR < 0 or PTR > 1:
PTR = 0
print("Warning: Provided property rate is outside of range 0 to 1. GEOPHIRES will assume default property tax rate (0)")
except:
PTR = 0
print("Warning: No valid property tax rate provided. GEOPHIRES will assume default property tax rate (0)")
#inflrateconstruction: inflation rate during construction (-)
try:
inflrateconstruction = float(content[[i for i, s in enumerate(content) if 'Inflation Rate During Construction,' in s][0]].split(',')[1].strip('\n'))
if inflrateconstruction < 0 or inflrateconstruction > 1:
inflrateconstruction = 0
print("Warning: Provided inflation rate during construction is outside of range 0 to 1. GEOPHIRES will assume default inflation rate during construction (0)")
except:
inflrateconstruction = 0
print("Warning: No valid inflation rate during construction provided. GEOPHIRES will assume default inflation rate during construction (0)")
#capital cost parameters
try: #user can provide total capital cost (M$)
totalcapcost = float(content[[i for i, s in enumerate(content) if 'Total Capital Cost,' in s][0]].split(',')[1].strip('\n'))
totalcapcostprovided = 1
if totalcapcost < 0 or totalcapcost > 1000:
totalcapcostvalid = 0
print("Warning: Provided total capital cost outside of range 0 to 1000. GEOPHIRES will calculate total capital cost using user-provided costs or built-in correlations for each category.")
else:
totalcapcostvalid = 1
except:
totalcapcostprovided = 0
totalcapcostvalid = 0
#ccwellfixed: well drilling and completion capital cost in M$ (per well)
try:
ccwellfixed = float(content[[i for i, s in enumerate(content) if 'Well Drilling and Completion Capital Cost,' in s][0]].split(',')[1].strip('\n'))
ccwellfixedprovided = 1
if ccwellfixed < 0 or ccwellfixed > 200:
ccwellfixedvalid = 0
else:
ccwellfixedvalid = 1
except:
ccwellfixedprovided = 0
ccwellfixedvalid = 0
#ccwelladjfactor: adj factor for built-in correlation well drilling and completion cost
try:
ccwelladjfactor = float(content[[i for i, s in enumerate(content) if 'Well Drilling and Completion Capital Cost Adjustment Factor,' in s][0]].split(',')[1].strip('\n'))
ccwelladjfactorprovided = 1
if ccwelladjfactor < 0 or ccwelladjfactor > 10:
ccwelladjfactorvalid = 0
else:
ccwelladjfactorvalid = 1
except:
ccwelladjfactorprovided = 0
ccwelladjfactorvalid = 0
if ccwellfixedvalid == 1 and ccwelladjfactorvalid == 1:
print("Warning: Provided well drilling and completion cost adjustment factor not considered because valid total well drilling and completion cost provided.")
elif ccwellfixedprovided == 0 and ccwelladjfactorprovided == 0:
ccwelladjfactor = 1
print("Warning: No valid well drilling and completion total cost or adjustment factor provided. GEOPHIRES will assume default built-in well drilling and completion cost correlation with adjustment factor = 1.")
elif ccwellfixedprovided == 1 and ccwellfixedvalid == 0 :
print("Provided well drilling and completion cost outside of range 0-1000. GEOPHIRES will assume default built-in well drilling and completion cost correlation with adjustment factor = 1.")
ccwelladjfactor = 1
elif ccwellfixedprovided == 0 and ccwelladjfactorprovided == 1 and ccwelladjfactorvalid == 0:
print("Provided well drilling and completion cost adjustment factor outside of range 0-10. GEOPHIRES will assume default built-in well drilling and completion cost correlation with adjustment factor = 1.")
ccwelladjfactor = 1
#Drilling cost correlation (should be 1, 2, 3, or 4) if no valid fixed well drilling cost is provided
if ccwellfixedvalid == 0:
try:
wellcorrelation = int(content[[i for i, s in enumerate(content) if 'Well Drilling Cost Correlation,' in s][0]].split(',')[1].strip('\n'))
if not (wellcorrelation in [1,2,3,4]):
wellcorrelation = 1
print("Warning: Selected well drilling cost correlation number should be 1, 2, 3 or 4. GEOPHIRES will assume default well drilling cost correlation (1)")
except:
wellcorrelation = 1
print("Warning: No valid well drilling cost correlation number provided. GEOPHIRES will assume default well drilling cost correlation (1)")
#ccstimfixed: reservoir stimulation cost in M$
try:
ccstimfixed = float(content[[i for i, s in enumerate(content) if 'Reservoir Stimulation Capital Cost,' in s][0]].split(',')[1].strip('\n'))
ccstimfixedprovided = 1
if ccstimfixed < 0 or ccstimfixed > 100:
ccstimfixedvalid = 0
else:
ccstimfixedvalid = 1
except:
ccstimfixedprovided = 0