jjgomera/iapws

H2ONH3() FIXME

Closed this issue · 2 comments

Thanks for your great work on the IAPWS for python.

I think that the FIXME in the H2ONH3() _prop() _phir() routine is related to using mass density where molar density should be used. The original source uses mole fraction and mole density. The critical densities of water and ammonia need to be converted molar densities and then used to calculate rhoc12 and rhon.

There also seems to be a couple of sign errors (+/-) in the drhonx formula

The pressures still don't match exactly. I haven't completely checked this either though.
# Density reducing value, Eq 5
b = 0.8978069
# molar densities
rhoc1m=IAPWS95.rhoc/(IAPWS95.M/1000)
rhoc2m=NH3.rhoc/(NH3.M/1000)
# Mixture molar mass
M=(1-x)IAPWS95.M + xNH3.M
# Molar mixture critical density and mass critical density
rhoc12m = 1/(1.2395117/2*(1/rhoc1m+1/rhoc2m))
rhoc12 = rhoc12mM/1000
# Molar rhon, and mass rhon
rhonm = 1/((1-x)2/rhoc1m + x2/rhoc2m +
2
x*(1-xb)/(rhoc12m))
rhon = rhonmM/1000
# I think these are the correct signs?
drhonx = -(M/1000)
(2bx
b/rhoc12m + 2*(1-xb)/rhoc12m -2x/rhoc2m + 2(1-x)/rhoc1m)/(2x(1-xb)/rhoc12m + x**2/rhoc2m + (1-x)**2/rhoc1m)**2

wow, thanks, that was the problem, itñs fixed in last commit.
About dhronx, thanks too, althought here i think none of us have the complete solution, I've added sympy solution as comment in code and I´m working in equilibrium routine to use the values and check result
Thanks for feedback