CalebBell / thermo

Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
MIT License
594 stars 114 forks source link

Issues using eos to get z factors #77

Closed jonnymaserati closed 3 years ago

jonnymaserati commented 3 years ago

What am I doing wrong here? I'm trying to find the z factor and density for a gas influx when drilling a well. The downhole reservoir pressure is 9735 psi and the temperature is 120 deg C.

from thermo.chemical import Chemical
from thermo.eos import RK

influx = Chemical('natural gas', T=393, P=6.7e7)

eos = RK(Tc=influx.Tc, Pc=influx.Pc, P=influx.P, T=influx.T)

This runs fine, but the result should be in the gas phase... this is about what I'm expecing:

image

But eos.phase returns 'l' and eos.rho_l returns a crazy high value.

Any suggestions?

CalebBell commented 3 years ago

Hi Jonny, Everything looks good to me. Vapor/liquid designations are arbitrary past the supercritical point; and you are well past that of methane. The phase id algorithm used by the EOS object is documented here: https://chemicals.readthedocs.io/chemicals.utils.html#chemicals.utils.phase_identification_parameter I suspect you thought the rho_l attribute was a mass density; it is actually a molar density, in mol/m^3. The EOS objects don't have MW as an input and don't do anything with mass. You can convert get the mass density with "Vm_to_rho(eos.V_l, influx.MW)", after importing Vm_to_rho from the chemicals library. Sincerely, Caleb

jonnymaserati commented 3 years ago

Thanks @CalebBell!

That makes sense and indeed I get a value that is close to that indicated in the top post.

image

And the eos.Z_l value is reasonable at about 1.33 although these are not the same as the top post... different models?

If I have a gas relative density (say SG=0.7) but don't know exactly what it's made up of (other than it being close to a "natural gas" with some oil condenstate), how could I model this? Would I have to create a Chemical?

CalebBell commented 3 years ago

Thermo is a library with a focus on real chemicals. I have no intention of adding pseudo component support. I don't have any advice for your new question.

jonnymaserati commented 3 years ago

Thanks @CalebBell, understood!