gustavochm / phasepy

Other
81 stars 28 forks source link

Fit VL-coexistence curve from experimental data #23

Open GregorySchwing opened 8 months ago

GregorySchwing commented 8 months ago

I have some experimental data of water with these columns Index(['T_K', 'dens_vap', 'dens_uncertainty', 'dens_liq', 'dens_liq_uncertainty', 'psat', 'psat_uncertainty', 'lnzsat', 'lnzsat_uncertainty']

How would I generate a VL-coexistence curve, plot it, and be able to interpolate at points on the curve

Thanks, Greg

gustavochm commented 7 months ago

Dear Greg,

Do you want to plot and work with that data? If so, you can use pandas to read the CSV or Excel file and then matplotlib to plot and scipy for interpolation.

If you also want to model that same data with an equation of state, you can use phasepy. Phasepy includes cubic equations of state and methods for solving phase equilibria. If you are working with pure fluids you can check the following first part of this notebook or cell 7 of this notebook.

If you use an equation of state, the interpolation is done as you would need to compute the saturation property at the desired condition.

I hope that helps, Gustavo

GregorySchwing commented 7 months ago

Scipy does a pretty terrible job since I only have points in vapor and liquid. I did try following those examples but I wanted more specifics on how to plot a T-Density curve after fitting an EOS adjusted to my experimental data. I know "flash" objects have this functionality.

gustavochm commented 7 months ago

Hi Gregory,

In cell 7 of this notebook shows how to compute the saturation pressure and saturation densities of a pure component. From there, you can plot the T-density plot you want.

Just as a clarification, the flash calculation in phasepy is exclusive of mixtures, and from what I understood, you have a pure fluid.

Gustavo