gustavochm / phasepy

Other
81 stars 28 forks source link

Thank You for Phasepy and Seeking Guidance #22

Open RPeter18 opened 9 months ago

RPeter18 commented 9 months ago

Dear Gustavochm, I wanted to express my sincere appreciation for your work on the Phasepy software. As a beginner in this field, I have found your software to be incredibly valuable, and I am eager to learn more about it. I have been using Phasepy to perform phase equilibrium calculations for various components, such as CO2, H2O, and CH4, using the UNIFAC model. While I have consulted the "Parameters of the Modified UNIFAC (Dortmund) Model" database, I am still unsure about how to determine the GC and Ant parameters for these specific components and perform accurate calculations. I was wondering if you could offer some guidance or point me in the right direction. If you have any resources, documentation, or relevant literature that could help me better understand how to use the UNIFAC model and the Phasepy software, I would greatly appreciate it. Your expertise and insights would be invaluable to me as I continue to learn and apply these tools in my research. Thank you for your time and consideration. Best regards

gustavochm commented 9 months ago

Dear RPeter,

Thanks for your kind words! I'm glad phasepy could be useful for you!

Regardless of your questions. Phasepy includes two databases for UNIFAC (the original version and the Dortmund version). You need to provide the group contribution information when defining a component, be aware that the group definition changes depending of which UNIFAC version you are using. For example defining ethanol with UNIFAC (Dortmund) would be as follows:

ethanol = component(name='ethanol', Tc=514.0, Pc=61.37, Zc=0.241, Vc=168.0, w=0.643558, c=5.35490936, Ant=[11.61809279, 3423.0259436, -56.48094263], GC={'CH3':1, 'CH2':1, 'OH(P)':1}, ri=2.1055, qi=1.972)

And for the original UNIFAC it would be:

ethanol2 = component(name='ethanol', Tc=514.0, Pc=61.37, Zc=0.241, Vc=168.0, w=0.643558, c=5.35490936, Ant=[11.61809279, 3423.0259436, -56.48094263], GC={'CH3':1, 'CH2':1, 'OH':1}, ri=2.1055, qi=1.972)

For the Antoine parameters, in phasepy the following form of the Antonie equation is used:

$$ \ln (P /bar) = A - \frac{B}{T/K + C}$$

And you need to supply the parameters as a list or array as follows [A, B, C]. If you don't have Antonie parameters for a component you can fit using the fit_ant function. Please check the following notebooks for further details:

I hope that helps.

Regards, Gustavo

RPeter18 commented 9 months ago

Dear Gustavochm, First and foremost, I want to express my gratitude for taking the time to respond to my previous inquiry. Your guidance and expertise have been incredibly valuable to me. In your response, you mentioned the two databases for UNIFAC (the original version and the Dortmund version). I have a specific question regarding the determination of the five-star parameters, especially the GC values, for CO2 and CH4. I would greatly appreciate it if you could provide me with more insights on this aspect. Specifically, I am interested in understanding how to determine the UNIFAC model's component parameters, including the GC values, for CO2 and CH4. These parameters are crucial for simulating and calculating phase equilibria in multicomponent systems(CO2-CH4-H2O), but I am not entirely clear on how to accurately establish them. If you have any guidance, suggestions, or literature resources to share on this matter, it would be immensely helpful. I am eager to dive deeper into the study and application of the UNIFAC model to gain a better understanding of the behavior of multicomponent systems. Once again, thank you for your time and assistance. I look forward to your response and appreciate your continued support. Warm regards,

gustavochm commented 9 months ago

Dear RPeter,

I have only included the list of official parameters for the original and Dortmund UNIFAC. Sadly, for now, I don't provide a function to fit new groups. Fitting new groups is not an easy task (and can easily go wrong ...). I could work on implementing an API for accepting customized databases but I would take me a bit (loads of work at the moment 🥲)

Out of curiosity, at which conditions do you aim to model the mixture of CO2-CH4-H2O? My concern is that both CO2 and CH4 are supercritical the results from an activity coefficient model and Antonie equation (gamma-phi) wouldn't be reliable. In that case, you would need to use an equation of state (EoS). You could the cubic EoSs in phasepy for that. Another option would be to use SAFT. I have another package that includes SAFT-VR-Mie and its group contribution version SAFT-gamma-Mie (this already has parameters for CO2, CH4 and H2O).

Regards, Gustavo

RPeter18 commented 9 months ago

I am currently involved in the field of CO2 injection for enhanced oil recovery, specifically focusing on phase equilibrium calculations. In the course of my research, I have encountered certain challenges related to the accuracy of phase equilibrium predictions, especially when dealing with CO2 under supercritical conditions in the presence of water. Traditionally, equations of state such as the Peng-Robinson Equation of State (PREOS) and other cubic equations of state have been used to estimate the solubility of CO2 in water. However, these models have limitations when it comes to accurately representing the dissolution of CO2 in water due to the polar nature of water. As a result, I have been exploring alternative methods to improve the precision of these calculations. In light of this, I would like to inquire about the capabilities of sgtpy in addressing the phase equilibrium of water-CO2-hydrocarbon systems. I am particularly interested in its ability to calculate phase equilibrium under a wide range of operating conditions, where pressures may vary from 0.1 MPa to 50 MPa, and temperatures can range from 0°C to 100°C. Given the complexities of these systems, including the interaction of CO2 with both water and hydrocarbons, I am curious if sgtpy provides accurate and reliable results in such scenarios. If sgtpy is capable of performing these calculations or if you have any information on resources or expertise that may assist me in this regard, I would greatly appreciate your insights and guidance. Your expertise in this area would be invaluable as I seek to enhance the precision and reliability of phase equilibrium calculations for my research. Thank you for your time and consideration. I look forward to your response and the possibility of further collaboration or guidance in this area. Sincerely

gustavochm commented 9 months ago

Hi RPeter,

Sorry, I missed the email from your reply. I think SAFT-VR-Mie (or SAFT-gamma Mie) seem suitable for describing the system you are describing. SAFT models can incorporate association (and sometimes polar terms) so I you would a more physically correct description of the components in the mixture. sgtpy includes the same routines as phasepy for phase equilibria. The one consideration is that calculations with SAFT tend to be slower, and sometimes they can fail. This is mainly as the solver relies on iteratively solving the density roots at a given x, T, P, and this could be very sensitive to the initial guesses. I implemented some routines to obtain initial guesses but even though they work just fine in a wide range of mixtures and conditions, they are not perfect and can (numerically) fail.

I hope that helps, Gustavo