I Does PYroMat only consider ideal gases?

AI Thread Summary
Different methods for calculating the compressibility factor (Z) of CO2 under specific conditions yielded varying results: Z=0.64 by hand, Z=0.61 using the GasCompressibility library, and Z=1 from the PYroMat library. The discrepancies suggest that the PYroMat library may be assuming ideal gas behavior, which could explain the higher Z value. Users expressed concern over the reliability of PYroMat, especially since it can handle multi-phase mixtures but may not accurately account for non-ideal gas behavior. The GasCompressibility library produced results consistent with manual calculations, leading to a preference for its use. Overall, the discussion highlights the importance of understanding the assumptions behind different computational methods for gas properties.
Juanda
Gold Member
Messages
439
Reaction score
144
TL;DR Summary
I get different results of ##Z## depending on the method I use to find it.
On a different thread, we calculated ##Z## for ##\mathrm{CO_2}## for some pressure and temperature conditions.
(Let's assume this is absolute pressure. Not gage pressure.)
$$T=297 \ \mathrm{K}; \ P=5438467 \ \mathrm{Pa}; \ V = 0.05 \ \mathrm{m^3}$$
I did it 3 ways:
  1. "By hand" using tables from a book and eyeballing values from a table. ##Z=0.64##
  2. Using a Python Library named "GasCompressibility". ##Z=0.61##. Pretty close. I guess the differences are a result of my eyeballed values from a table.
  3. Using a Python Library named "PYroMat". This allowed us to directly find the specific volume of the gas for the given conditions without having to calculate ##Z## which is very convenient. However, it produced a different specific volume than the one obtained with the other methods so ##Z## must be different. After calculating it from other values. I got ##Z=1##.
Since the first two give very similar results, I assume they are correct and the third one is at fault. However, I can't find the error. In fact, the third one should be the simplest since it doesn't require intermediate calculations.
After checking their web more closely, I saw this note:
1725726475600.png


Is it possible that this library is assuming ideal gas behavior for all gases? That'd explain why I'm getting ##Z=1##. I think that's odd because the library can be used for multi-phase mixtures and saturated gas differs significantly from ideal gas behavior.
1725726610060.png



This is some simple code I used to compare the results from the two libraries.
[CODE lang="python" title="GetCompressibility-vs-PYroMat"]import pyromat as pm
import gascompressibility as gc


V = 0.05 # Tank's volume [m3]
Temperature_sensor_array = 297 #[K]
Pressure_sensor_array = 5438467 #[Pa]
P_cr_CO2 = 7.39*10**6 # Critical pressure (top of the bell) [Pa]
T_cr_CO2 = 304.2 # Critical temperature (top of the bell) [K]
R = 188.9 # Gas constant [J/kgK]

# Using PYroMat to find Z.
pm.config['unit_pressure']='Pa'
pm.config['unit_temperature']='K'
pm.config['unit_mass']='kg'
pm.config['unit_volume']='m3'
co2 = pm.get('ig.CO2')
Specific_volume_pyromat = co2.v(T=Temperature_sensor_array, p=Pressure_sensor_array) #[m3/kg]
Specific_volume_pyromat = Specific_volume_pyromat[0]
Z_PYroMat = Pressure_sensor_array*Specific_volume_pyromat/(R*Temperature_sensor_array)
print('Z calculated from "PYroMat is: Z =', round(Z_PYroMat, 5))




# Using GasCompressibilty to find Z.
P_R_CO2 = Pressure_sensor_array/P_cr_CO2
T_R_CO2 = Temperature_sensor_array/T_cr_CO2

#This library requires odd units and gage pressure.
Pressure_sensor_array_PSGI = (Pressure_sensor_array-(0.1*10**6))/6895
Temperature_sensor_array_F = (Temperature_sensor_array - 273.15) * 9 / 5 + 32

Z_0 = gc.calc_z(sg=1, P=Pressure_sensor_array_PSGI, T=Temperature_sensor_array_F, H2S=None, CO2=1, N2=None, Pr=P_R_CO2, Tr=T_R_CO2, pmodel='piper')
print('Z calculated from "GetCompressibility is: Z =', round(Z_0, 5))[/CODE]
 
Science news on Phys.org
Juanda said:
TL;DR Summary: I get different results of ##Z## depending on the method I use to find it.

On a different thread, we calculated ##Z## for ##\mathrm{CO_2}## for some pressure and temperature conditions.
(Let's assume this is absolute pressure. Not gage pressure.)
$$T=297 \ \mathrm{K}; \ P=5438467 \ \mathrm{Pa}; \ V = 0.05 \ \mathrm{m^3}$$
I did it 3 ways:
  1. "By hand" using tables from a book and eyeballing values from a table. ##Z=0.64##
  2. Using a Python Library named "GasCompressibility". ##Z=0.61##. Pretty close. I guess the differences are a result of my eyeballed values from a table.
  3. Using a Python Library named "PYroMat". This allowed us to directly find the specific volume of the gas for the given conditions without having to calculate ##Z## which is very convenient. However, it produced a different specific volume than the one obtained with the other methods so ##Z## must be different. After calculating it from other values. I got ##Z=1##.
Since the first two give very similar results, I assume they are correct and the third one is at fault. However, I can't find the error. In fact, the third one should be the simplest since it doesn't require intermediate calculations.
After checking their web more closely, I saw this note:
View attachment 350921

Is it possible that this library is assuming ideal gas behavior for all gases? That'd explain why I'm getting ##Z=1##. I think that's odd because the library can be used for multi-phase mixtures and saturated gas differs significantly from ideal gas behavior.
View attachment 350922


This is some simple code I used to compare the results from the two libraries.
[CODE lang="python" title="GetCompressibility-vs-PYroMat"]import pyromat as pm
import gascompressibility as gc


V = 0.05 # Tank's volume [m3]
Temperature_sensor_array = 297 #[K]
Pressure_sensor_array = 5438467 #[Pa]
P_cr_CO2 = 7.39*10**6 # Critical pressure (top of the bell) [Pa]
T_cr_CO2 = 304.2 # Critical temperature (top of the bell) [K]
R = 188.9 # Gas constant [J/kgK]

# Using PYroMat to find Z.
pm.config['unit_pressure']='Pa'
pm.config['unit_temperature']='K'
pm.config['unit_mass']='kg'
pm.config['unit_volume']='m3'
co2 = pm.get('ig.CO2')
Specific_volume_pyromat = co2.v(T=Temperature_sensor_array, p=Pressure_sensor_array) #[m3/kg]
Specific_volume_pyromat = Specific_volume_pyromat[0]
Z_PYroMat = Pressure_sensor_array*Specific_volume_pyromat/(R*Temperature_sensor_array)
print('Z calculated from "PYroMat is: Z =', round(Z_PYroMat, 5))




# Using GasCompressibilty to find Z.
P_R_CO2 = Pressure_sensor_array/P_cr_CO2
T_R_CO2 = Temperature_sensor_array/T_cr_CO2

#This library requires odd units and gage pressure.
Pressure_sensor_array_PSGI = (Pressure_sensor_array-(0.1*10**6))/6895
Temperature_sensor_array_F = (Temperature_sensor_array - 273.15) * 9 / 5 + 32

Z_0 = gc.calc_z(sg=1, P=Pressure_sensor_array_PSGI, T=Temperature_sensor_array_F, H2S=None, CO2=1, N2=None, Pr=P_R_CO2, Tr=T_R_CO2, pmodel='piper')
print('Z calculated from "GetCompressibility is: Z =', round(Z_0, 5))[/CODE]
Do either of the first two methods use the Pitzer and Brewer acentric factor to get a more accurate value of Z?

The title of your third method specifically indicates ideal gases.
 
  • Like
Likes Lord Jestocost
Chestermiller said:
Do either of the first two methods use the Pitzer and Brewer acentric factor to get a more accurate value of Z?
I searched the book for those keyworks and they don't show up. Although maybe its mentioned in the source Chemistry book.
1726037476368.png


I tried searching for them on the GasCompresssibility webpage and it doesn't show it either. Would this match what you're expecting regarding how things are calculated?
1726037765670.png

This link also details which model is used to calculate ##Z##.

Chestermiller said:
The title of your third method specifically indicates ideal gases.
Yes. I read it but I don't see how that matches the fact that the library is also used for saturated mixtures. The vapor in the mixture is most definitely not behaving as an ideal gas, right?
Juanda said:
After checking their web more closely, I saw this note:
View attachment 350921

Is it possible that this library is assuming ideal gas behavior for all gases? That'd explain why I'm getting ##Z=1##. I think that's odd because the library can be used for multi-phase mixtures and saturated gas differs significantly from ideal gas behavior.
View attachment 350922
 
Juanda said:
I searched the book for those keyworks and they don't show up. Although maybe its mentioned in the source Chemistry book.
View attachment 351035

I tried searching for them on the GasCompresssibility webpage and it doesn't show it either. Would this match what you're expecting regarding how things are calculated?
View attachment 351036
This link also details which model is used to calculate ##Z##.

These are multi-constant equations.
Juanda said:
Yes. I read it but I don't see how that matches the fact that the library is also used for saturated mixtures. The vapor in the mixture is most definitely not behaving as an ideal gas, right?
A saturated vapor is pure gas, and not a mixture; it is a single phase at its dew point. A mixture is comprised of several molecular species.

See Smith and van Ness, Introduction to Chemical Engineering Thermodynamics.
 
Chestermiller said:
A saturated vapor is pure gas, and not a mixture; it is a single phase at its dew point. A mixture is comprised of several molecular species.
Sorry. I said mixture but I meant to say multi-phase. I was trying to say that the PYroMat library is able to calculate saturated liquid+vapor mixtures which I find odd since it seems to be treating the vapor as an ideal gas.

Juanda said:
Is it possible that this library is assuming ideal gas behavior for all gases? That'd explain why I'm getting ##Z=1##. I think that's odd because the library can be used for multi-phase mixtures and saturated gas differs significantly from ideal gas behavior.
View attachment 350922

Aren't these kinds of tables (below) obtained experimentally? Maybe PYroMat is using experimental values for the multi-phase calculations and then it switches to ideal gas once it's all vapor?
1726058367792.png


I'm trying to decide if PYroMat is a library I should get more used to using or if I should discard it. The library GasCompressibility seems useful and reliable since it produced the same result as the "by hand" calculation using the book.
 
Juanda said:
Sorry. I said mixture but I meant to say multi-phase. I was trying to say that the PYroMat library is able to calculate saturated liquid+vapor mixtures which I find odd since it seems to be treating the vapor as an ideal gas.
Even if it treats the vapor as an ideal gas, it must use data on the density of the saturated liquid as a function of temperature, and, if you specify the mass fraction vapor, you can get the averaged specific volume of the combination of liquid and vapor.
Juanda said:
Aren't these kinds of tables (below) obtained experimentally? Maybe PYroMat is using experimental values for the multi-phase calculations and then it switches to ideal gas once it's all vapor?
View attachment 351038

Tables like this are generated from analytically fitting data, with the fits constrained by thermodynamic relationships. This table takes into account non-ideality. To generate this table, all you need to know the Cv or Cp of the gas as a function of temperature in the ideal gas limit, the PvT real gas behavior of the gas, the Cp of the liquid at low pressures (say 1 bar) and the PvT behavior of the liquid.
Juanda said:
I'm trying to decide if PYroMat is a library I should get more used to using or if I should discard it. The library GasCompressibility seems useful and reliable since it produced the same result as the "by hand" calculation using the book.
I'm not familiar with this tool, but if it assumes ideal gas behavior of the vapor, it is probably not going to satisfy your needs at all conditions.
 
I need to calculate the amount of water condensed from a DX cooling coil per hour given the size of the expansion coil (the total condensing surface area), the incoming air temperature, the amount of air flow from the fan, the BTU capacity of the compressor and the incoming air humidity. There are lots of condenser calculators around but they all need the air flow and incoming and outgoing humidity and then give a total volume of condensed water but I need more than that. The size of the...
Thread 'Why work is PdV and not (P+dP)dV in an isothermal process?'
Let's say we have a cylinder of volume V1 with a frictionless movable piston and some gas trapped inside with pressure P1 and temperature T1. On top of the piston lay some small pebbles that add weight and essentially create the pressure P1. Also the system is inside a reservoir of water that keeps its temperature constant at T1. The system is in equilibrium at V1, P1, T1. Now let's say i put another very small pebble on top of the piston (0,00001kg) and after some seconds the system...
I was watching a Khan Academy video on entropy called: Reconciling thermodynamic and state definitions of entropy. So in the video it says: Let's say I have a container. And in that container, I have gas particles and they're bouncing around like gas particles tend to do, creating some pressure on the container of a certain volume. And let's say I have n particles. Now, each of these particles could be in x different states. Now, if each of them can be in x different states, how many total...
Back
Top