I've just found out about the amazing DWSIM Standalone Thermodynamics Library (DTL) and have been playing with it through Python in Windows using pythonnet.
I was able to reproduce the VB examples in Python without any problems.
I'm trying to figure out how to solve a bubble Temperature problem using DTL. I have a mixture of hidrocarbons at a certain liquid phase composition and pressure and using this values I would like to calculate the vapor phase composition at equilibrium and the bubble Temperature.
Is there a simple way to achieve this objective using DTL? I've noticed that there is a Phase Property called bubbleTemperature, but I haven't found out how to get to this object.
I managed to calculate the bubble temperature correctly using the CalculateEquilibrium2 method, but not the vapor composition.
The object returns an empty array for the vapor composition.
I looked into the source code, but I do not have experience with VB, so my insights are limited. I suspect that there are some info that I am not specifing in the mix object. Something related to the expected phases (liquid, vapor) perhaps.
This is the code snippet I used to calculate the bubble temperature:
Great! get_VaporPhaseMoleAmounts is returning zeroes because it multiplies the vapor phase mole fraction (which is zero because it is a bubble point calculation) by the vapor phase composition... thankfully the Kvalues are there for you to calculate the y vector.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've just found out about the amazing DWSIM Standalone Thermodynamics Library (DTL) and have been playing with it through Python in Windows using pythonnet.
I was able to reproduce the VB examples in Python without any problems.
I'm trying to figure out how to solve a bubble Temperature problem using DTL. I have a mixture of hidrocarbons at a certain liquid phase composition and pressure and using this values I would like to calculate the vapor phase composition at equilibrium and the bubble Temperature.
Is there a simple way to achieve this objective using DTL? I've noticed that there is a Phase Property called bubbleTemperature, but I haven't found out how to get to this object.
This is what I got so far is:
I was able to create a Mixture, but I was not able to define the pressure and determine the bubble temperature.
Best regards,
Everton Colling
Last edit: Everton Colling 2019-05-31
You can try the CalculateEquilibrium2 function: https://github.com/DanWBR/dwsim5/blob/windows/DWSIM.Thermodynamics/Property%20Packages/PropertyPackage.vb#L1953
Call it from prpp:
P = pressure in Pa
T0 = initial estimate for the bubble temperature in K
result is a FlashCalculationResult object: https://github.com/DanWBR/dwsim5/blob/98156f777a965de3475e467c1be748513fe5b7ed/DWSIM.Thermodynamics/Base%20Classes/FlashAlgorithmBase.vb#L1178
Regards
Daniel
Thanks for the quick reply Daniel!
I managed to calculate the bubble temperature correctly using the CalculateEquilibrium2 method, but not the vapor composition.
The object returns an empty array for the vapor composition.
I looked into the source code, but I do not have experience with VB, so my insights are limited. I suspect that there are some info that I am not specifing in the mix object. Something related to the expected phases (liquid, vapor) perhaps.
This is the code snippet I used to calculate the bubble temperature:
This gives me:
Best regards,
Everton Colling
Last edit: Everton Colling 2019-05-31
Try
Or use the Kvalues property to calculate the vapor composition.
The Kvalues approach worked like a charm!
Giving the expected result:
Thanks for the support!
Great! get_VaporPhaseMoleAmounts is returning zeroes because it multiplies the vapor phase mole fraction (which is zero because it is a bubble point calculation) by the vapor phase composition... thankfully the Kvalues are there for you to calculate the y vector.