source("../R/HAGBR.R") # high level function that should call with any VLP corr run.vlp <- function(depth.wh = 0, # depth at wellhead depth.bh = 5000, # depth at bottomhole diam.in = 1.995, GLR = 75, liq.rt = 758, wcut = 0.10, thp = 200, # tubing head pressure tht = 80, # tubing head temperature bht = 180, # bottomhole temperature gas.sg = 0.7, API = 40, wat.sg = 1.05, oil.visc = 5, ed = 0.0006, if.tens = 30, segments = 30 # number of depth segments ) { diam.ft <- diam.in / 12 temp.grad <- (bht - tht) / depth.bh # temperature gradient depths <- seq.int(from = depth.wh, to = depth.bh, length.out = 30) nRow <- length(depths) p <- thp t0 <- tht # initial temperature v = vector("list", nRow) for (i in seq_len(nRow)) { depth <- depths[i] # current depth dL <- depths[i+1] - depths[i] # dL = next depth - current depth t <- t0 + temp.grad * depth # temperature at depth calculation #cat(t, dL, depth, "\n") v[[i]] <- list(depth = depth, dL = dL, t = t, pres.iter = p) dp.dz = 0.5 # remember to replace for the real one p <- p + dp.dz * dL } tbl <- data.table::rbindlist(v) # add row to table hbg <- hagbr.guo(diam = diam.ft, wcut = wcut, liq.rt = liq.rt, GLR = GLR, p = thp, t = tht, API = API, gas.sg = gas.sg, wat.sg = wat.sg, oil.visc = oil.visc, if.tens = if.tens, ed = ed) # out <- list(depths = depths, # nRow = nRow, # temp.grad = temp.grad) # # return(out) #return(hbg) return(tbl) } # use this generic function to run any VLP correlation run.vlp(depth.wh = 0, depth.bh = 9700, segments = 30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.