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
287 stars 92 forks source link

PVF and TVF flash - no second liquid phase #82

Closed Greg66 closed 3 years ago

Greg66 commented 3 years ago

IMPORTANT: This section is for code-related bugs. For usage issues, please go to the Support Forums.

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Create new simulation with Aniline+Water
  2. Use NRTL as property package (which already contains parameters) It doesn't matter wether calculation typ "Default" or "VLLE" is selected.
  3. Add new material stream (keep PT falsh spec)
  4. Results show a second liquid phase as expected -> ok
  5. switch to PVF flash with 0 vapour fraction to calculate boiling point
  6. No second liquid phase is calculated. The same is with TVF flash.
  7. switch back to PT-flash. -> at same pressure and temperature second liquid phase is here again
  8. switch to PH flash -> all working fine.
  9. add a heater to increase enthalpy above boiling point in order to check three phase flash -> this is ok as well :-)

Expected behavior PVF and TVF should be able to calculate two liquid phases

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

DanWBR commented 3 years ago

Currently, PVF and TVF flashes support only one liquid phase. What is the procedure to calculate an LLE bubble point?

Greg66 commented 3 years ago

In PVF you just need to define "0" as vapour fraction. This already gives the correct bubble point, just without a second liquid phase.

p.S. how can i attache my simulation file here?

Greg66 commented 3 years ago

It seems Edge-Browser doesn't allow attaching files. Test_Aniline_Water_LLE.zip

DanWBR commented 3 years ago

@Greg66 ok but then the procedure would be doing an LLE flash after finding the equilibrium P/T? I've never found a good reference for LLE bubble points.

Greg66 commented 3 years ago

Hi Daniel, i would have to think about that and check the code again. I just checked the last version of DWSIM 5.8 Update 10 - where it is calculating as expected. :-)

Here some pictures from DWSIM 5.8:

image Pic 1: Configuration

image image Pic 2+3: Calculation results of PVF flash

I hope that will give a clue?

DanWBR commented 3 years ago

We had an LLE bubble point routine and I don't remember it...🤦🏻‍♂️

Greg66 commented 3 years ago

@Greg66 ok but then the procedure would be doing an LLE flash after finding the equilibrium P/T? I've never found a good reference for LLE bubble points.

Hi Daniel, i am sorry this would be the wrong approach. I remember the time when i optimized these 3-Phase flashes i had to adopt a different procedure. In 3-phase region with two liquids the temperature will keep constant until one liquid phase is evaporated completely. Therefore you can't just change the temperature to find the specified vapor fraction. Please do have a look into the old code.

https://github.com/DanWBR/dwsim5/blob/windows/DWSIM.Thermodynamics/Flash%20Algorithms/NestedLoops3PV3.vb#L1778

For calculating the boiling point the procedure is quite similar to a single liquid phase. Both liquid phases do have the same vapor pressure for each component. Therefore you just need to do a LLE flash and calculate vapor pressures for phase 1.

Gregor

DanWBR commented 3 years ago

The code is still here in v6, working on it right now.

Greg66 commented 3 years ago

Hi Daniel, that seems to be the solution. Well done!

Gregor