Post Reply 
Compresibility factor, residual entropy and residual enthalpy calculator.
01-03-2019, 11:32 AM (This post was last modified: 01-04-2019 07:17 AM by DevilGladiator.)
Post: #1
Compresibility factor, residual entropy and residual enthalpy calculator.
Hi, I'm an aeronautical engeering student in spain. Today I would like to share with you the program that I've just created, it's a compresibility factor, residual entropy and residual enthalpy calculator using the Leee Kesler method.

How it works:
I'm tired of looking for the values of the compresibility factor and residual entropy/enthalpy in tables/charts. For this reason I copied the data from the tables of my textbook using an OCR scanner into the HP Prime and made a little program that interpolates the values if they fall between two data points. By the way the tables that I've copied are shared among many books like Advanced Thermodynamics For Engineers McGraw-Hill and are extracted from this paper: http://dns2.asia.edu.tw/~ysho/YSHO-Engli...%20510.pdf.

The calculation of the compresibility factor is done as follows:
Z = Z0 + w*Z1
(H*-H)/(R*Tc) = H0 + w*H1
(S*-S)/(R) = S0 + w*S1
Where Z0, Z1, S0, S1, H0 and H1 are looked in the table and w, the accentric factor, is provided by the user.

Usage:
The program comes with three four functions, all of them have the same inputs
Inputs:
-Pr: Reducced pressure of the gas (P/Pr):
-Tr: Reducced temperature of the gas (T/Tr):
-w: Accentric factor of the gas
  • STATE_DATA(): Outputs the value of Z, (H*-H)/(R*Tc), (S*-S)/(R)
  • FACTOR_Z(Pr,Tr,w): Outputs the value of Z
  • DESV_H(Pr,Tr,w): Outputs the value of (H*-H)/(R*Tc)
  • DESV_S(Pr,Tr,w): Outputs the value of (S*-S)/R

NOTES:
Many textbooks provide charts for Z, (H*-H)/(R*Tc) and (S*-S)/(R) instead of tables, you should notice that these charts are independent of the accentric factor. I know that this is not scientific at all but I've found out that if you input the value of w=0.175 (If for some reason a student from my university, ETSIAE is reading this with that value of 'w' you will get enough precission in the exam) you get a result that is really close to the one obtained from the charts. If someone with a true knowledge on the matter knows how to calculate 'w' to get the same results as on the charts please tell share your knowledge.

Limitations/Potential improvements:
  • One of the main limitations of the program is that it doesn't work for values of Tr<0.3 because the tables don't contain any data points for reduced pressures below that value. If someone knows of a source with more data points different that the ones already included in the program please share them.
  • The interpolation system that I've implemented is linear and I'm sure that it is not optimal. If someone knows how to improve it please do it and share it.
  • Keep in mind that I know little programming so the code of the program should be improved.

Licence:
You are free to use, modify and share the program as long as you keep it free, don't modify the licence and reference me and any other contributor as the original authors.


Attached File(s)
.hpprgm  TablasTermodinamica.hpprgm (Size: 28.12 KB / Downloads: 16)
Find all posts by this user
Quote this message in a reply
09-17-2020, 07:38 PM
Post: #2
RE: Compresibility factor, residual entropy and residual enthalpy calculator.
It has been a while since I learned about the compressability factor along with fugasity but from what I remember the LK method is only usable for certain conditions (polarity, and pressures). While leaning for chemical engineering we used the LK method a few times but we focused mainly on the Ping Robinson Equation of State as well as 2 Term Virial method depending on the system and the parameters. We had to calulate acentric factors (w) from time to time and most of the time they linded up with tabulated values found on Knovel.com. The LK method was by far the easiest to use. These are some of the programs I wrote for Fugasity utilizing PR, 2-TV, and LK also for mixtures as well as fugasity applied to Gibbs free energy.
.hpprgm  Mixture_Fugacity (2TV).hpprgm (Size: 9.26 KB / Downloads: 2)
.hpprgm  Mixture Fugacity_PR.hpprgm (Size: 9.79 KB / Downloads: 3)
.hpprgm  2 TV-fugasity.hpprgm (Size: 3.46 KB / Downloads: 3)
.hpprgm  Fugasity_LK.hpprgm (Size: 1.41 KB / Downloads: 3)
.hpprgm  Gibbs.hpprgm (Size: 5.44 KB / Downloads: 4)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)