@@ -968,11 +968,23 @@ def handle_yaxis_mapping_extensive(dig, dil):
968
968
simycent = [0.0 ] * dig ["gxyz" ][1 ]
969
969
with open (f"{ dig ['path' ]} /deck/ycenters.txt" , "r" , encoding = "utf8" ) as file :
970
970
for j , row in enumerate (csv .reader (file )):
971
- simycent [j ] = float (row [0 ])
971
+ simycent [j ] = float (f"{ float (row [0 ]):.1f} " )
972
+ simyvert = [0 ]
973
+ for ycent in simycent :
974
+ simyvert .append (simyvert [- 1 ] + 2 * (ycent - simyvert [- 1 ]))
972
975
indy = np .array (
973
976
[pd .Series (np .abs (dil ["refycent" ] - y_c )).argmin () for y_c in simycent ]
974
977
)
975
- weights = [1.0 / (np .sum (indy == val )) for val in indy ]
978
+ weights = []
979
+ ind = 0
980
+ for i , (y_i , y_f ) in enumerate (zip (simyvert [:- 1 ], simyvert [1 :])):
981
+ if dil ["refyvert" ][ind ] <= y_i and y_f <= dil ["refyvert" ][ind + 1 ]:
982
+ weights .append ([1.0 ])
983
+ else :
984
+ weights .append ([])
985
+ weights [- 1 ].append ((dil ["refyvert" ][ind + 1 ] - y_i ) / (y_f - y_i ))
986
+ weights [- 1 ].append ((y_f - dil ["refyvert" ][ind + 1 ]) / (y_f - y_i ))
987
+ ind += 1
976
988
wei_inds = [[] for _ in range (dig ["nocellst" ])]
977
989
for indz in range (dig ["gxyz" ][2 ]):
978
990
i_i = dig ["gxyz" ][0 ] * (dig ["gxyz" ][2 ] - indz - 1 )
@@ -984,7 +996,7 @@ def handle_yaxis_mapping_extensive(dig, dil):
984
996
+ int (np .floor (col [0 ] / dig ["nxyz" ][0 ]))
985
997
* dig ["nxyz" ][0 ]
986
998
* (dig ["nxyz" ][1 ] - 1 ),
987
- col [1 ] * weights [0 ],
999
+ col [1 ] * weights [0 ][ 0 ] ,
988
1000
]
989
1001
for col in row
990
1002
]
@@ -996,11 +1008,34 @@ def handle_yaxis_mapping_extensive(dig, dil):
996
1008
iii + dig ["gxyz" ][0 ] * (j + 1 ) : iii + dig ["gxyz" ][0 ] * (j + 2 )
997
1009
] = [
998
1010
[
999
- [col [0 ] + (iy * dig ["nxyz" ][0 ]), col [1 ] * weights [j + 1 ]]
1011
+ [col [0 ] + (iy * dig ["nxyz" ][0 ]), col [1 ] * weights [j + 1 ][ 0 ] ]
1000
1012
for col in row
1001
1013
]
1002
1014
for row in maps
1003
1015
]
1016
+ for weight in weights [j + 1 ][1 :]:
1017
+ for i , val in enumerate (
1018
+ wei_inds [
1019
+ iii + dig ["gxyz" ][0 ] * (j + 1 ) : iii + dig ["gxyz" ][0 ] * (j + 2 )
1020
+ ]
1021
+ ):
1022
+ if wei_inds [
1023
+ iii + dig ["gxyz" ][0 ] * (j + 1 ) : iii + dig ["gxyz" ][0 ] * (j + 2 )
1024
+ ][i ]:
1025
+ wei_inds [
1026
+ iii
1027
+ + dig ["gxyz" ][0 ] * (j + 1 ) : iii
1028
+ + dig ["gxyz" ][0 ] * (j + 2 )
1029
+ ][i ].append (
1030
+ [
1031
+ (
1032
+ val [0 ][0 ] + dig ["nxyz" ][0 ]
1033
+ if val [0 ][0 ] + dig ["nxyz" ][0 ] < dig ["nocellsr" ]
1034
+ else val [0 ][0 ]
1035
+ ),
1036
+ weight ,
1037
+ ]
1038
+ )
1004
1039
dil ["cell_ind" ] = wei_inds
1005
1040
1006
1041
@@ -1377,13 +1412,13 @@ def generate_arrays(dig, dil, names, t_n):
1377
1412
co2_d = rss * rhow * (1.0 - sgas ) * dig ["porva" ] * GAS_DEN_REF / WAT_DEN_REF
1378
1413
h2o_l = (1 - sgas ) * rhow * dig ["porva" ]
1379
1414
dil ["pressure_array" ][dig ["actind" ]] = 1e5 * pres
1380
- dil ["sgas_array" ][dig ["actind" ]] = sgas
1381
- dil ["gden_array" ][dig ["actind" ]] = rhog * (sgas > 0.0 )
1415
+ dil ["sgas_array" ][dig ["actind" ]] = sgas * ( sgas > 0.02 )
1416
+ dil ["gden_array" ][dig ["actind" ]] = rhog * (sgas > 0.02 )
1382
1417
dil ["wden_array" ][dig ["actind" ]] = rhow
1383
1418
dil ["tco2_array" ][dig ["actind" ]] = co2_d + co2_g
1384
1419
compute_xco2 (dig , dil , co2_d , h2o_l )
1385
1420
h2o_v = rvv * rhog * sgas * dig ["porva" ] * WAT_DEN_REF / GAS_DEN_REF
1386
- compute_xh20 (dig , dil , h2o_v , co2_g )
1421
+ compute_xh20 (dig , dil , h2o_v , co2_g , sgas )
1387
1422
1388
1423
1389
1424
def compute_xco2 (dig , dil , co2_d , h2o_l ):
@@ -1407,15 +1442,16 @@ def compute_xco2(dig, dil, co2_d, h2o_l):
1407
1442
dil ["xco2_array" ][dig ["actind" ]] = xco2
1408
1443
1409
1444
1410
- def compute_xh20 (dig , dil , h2o_v , co2_g ):
1445
+ def compute_xh20 (dig , dil , h2o_v , co2_g , sgas ):
1411
1446
"""
1412
1447
Compute the mass fraction of water in vapour
1413
1448
1414
1449
Args:
1415
1450
dig (dict): Global dictionary\n
1416
1451
dil (dict): Local dictionary\n
1417
1452
h2o_v (array): Floats with the mass of vaporized water\n
1418
- co2_g (array): Floats with the mass of gaseous co2
1453
+ co2_g (array): Floats with the mass of gaseous co2\n
1454
+ sgas (array): Floats with the gas saturation
1419
1455
1420
1456
Returns:
1421
1457
dil (dict): Modified local dictionary
@@ -1425,7 +1461,7 @@ def compute_xh20(dig, dil, h2o_v, co2_g):
1425
1461
xh20 = 0.0 * h2o_v
1426
1462
inds = mgas > 0.0
1427
1463
xh20 [inds ] = np .divide (h2o_v [inds ], mgas [inds ])
1428
- dil ["xh20_array" ][dig ["actind" ]] = xh20
1464
+ dil ["xh20_array" ][dig ["actind" ]] = xh20 * ( sgas > 0.02 )
1429
1465
1430
1466
1431
1467
def map_to_report_grid (dig , dil , names ):
0 commit comments