jjgomera / iapws

python libray for IAPWS standard calculation of water and steam properties
GNU General Public License v3.0
170 stars 64 forks source link

H2ONH3() FIXME #54

Closed scolecophagous closed 3 years ago

scolecophagous commented 3 years ago

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 + x*NH3.M
    # Molar mixture critical density and mass critical density
    rhoc12m = 1/(1.2395117/2*(1/rhoc1m+1/rhoc2m))
    rhoc12 = rhoc12m*M/1000
    # Molar rhon, and mass rhon
    rhonm = 1/((1-x)**2/rhoc1m + x**2/rhoc2m +
              2*x*(1-x**b)/(rhoc12m))
    rhon = rhonm*M/1000
    # I think these are the correct signs?
    drhonx = -(M/1000)*(2*b*x**b/rhoc12m + 2*(1-x**b)/rhoc12m -2*x/rhoc2m + 2*(1-x)/rhoc1m)/(2*x*(1-x**b)/rhoc12m + x**2/rhoc2m + (1-x)**2/rhoc1m)**2
jjgomera commented 3 years ago

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

scolecophagous commented 3 years ago

Your project looks great! Good luck.

Thanks for the reply.

On Thu, 3 Jun 2021 at 03:45, Juan José Gómez Romera < @.***> wrote:

wow, thanks, thats was the problem, fix in last commit. About dhronx, thanks too, anyway here i think none of us have complete solution, added sympy solution as comment in code and working in equilibrium routine to use the values and check result

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jjgomera/iapws/issues/54#issuecomment-853739095, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUHTUDDZBVD2WHA4SI2BN5TTQ5FLVANCNFSM45TF7DMA .