DanWBR / dwsim

DWSIM is a Steady-State and Dynamic Sequential Modular Chemical Process Simulator for Windows, Linux and macOS.
https://dwsim.org
GNU General Public License v3.0
300 stars 96 forks source link

[Bug] PVF / dew point calculation error #333

Closed andr1976 closed 2 years ago

andr1976 commented 2 years ago

Describe the bug Dewpoint calculation fails for the PVF flash for PR, SRK, GERG etc

Expected behavior Identify dew point temperature of -11 / -12 C'ish at 40 barg

Desktop (please complete the following information):

Additional context See attached file dewpoint_error.zip

DanWBR commented 2 years ago

@andr1976 does it fails due to an error or wrong temperature value? just to be sure

DanWBR commented 2 years ago

@andr1976 initial estimates are close to the trivial solution. the algorithm conditions are satisfied in the end, even with the wrong temperature. do you have any suggestion?

andr1976 commented 2 years ago

The calculation runs but returns a temperature which is not the dew point at the specified pressure. Far from. Things start to go sideways above 30'something bar.

andr1976 commented 2 years ago

image

image

andr1976 commented 2 years ago

Ok one is with SRK but the same applies with PR. There is apparently a regression in the stability of the PVF/TVF algorithm

DanWBR commented 2 years ago

@andr1976 did you check this with latest code?

andr1976 commented 2 years ago

Sorry, no haven’t had time yet

tir. 28. jun. 2022 kl. 20.34 skrev Daniel Wagner @.***>:

@andr1976 https://github.com/andr1976 did you check this with latest code?

— Reply to this email directly, view it on GitHub https://github.com/DanWBR/dwsim/issues/333#issuecomment-1169085992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6EIDZ67JGT52PMIOYO3I3VRNAVDANCNFSM5ZG23CAQ . You are receiving this because you were mentioned.Message ID: @.***>

andr1976 commented 2 years ago

@DanWBR , yes dew point is fine now, but the bubl-point is messed up now above 44-46 bar depending on EOS. I also think the critical point is way off. Above this pressure bubl point temperature suddenly jumps from -76 C to -10 C

andr1976 commented 2 years ago

This is the envelope expected image

DanWBR commented 2 years ago

@andr1976 the critical point is the reference to stop calculating dew and bubble points... it is very far from the correct one in this specific case

andr1976 commented 2 years ago

Yes, I see. Thing is, this is natural gas (although a little to the heavy side), so this is something that could potentially be encountered quite often

DanWBR commented 2 years ago

This looks better (PR). SRK still fails to calculate the correct critical point. GERG will need a new algorithm as I don't have a general procedure to calculate critical points - only PR and SRK for now.

image

DanWBR commented 2 years ago

the chart title is wrong - it was calculated with PR.

andr1976 commented 2 years ago

Looks way better now - I think PP is somehow defaulting to the last PP available, for the title, not for the calcs

andr1976 commented 2 years ago

Could be nice to have Ian Bell on-board to do the critical point calculation method :-)
https://www.nist.gov/publications/calculation-critical-points-helmholtz-energy-explicit-mixture-models

DanWBR commented 2 years ago

@andr1976 I have an implementation of this method for quite some time already, but I've let it aside as it is slow and was not working. I'm revisiting it to see if I can get it working.

DanWBR commented 2 years ago

SRK:

image