Skip to content

Commit 79e5f20

Browse files
committed
transient heterogenous solutions now use upscaled well conductivity by default for numerical stability; added switch to fix it
1 parent 91be961 commit 79e5f20

1 file changed

Lines changed: 67 additions & 21 deletions

File tree

src/anaflow/flow/heterogeneous.py

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def ext_thiem_2d(
104104
Reference head at the reference-radius `r_ref`. Default: ``0.0``
105105
T_well : :class:`float`, optional
106106
Explicit transmissivity value at the well. Default: ``None``
107-
prop: :class:`float`, optional
107+
prop : :class:`float`, optional
108108
Proportionality factor used within the upscaling procedure.
109109
Default: ``1.6``
110110
@@ -216,7 +216,7 @@ def ext_thiem_3d(
216216
Explicit conductivity value at the well. One can choose between the
217217
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
218218
arbitrary float value. Default: ``"KH"``
219-
prop: :class:`float`, optional
219+
prop : :class:`float`, optional
220220
Proportionality factor used within the upscaling procedure.
221221
Default: ``1.6``
222222
@@ -320,6 +320,7 @@ def ext_theis_2d(
320320
struc_grid=True,
321321
far_err=0.01,
322322
parts=30,
323+
fix_T_well=False,
323324
lap_kwargs=None,
324325
):
325326
"""
@@ -356,7 +357,7 @@ def ext_theis_2d(
356357
Default: ``0.0``
357358
T_well : :class:`float`, optional
358359
Explicit transmissivity value at the well. Harmonic mean by default.
359-
prop: :class:`float`, optional
360+
prop : :class:`float`, optional
360361
Proportionality factor used within the upscaling procedure.
361362
Default: ``1.6``
362363
far_err : :class:`float`, optional
@@ -371,6 +372,8 @@ def ext_theis_2d(
371372
Since the solution is calculated by setting the transmissivity to local
372373
constant values, one needs to specify the number of partitions of the
373374
transmissivity. Default: ``30``
375+
fix_T_well : :class:`bool`, optional
376+
Whether to fix the T_well value in the laplace solver. Default: False
374377
lap_kwargs : :class:`dict` or :any:`None` optional
375378
Dictionary for :any:`get_lap_inv` containing `method` and
376379
`method_dict`. The default is equivalent to
@@ -434,7 +437,10 @@ def ext_theis_2d(
434437
T_well=T_well,
435438
prop=prop,
436439
)
437-
T_well = T_CG(r_well, trans_gmean, var, len_scale, T_well, prop)
440+
if fix_T_well:
441+
T_well = T_CG(r_well, trans_gmean, var, len_scale, T_well, prop)
442+
else:
443+
T_well = None
438444
return ext_grf(
439445
time=time,
440446
rad=rad,
@@ -469,6 +475,7 @@ def ext_theis_3d(
469475
far_err=0.01,
470476
struc_grid=True,
471477
parts=30,
478+
fix_K_well=False,
472479
lap_kwargs=None,
473480
):
474481
"""
@@ -513,7 +520,7 @@ def ext_theis_3d(
513520
Explicit conductivity value at the well. One can choose between the
514521
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
515522
arbitrary float value. Default: ``"KH"``
516-
prop: :class:`float`, optional
523+
prop : :class:`float`, optional
517524
Proportionality factor used within the upscaling procedure.
518525
Default: ``1.6``
519526
far_err : :class:`float`, optional
@@ -528,6 +535,8 @@ def ext_theis_3d(
528535
Since the solution is calculated by setting the transmissivity to local
529536
constant values, one needs to specify the number of partitions of the
530537
transmissivity. Default: ``30``
538+
fix_K_well : :class:`bool`, optional
539+
Whether to fix the K_well value in the laplace solver. Default: False
531540
lap_kwargs : :class:`dict` or :any:`None` optional
532541
Dictionary for :any:`get_lap_inv` containing `method` and
533542
`method_dict`. The default is equivalent to
@@ -595,7 +604,10 @@ def ext_theis_3d(
595604
K_well=K_well,
596605
prop=prop,
597606
)
598-
K_well = K_CG(r_well, cond_gmean, var, len_scale, anis, K_well, prop)
607+
if fix_K_well:
608+
K_well = K_CG(r_well, cond_gmean, var, len_scale, anis, K_well, prop)
609+
else:
610+
K_well = None
599611
return ext_grf(
600612
time=time,
601613
rad=rad,
@@ -637,6 +649,7 @@ def ext_theis_tpl(
637649
far_err=0.01,
638650
struc_grid=True,
639651
parts=30,
652+
fix_K_well=False,
640653
lap_kwargs=None,
641654
):
642655
"""
@@ -697,7 +710,7 @@ def ext_theis_tpl(
697710
Explicit conductivity value at the well. One can choose between the
698711
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
699712
arbitrary float value. Default: ``"KH"``
700-
prop: :class:`float`, optional
713+
prop : :class:`float`, optional
701714
Proportionality factor used within the upscaling procedure.
702715
Default: ``1.6``
703716
far_err : :class:`float`, optional
@@ -712,6 +725,8 @@ def ext_theis_tpl(
712725
Since the solution is calculated by setting the transmissivity to local
713726
constant values, one needs to specify the number of partitions of the
714727
transmissivity. Default: ``30``
728+
fix_K_well : :class:`bool`, optional
729+
Whether to fix the K_well value in the laplace solver. Default: False
715730
lap_kwargs : :class:`dict` or :any:`None` optional
716731
Dictionary for :any:`get_lap_inv` containing `method` and
717732
`method_dict`. The default is equivalent to
@@ -781,7 +796,12 @@ def ext_theis_tpl(
781796
K_well=K_well,
782797
prop=prop,
783798
)
784-
K_well = TPL_CG(r_well, cond_gmean, len_scale, hurst, var, c, 1, dim, K_well, prop)
799+
if fix_K_well:
800+
K_well = TPL_CG(
801+
r_well, cond_gmean, len_scale, hurst, var, c, 1, dim, K_well, prop
802+
)
803+
else:
804+
K_well = None
785805
return ext_grf(
786806
time=time,
787807
rad=rad,
@@ -818,6 +838,7 @@ def ext_theis_tpl_3d(
818838
far_err=0.01,
819839
struc_grid=True,
820840
parts=30,
841+
fix_K_well=False,
821842
lap_kwargs=None,
822843
):
823844
"""
@@ -872,7 +893,7 @@ def ext_theis_tpl_3d(
872893
Explicit conductivity value at the well. One can choose between the
873894
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
874895
arbitrary float value. Default: ``"KH"``
875-
prop: :class:`float`, optional
896+
prop : :class:`float`, optional
876897
Proportionality factor used within the upscaling procedure.
877898
Default: ``1.6``
878899
far_err : :class:`float`, optional
@@ -887,6 +908,8 @@ def ext_theis_tpl_3d(
887908
Since the solution is calculated by setting the transmissivity to local
888909
constant values, one needs to specify the number of partitions of the
889910
transmissivity. Default: ``30``
911+
fix_K_well : :class:`bool`, optional
912+
Whether to fix the K_well value in the laplace solver. Default: False
890913
lap_kwargs : :class:`dict` or :any:`None` optional
891914
Dictionary for :any:`get_lap_inv` containing `method` and
892915
`method_dict`. The default is equivalent to
@@ -956,7 +979,12 @@ def ext_theis_tpl_3d(
956979
K_well=K_well,
957980
prop=prop,
958981
)
959-
K_well = TPL_CG(r_well, cond_gmean, len_scale, hurst, var, c, anis, 3, K_well, prop)
982+
if fix_K_well:
983+
K_well = TPL_CG(
984+
r_well, cond_gmean, len_scale, hurst, var, c, anis, 3, K_well, prop
985+
)
986+
else:
987+
K_well = None
960988
return ext_grf(
961989
time=time,
962990
rad=rad,
@@ -1039,7 +1067,7 @@ def ext_thiem_tpl(
10391067
Explicit conductivity value at the well. One can choose between the
10401068
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
10411069
arbitrary float value. Default: ``"KH"``
1042-
prop: :class:`float`, optional
1070+
prop : :class:`float`, optional
10431071
Proportionality factor used within the upscaling procedure.
10441072
Default: ``1.6``
10451073
@@ -1162,7 +1190,7 @@ def ext_thiem_tpl_3d(
11621190
Explicit conductivity value at the well. One can choose between the
11631191
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
11641192
arbitrary float value. Default: ``"KH"``
1165-
prop: :class:`float`, optional
1193+
prop : :class:`float`, optional
11661194
Proportionality factor used within the upscaling procedure.
11671195
Default: ``1.6``
11681196
far_err : :class:`float`, optional
@@ -1259,6 +1287,7 @@ def ext_theis_int(
12591287
far_err=0.01,
12601288
struc_grid=True,
12611289
parts=30,
1290+
fix_K_well=False,
12621291
lap_kwargs=None,
12631292
):
12641293
"""
@@ -1318,7 +1347,7 @@ def ext_theis_int(
13181347
Explicit conductivity value at the well. One can choose between the
13191348
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
13201349
arbitrary float value. Default: ``"KH"``
1321-
prop: :class:`float`, optional
1350+
prop : :class:`float`, optional
13221351
Proportionality factor used within the upscaling procedure.
13231352
Default: ``1.6``
13241353
far_err : :class:`float`, optional
@@ -1333,6 +1362,8 @@ def ext_theis_int(
13331362
Since the solution is calculated by setting the transmissivity to local
13341363
constant values, one needs to specify the number of partitions of the
13351364
transmissivity. Default: ``30``
1365+
fix_K_well : :class:`bool`, optional
1366+
Whether to fix the K_well value in the laplace solver. Default: False
13361367
lap_kwargs : :class:`dict` or :any:`None` optional
13371368
Dictionary for :any:`get_lap_inv` containing `method` and
13381369
`method_dict`. The default is equivalent to
@@ -1399,7 +1430,12 @@ def ext_theis_int(
13991430
K_well=K_well,
14001431
prop=prop,
14011432
)
1402-
K_well = Int_CG(r_well, cond_gmean, var, len_scale, roughness, 1, dim, K_well, prop)
1433+
if fix_K_well:
1434+
K_well = Int_CG(
1435+
r_well, cond_gmean, var, len_scale, roughness, 1, dim, K_well, prop
1436+
)
1437+
else:
1438+
K_well = None
14031439
return ext_grf(
14041440
time=time,
14051441
rad=rad,
@@ -1435,6 +1471,7 @@ def ext_theis_int_3d(
14351471
far_err=0.01,
14361472
struc_grid=True,
14371473
parts=30,
1474+
fix_K_well=False,
14381475
lap_kwargs=None,
14391476
):
14401477
"""
@@ -1488,7 +1525,7 @@ def ext_theis_int_3d(
14881525
Explicit conductivity value at the well. One can choose between the
14891526
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
14901527
arbitrary float value. Default: ``"KH"``
1491-
prop: :class:`float`, optional
1528+
prop : :class:`float`, optional
14921529
Proportionality factor used within the upscaling procedure.
14931530
Default: ``1.6``
14941531
far_err : :class:`float`, optional
@@ -1503,6 +1540,8 @@ def ext_theis_int_3d(
15031540
Since the solution is calculated by setting the transmissivity to local
15041541
constant values, one needs to specify the number of partitions of the
15051542
transmissivity. Default: ``30``
1543+
fix_K_well : :class:`bool`, optional
1544+
Whether to fix the K_well value in the laplace solver. Default: False
15061545
lap_kwargs : :class:`dict` or :any:`None` optional
15071546
Dictionary for :any:`get_lap_inv` containing `method` and
15081547
`method_dict`. The default is equivalent to
@@ -1569,9 +1608,12 @@ def ext_theis_int_3d(
15691608
K_well=K_well,
15701609
prop=prop,
15711610
)
1572-
K_well = Int_CG(
1573-
r_well, cond_gmean, var, len_scale, roughness, anis, 3, K_well, prop
1574-
)
1611+
if fix_K_well:
1612+
K_well = Int_CG(
1613+
r_well, cond_gmean, var, len_scale, roughness, anis, 3, K_well, prop
1614+
)
1615+
else:
1616+
K_well = None
15751617
return ext_grf(
15761618
time=time,
15771619
rad=rad,
@@ -1652,7 +1694,7 @@ def ext_thiem_int(
16521694
Explicit conductivity value at the well. One can choose between the
16531695
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
16541696
arbitrary float value. Default: ``"KH"``
1655-
prop: :class:`float`, optional
1697+
prop : :class:`float`, optional
16561698
Proportionality factor used within the upscaling procedure.
16571699
Default: ``1.6``
16581700
@@ -1770,7 +1812,7 @@ def ext_thiem_int_3d(
17701812
Explicit conductivity value at the well. One can choose between the
17711813
harmonic mean (``"KH"``), the arithmetic mean (``"KA"``) or an
17721814
arbitrary float value. Default: ``"KH"``
1773-
prop: :class:`float`, optional
1815+
prop : :class:`float`, optional
17741816
Proportionality factor used within the upscaling procedure.
17751817
Default: ``1.6``
17761818
far_err : :class:`float`, optional
@@ -1858,6 +1900,7 @@ def neuman2004(
18581900
h_bound=0.0,
18591901
struc_grid=True,
18601902
parts=30,
1903+
fix_T_well=False,
18611904
lap_kwargs=None,
18621905
):
18631906
"""
@@ -1947,7 +1990,10 @@ def neuman2004(
19471990
var=var,
19481991
len_scale=len_scale,
19491992
)
1950-
T_well = neuman2004_trans(r_well, trans_gmean, var, len_scale)
1993+
if fix_T_well:
1994+
T_well = neuman2004_trans(r_well, trans_gmean, var, len_scale)
1995+
else:
1996+
T_well = None
19511997
return ext_grf(
19521998
time=time,
19531999
rad=rad,

0 commit comments

Comments
 (0)