knitr::opts_chunk$set(echo=T, comment=NA, error=T, warning=F, message = F, fig.align = 'center')
Find z given the data below:
Temperature = 366.5 K = 200 F Pressure = 13.7895 MPa = 2000 psia Gas specific gravity = 0.7 yN2 = 0.05 yCO2 = 0.05 yH2S = 0.02
We convert to oilfield units (Farenheit and psia).
library(rNodal) # Example 1 in Fantoorechi paper print(z.hallyarborough(pres.a = 2000, temp.f = 200, gas.sg = 0.7, n2.frac = 0.05, co2.frac = 0.05, h2s.frac = 0.02))
If we compare the value obtained with the value in the paper, $z(NR) = 0.8362$.
Let's use the internal function z.hallyarboroughL
to check all the calculated values to obtain z
.
# use the internal function z.hallyarboroughL print(rNodal:::z.hallyarboroughL(pres.a = 2000, temp.f = 200, gas.sg = 0.7, n2.frac = 0.05, co2.frac = 0.05, h2s.frac = 0.02))
Using the equation for impurities in gas:
knitr::include_graphics("./images/eq_10_11-HY_FARA.jpg")
# applying equation 11 gas.sg <- 0.7 n2.frac = 0.05 co2.frac = 0.05 h2s.frac = 0.02 temp.pc <- 326 + 315.7 * (gas.sg - 0.5) - 240 * n2.frac - 83.3 * co2.frac + 133.3 * h2s.frac print(temp.pc) # 375.641 R = 208.6894 K
Which gives us 208.7 Kelvin,
# from Fatorechi paper: # Table 1, Example 1 solution pres.pc.M <- 4.7697 # Mpa # All temperatures in Kelvin temp.K <- 366.5 # sample temperature, Kelvin temp.pc.K <- 208.6 # pseudo-critical temperature, Kelvin temp.r <- temp.pc.K / temp.K # reduced temperature, adimensional print(temp.r)
This value is different of what is shown in the solution of example 1 in the paper.
knitr::include_graphics("./images/solution_1_HY_FARA.jpg")
# To double check the calculation, we run it in Farenheit (Rankine), not Kelvin. # All temperatures in Rankine now temp.F <- 200 temp.R <- temp.F + 460 temp.r <- temp.pc / temp.R print(temp.r)
Note. Definitely, something is not right:
0.569153
not equal to0.617678
.
Performing the reverse process: calculating the sampling temperature from the reduced temperature.
# calculating the sampling temperature from the reduced temperature. # from the solution in Example 1, Fatoorechi temp.pc.K <- 208.6 # Kelvin temp.r <- 0.617678 temp.K <- temp.pc.K / temp.r print(temp.K)
Note: 337.7164 Kelvin is not equal either to 366.5 K given in the example.
Given the second set of data, calculate Z.
Temperature = 355.4 K = 180 F Pressure = 34.4747 MPa = 5000 psi Gas specific gravity = 0.65 yN2 = 0.1 yCO2 = 0.08 yH2S = 0.02
We convert the Kelvin to Farenheit.
library(rNodal) # Example 2 in Fantoorechi paper print(z.hallyarborough(pres.a = 5000, temp.f = 180, gas.sg = 0.65, n2.frac = 0.1, co2.frac = 0.08, h2s.frac = 0.02))
From the paper, $z = 1.0002$.
Temperature = 310.9 K = 100 F Pressure = 6.8947 MPa = 1000 psi Gas specific gravity = ? Tpc = 237.2 K = -32.71 F = 427.29 R Ppc = 4.4815 MPa = 650 psia
In this example the sepecific gravity of the gas is not provided.
print(rNodal:::z.hallyarboroughL(pres.a = 1000, temp.f = 100, gas.sg = 0.82)$z) # z = 0.760227 # from paper, z = 0.7557
From the paper, $z = 0.7557$. The difference is very small.
rNodal
script to accept multiple parametersWe do this in order to enter not only sampling pressure and temperature but also be able to provide pseudo-critical and pseudo-reduced pressures and temperatures as well.
source("HY.R") # modified script saved as HY.R # supplying gas.sg with_gas.sg <- c(method = "use_gas.sg", z.hallyarboroughL(pres.a = 1000, temp.f = 100, gas.sg = 0.82)) # z = 0.760227 # pres.pc = 662 # temp.pc = 427.024 # no gas.sg provided with_pseudo_crit <- c(method = "use_pseudo_critical", z.hallyarboroughL(pres.a = 1000, temp.f = 100, pres.pc = 662, temp.pc = 427)) # no gas.sg provided with_pseudo_red <- c(method = "use_pseudo_reduced", z.hallyarboroughL(pres.a = 1000, temp.f = 100, pres.pr = 1.51, temp.pr = 1.31)) only_pseudo_red <- c(method = "only_pseudo_reduced", z.hallyarboroughL(pres.pr = 1.51, temp.pr = 1.31)) # put the results in a dataframe df <- data.frame(stringsAsFactors = FALSE) df <- rbind(df, with_gas.sg, with_pseudo_crit, with_pseudo_red, only_pseudo_red) df
\ \
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.