Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas phase mixture enthalpy values decreasing with increased pressure #126

Closed
OdhranOOC opened this issue Sep 1, 2022 · 3 comments
Closed

Comments

@OdhranOOC
Copy link

OdhranOOC commented Sep 1, 2022

Hi @CalebBell,

I was recently working with an air mixture in a thermodynamic system (calculating enthalpies, specific works, etc). I noticed that the gas phase enthalpy for an air mixture actually decreases with increased pressure. For example:

from chemicals import normalize
from thermo import ChemicalConstantsPackage, CEOSGas, CEOSLiquid, PRMIXTranslatedConsistent, FlashVL
from thermo.interaction_parameters import IPDB
import numpy as np
import matplotlib.pyplot as plt

constants, properties = ChemicalConstantsPackage.from_IDs(['nitrogen', 'oxygen', 'argon'])
kijs = IPDB.get_ip_asymmetric_matrix('ChemSep PR', constants.CASs, 'kij')
eos_kwargs = {'Pcs': constants.Pcs, 'Tcs': constants.Tcs, 'omegas': constants.omegas, 'kijs': kijs}
gas = CEOSGas(PRMIXTranslatedConsistent, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
liquid = CEOSLiquid(PRMIXTranslatedConsistent, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)
zs = normalize([78.08, 20.95, .93])

x = np.linspace(500000,20000000, 100)
gas_H = np.zeros_like(x)

k=0
for i in x:
    # print("i = ", i)
    gas_H[k] = flasher.flash(T=500, P=i, zs=zs, retry=True).H()
    k=k+1

plt.figure()
plt.plot(x,gas_H, label = "gas_H")
plt.xlabel("Pressure")
plt.ylabel("Enthalpy")
plt.legend()
plt.show()

Screenshot 2022-09-01 at 09 54 25

Is there possibly an alternative approach that would not show this behaviour? Unless I'm mistaken and this behaviour is actually correct?

Thanks and Regards,
Odhran

@CalebBell
Copy link
Owner

Hi Odhran!

Yes, this is expected behavior. By the way, there is now a high-accuracy gas-only pseudo-pure model specifically for air in Thermo.

from thermo import *
import numpy as np
from thermo.phases import DryAirLemmon
import matplotlib.pyplot as plt
from thermo.chemical_package import lemmon2000_constants, lemmon2000_correlations
T, P = 298.15, 101325.0
gas = DryAirLemmon(T=T, P=P)
flasher = FlashPureVLS(constants=lemmon2000_constants, correlations=lemmon2000_correlations,
                   gas=gas, liquids=[], solids=[])
Ps = np.linspace(500000,20000000, 100)
gas_H = np.zeros_like(Ps)

k=0
for P in Ps:
    gas_H[k] = flasher.flash(T=500, P=float(P)).H()
    k=k+1

plt.figure()
plt.plot(Ps,gas_H, label = "gas_H")
plt.xlabel("Pressure")
plt.ylabel("Enthalpy")
plt.legend()
plt.show()

image

It also shows the same behavior. Note that when compressing air in real life, the temperature increases as the process is isentropic, which results in the significant compression duty.

@OdhranOOC
Copy link
Author

Much appreciated Caleb! Ah interesting I did read that Lemmon paper a few years back actually. So can I swap out the current gas phase EOS then for the improved Lemmon one, and leave the liquid phase as it is? How would that look?

My current code for reference:

constants, properties = ChemicalConstantsPackage.from_IDs(['nitrogen', 'oxygen', 'argon'])
kijs = IPDB.get_ip_asymmetric_matrix('ChemSep PR', constants.CASs, 'kij')
eos_kwargs = {'Pcs': constants.Pcs, 'Tcs': constants.Tcs, 'omegas': constants.omegas, 'kijs': kijs}
gas = CEOSGas(PRMIXTranslatedConsistent, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
liquid = CEOSLiquid(PRMIXTranslatedConsistent, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)
zs = normalize([78.08, 20.95, .93])

Also, do you know if the Lemmon model is faster than the alternative I have above, or is it actually slower due to the increased accuracy?

Much appreciated

@CalebBell
Copy link
Owner

Hi Odhran,
Unfortunately the Lemmon model is pseudo-pure, i.e. incapable of participating in vapor-liquid equilibrium. In thermo, you can only use it for obtaining vapor properties. Adding a liquid phase would not work with it. Additionally, it is slower due to its complexity.
Sincerely,
Caleb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants