simulkade / PVTtool

A Matlab toolbox for the PVT calculation using the cubic equations of state (EOS)
24 stars 17 forks source link

Why are the gas phase compressibility factors equal to those of the liquid phase? #3

Open RPeter18 opened 1 year ago

RPeter18 commented 1 year ago

Subject: Why are the gas phase compressibility factors equal to those of the liquid phase?

Dear Professor,

I hope this email finds you well. I am writing to express my gratitude for the wonderful code you have developed for me to study. However, while working with the PREOS(mixture1, thermo1) function, I encountered a problem. Specifically, I noticed that the gas phase compressibility factors are equal to those of the liquid phase, even though the component composition results for each phase are correct. The issue arises when I attempt to calculate the density using the compressibility factor.

I am writing to seek your help and advice on this matter. I would greatly appreciate it if you could provide some insights into why the gas phase compressibility factors are equal to those of the liquid phase, and how I can solve the problem of calculating density using the compressibility factor.

Thank you again for your support, and I look forward to hearing from you soon.

Best regards, RPeter

simulkade commented 1 year ago

@RPeter18 can you provide an example that I can probe?

RPeter18 commented 1 year ago

Dear Simulkade,

I am writing to express my gratitude for your reply. It has been very helpful and has provided me with a better understanding of PR EOS.

I have conducted experiments on the case (test case 2) you provided, only changing the temperature and pressure. I have found that no matter what parameters I input, and no matter how many times I loop, PREOS.m's z_root always has only one real root. This may be the reason why the compressibility factor of the gas phase is equal to that of the liquid phase. Although I do not fully understand this phenomenon yet, I will continue to study it in the hope of your answers. Apart from z_root, the errors in the other data are small, and the results are similar to those of commercial software.

Once again, thank you for your reply. If you have other examples or suggestions, please do not hesitate to contact me.

I wish you good health and success in your work.

Sincerely, Rpeter.

Code % test case % liquid-two-phase phase transition clc; clear; % Define the components and load pure physsical properties [component, comp_flag] = addComponents({'CH4', 'C2H6', 'C4H10', ... 'C6H14', 'C10H22', 'C15H32'}); % Define the thermodynamic models T0 = 400; % [K] p0 = 50e5; % [Pa] thermo1 = addThermo(); thermo1.EOS = @PREOS; mixture1 = addMixture(component, T0, p0); % Define flash options options.accuracy = 1e-7; options.iteration = 100; % Negative flash [vapor_y, liquid_x, vapor_frac] = ... vleflashnegative(mixture1, thermo1, options)

[liquid_z, vapor_z, fugacity, HR] = PREOS(mixture1, thermo1);
%why liquid_z = vapor_z?? [s1, sl, sv] = stabilityTest(mixture1, thermo1)