NOTE. There is a problem with the GLR. Program crashes at GLR =< 362.6. Why?
Error in if (eps >= tol) p1 = p.calc : missing value where TRUE/FALSE needed
library(rNodal)
library(tibble)
# Example Problem from Guo book
input.example.P44 <- setWellInput(field.name = "HAGBR.MOD",
well.name = "Guo_P44",
depth.wh = 0, depth.bh = 9700, diam.in = 1.995,
GLR = 362.7, liq.rt = 758, wcut = 0.1,
thp = 100, tht = 80, bht = 180,
API = 40, gas.sg = 0.70, wat.sg = 1.05, if.tens = 30)
well.model <- setVLPmodel(vlp.model = "hagbr.mod", segments = 29, tol = 0.000001)
as.tibble(runVLP(well.input = input.example.P44, well.model))
# A tibble: 30 x 45
i depth dL temp pres p_avg t_avg segment
<int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 0.0000 0.0000 80.00000 100.0000 100.0000 80.00000 0
2 2 334.4828 334.4828 83.44828 137.5319 118.7659 81.72414 1
3 3 668.9655 334.4828 86.89655 176.4601 156.9960 85.17241 2
4 4 1003.4483 334.4828 90.34483 216.9125 196.6863 88.62069 3
5 5 1337.9310 334.4828 93.79310 258.9087 237.9106 92.06897 4
6 6 1672.4138 334.4828 97.24138 302.4498 280.6793 95.51724 5
7 7 2006.8966 334.4828 100.68966 347.5405 324.9951 98.96552 6
8 8 2341.3793 334.4828 104.13793 394.1921 370.8663 102.41379 7
9 9 2675.8621 334.4828 107.58621 442.4224 418.3073 105.86207 8
10 10 3010.3448 334.4828 111.03448 492.2542 467.3383 109.31034 9
# ... with 20 more rows, and 37 more variables: GOR <dbl>, Rs <dbl>,
# gas.fvf <dbl>, gas.free <dbl>, liq.dens <dbl>, z <dbl>,
# gas.dens <dbl>, oil.visc <dbl>, wat.visc <dbl>, mixL.visc <dbl>,
# oil.fvf <dbl>, wat.fvf <dbl>, liq.svel <dbl>, gas.svel <dbl>,
# NL <dbl>, CNL <dbl>, NLV <dbl>, NGV <dbl>, A <dbl>, B <dbl>, BA <dbl>,
# ND <dbl>, X2 <dbl>, HL.psi <dbl>, X2.mod <dbl>, psi <dbl>, HL <dbl>,
# Re.TP <dbl>, ff <dbl>, mix.dens <dbl>, mixL.volume <dbl>,
# mixL.dens <dbl>, mixTP.dens <dbl>, mixTP.svel <dbl>, elev.grad <dbl>,
# fric.grad <dbl>, dp.dz <dbl>
# Example Problem from Guo book
library(rNodal)
# get only the variable we need for heat transfer. But what we really want
# is the deviation survey: MD, TVD
well_table <- runVLP(well.input = input.example.P44,
well.model)[, c("depth", "dL", "pres", "temp")]
input.example.guo.44 <- setWellInput(field.name = "HAGBR.MOD",
well.name = "Guo_P44",
depth.wh = 0, depth.bh = 9700, diam.in = 1.995,
GLR = 362.7, liq.rt = 758, wcut = 0.1,
thp = 100, tht = 80, bht = 180,
API = 40, gas.sg = 0.70, wat.sg = 1.05, if.tens = 30,
U = 3) # decreasing the U
well_parameters <- get_well_parameters(input.example.guo.44)
# temp.gradient calculates the fluid temperature coming from the wellbore
rNodal:::temp.gradient(well_table, well_parameters)
depth dL pres temp L Ti
1: 0.0000 0.0000 100.0000 80.00000 9700.0000 92.72344
2: 334.4828 334.4828 137.5319 83.44828 9365.5172 98.96560
3: 668.9655 334.4828 176.4601 86.89655 9031.0345 105.07898
4: 1003.4483 334.4828 216.9125 90.34483 8696.5517 111.04553
5: 1337.9310 334.4828 258.9087 93.79310 8362.0690 116.84701
6: 1672.4138 334.4828 302.4498 97.24138 8027.5862 122.46519
7: 2006.8966 334.4828 347.5405 100.68966 7693.1034 127.88211
8: 2341.3793 334.4828 394.1921 104.13793 7358.6207 133.08034
9: 2675.8621 334.4828 442.4224 107.58621 7024.1379 138.04325
10: 3010.3448 334.4828 492.2542 111.03448 6689.6552 142.75531
11: 3344.8276 334.4828 543.7133 114.48276 6355.1724 147.20237
12: 3679.3103 334.4828 596.8286 117.93103 6020.6897 151.37192
13: 4013.7931 334.4828 651.6303 121.37931 5686.2069 155.25343
14: 4348.2759 334.4828 708.1528 124.82759 5351.7241 158.83855
15: 4682.7586 334.4828 766.4307 128.27586 5017.2414 162.12138
16: 5017.2414 334.4828 826.5026 131.72414 4682.7586 165.09870
17: 5351.7241 334.4828 888.4109 135.17241 4348.2759 167.77012
18: 5686.2069 334.4828 952.2033 138.62069 4013.7931 170.13826
19: 6020.6897 334.4828 1017.9351 142.06897 3679.3103 172.20882
20: 6355.1724 334.4828 1085.6713 145.51724 3344.8276 173.99068
21: 6689.6552 334.4828 1155.4910 148.96552 3010.3448 175.49587
22: 7024.1379 334.4828 1227.4925 152.41379 2675.8621 176.73955
23: 7358.6207 334.4828 1301.8016 155.86207 2341.3793 177.73989
24: 7693.1034 334.4828 1378.5847 159.31034 2006.8966 178.51795
25: 8027.5862 334.4828 1458.0701 162.75862 1672.4138 179.09747
26: 8362.0690 334.4828 1540.5869 166.20690 1337.9310 179.50461
27: 8696.5517 334.4828 1626.6437 169.65517 1003.4483 179.76766
28: 9031.0345 334.4828 1717.1011 173.10345 668.9655 179.91671
29: 9365.5172 334.4828 1813.6887 176.55172 334.4828 179.98330
30: 9700.0000 334.4828 1909.7627 180.00000 0.0000 180.00000
depth dL pres temp L Ti
MD TVD Pres Temp
0 0 100.0 92.7
248.7 248.7 129.5 95.2
497.4 497.4 160.3 97.8
746.2 746.2 192.3 100.4
994.9 994.9 225.6 102.9
1243.6 1243.6 260.0 105.5
1492.3 1492.3 295.6 108.1
1741.0 1741.0 332.2 110.6
1989.7 1989.7 370.0 113.2
2238.5 2238.5 408.7 115.7
2487.2 2487.2 448.5 118.3
2735.9 2735.9 489.4 120.8
2984.6 2984.6 532.8 123.4
3233.3 3233.3 578.7 125.9
3482.1 3482.1 627.1 128.5
3730.8 3730.8 678.2 131.0
3979.5 3979.5 731.8 133.6
4228.2 4228.2 788.0 136.1
4476.9 4476.9 846.7 138.7
4725.6 4725.6 907.8 141.2
4974.4 4974.4 971.3 143.7
5223.1 5223.1 1037.2 146.2
5471.8 5471.8 1105.3 148.7
5720.5 5720.5 1175.5 151.2
5969.2 5969.2 1247.7 153.6
6217.9 6217.9 1323.9 156.0
6466.7 6466.7 1401.5 158.4
6715.4 6715.4 1480.3 160.8
6964.1 6964.1 1560.3 163.1
7212.8 7212.8 1641.3 165.4
7461.5 7461.5 1723.0 167.5
7710.3 7710.3 1804.6 169.7
7959.0 7959.0 1886.3 171.7
8207.7 8207.7 1968.0 173.5
8456.4 8456.4 2049.8 175.2
8705.1 8705.1 2131.6 176.8
8953.8 8953.8 2213.3 178.1
9202.6 9202.6 2295.2 179.1
9451.3 9451.3 2377.0 179.8
9700.0 9700.0 2458.9 180.0