CalebBell / thermo

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

Which EOS to use for supercritical H2? #118

Closed BenPortner closed 1 year ago

BenPortner commented 1 year ago

Hello @CalebBell,

I am (still) trying to determine the power required to compress hydrogen isothermally to 350 bar. I tried using the PR and SRK equations of state but both yield way too low entropy changes:

current behavior

from thermo.eos import PR
S0 = PR(T=298.15, P=20e5, Tc=33.2, Pc=1296960.0, omega=-0.22).S_dep_g
S = PR(T=298.15, P=350e5, Tc=33.2, Pc=1296960.0, omega=-0.22).S_dep_l
TdS = 298.15 * (S-S0) # -178, should be ~-7200

from thermo.eos import SRK
S0 = SRK(T=298.15, P=20e5, Tc=33.2, Pc=1296960.0, omega=-0.22).S_dep_l
S = SRK(T=298.15, P=350e5, Tc=33.2, Pc=1296960.0, omega=-0.22).S_dep_l
TdS = 298.15 * (S-S0) # -166, should be ~-7200

expected behavior

import CoolProp.CoolProp as cp
feed = cp.AbstractState("HEOS", 'hydrogen')
feed.update(cp.PT_INPUTS, 20e5, T)
out = cp.AbstractState("HEOS", 'hydrogen')
out.update(cp.PT_INPUTS, 350e5, T)
dS = out.smolar() - feed.smolar()
TdS = 298.15*dS # -7214.737881254812

Is there an EOS implemented in thermo, which is suitable for H2 in the given pressure range?

Thank you. Ben

related issues

https://github.com/CalebBell/thermo/issues/117 https://github.com/BioSTEAMDevelopmentGroup/thermosteam/issues/69

yoelcortes commented 1 year ago

@CalebBell, thanks for your clarification on #117! I got everything to work because of it :)

@BenPortner, the S_dep_g/l and H_dep_g/l are excess free energies, not total actual free energies. I forgot to mention this in the issue. I'll let you or Caleb close this issue, in case there is more to talk about.

Thanks!

CalebBell commented 1 year ago

@yoelcortes @BenPortner Yes, that makes sense. Please keep in mind that when modeling a fluid as a real gas, instead of an ideal gas, the calculation of power for the compressor is fairly complex. A numerical integral is required, as demonstrated in the example linked here:

https://thermo.readthedocs.io/Examples/Chemical%20Thermodynamics%20for%20Process%20Simulation/Problem%2014.08%20Required%20Compressor%20Power%20for%20Isothermal%20and%20Adiabatic%20Compression%20of%20a%20Gas%20Mixture%20%28CO2%2C%20O2%29%20Using%20the%20Ideal%20Gas%20Law.html

BenPortner commented 1 year ago

Hi @CalebBell,

Thank you for the link to your isothermal compression example. I believe it is not necessary to evaluate an integral for the reversible case η=1. The first thermodynamic law says dH = dQ + dW where dW=Vdp. For reversible processes dQ = T*dS. Putting it all together: dW = Vdp = dH-T*dS. Now, since T=const for the isothermal process, it follows that the work is simply W = ΔH-T*ΔS. No integrals 😉