12-31-2016, 09:27 AM

To all resident Thermodynamics experts out there....

Recently I've been documenting a bunch of programs I wrote back at engineering school; you may have noticed the contributions in the Program Library section. The latest one is based on the principle of corresponding states to approximate the PVT properties of a real gas - with more or less accuracy depending on the region.

There's another program that builds on this one to also calculate the enthalpy and entropy values, making the calculations also applicable to saturated vapor and liquid regions. However the results it yields don't really correlate with the values from the substance charts. I suspect the issue lies in the subroutines that evaluate the "discrepancies" of those two magnitudes (i.e. the value differences between the real gas and the ideal gas for each enthalpy and entropy). In particular, the formulas used don't seem to make much sense, as some factors are logarithms of dimensional magnitudes.

Since I reversed-engineered those formulas from the program code, I can't be sure whether the error is at the conceptual stage (i.e. bad formula) or due to errors in the code. Needless to say the little I knew about thermodynamics has faded away since then, about 30 years ago and without any exposure to these subjects.

So here are are the suspects:-

The Equation of State used is a variation on Martin's Cubic in volume:

Pr = Tr / [Zc.Vr – B ] – A / { Tr^n [ Zc.Vr – B + 1/8 ]^2 }

with {Zc, A, B, n} non-dimensional constants specific for each substance.

Volumes are in specific terms, i.e. "per mass" (like m^3/kg)

All reduced magnitudes are non-dimensional (Vr=V/Vc, Tr=T/Tc, Pr=P/Pc).

The Discrepancy of Entropy (DS) is obtained with the formula below:

DS(T,P) = (R/M) { (n+1) + n.A.(M.Z"c/Zc) / [Zc.Vr + 1/8 - B].Tr^(n+1) – Ln(M.Z") + Ln[Vr / (Vr - B/Zc)^(M.Z"c/Zc)] }

where M is the molecular weight; Z"= P.V/R.T ; and Z"c = Pc.Vc/R.Tc

The Discrepancy of Enthalpy (DH) is calculated using the Hemholz's Free Energy Discrepancy (DF), as per the relationship:

DH = DF - U - T.DS

where U ~= P.V - T.R/M is the internal energy.

and the formula for DF shown below:

DF(T,P) = (R.T/M).Ln(M.Z") + Pc.Vc {A / [Zc.Tr^n.(Zc.Vr + 1/8 - B)^2] – Tr.[Ln(Vr)/M.Z"c - Ln(Vr-B/Zc)/Zc] }

Do these equations look ok to you?

I can't really tell where they come from, obviously must be derived from the equation of state but how? Besides I'm not sure they're dimensionally correct...

any feedback is welcome:-

Recently I've been documenting a bunch of programs I wrote back at engineering school; you may have noticed the contributions in the Program Library section. The latest one is based on the principle of corresponding states to approximate the PVT properties of a real gas - with more or less accuracy depending on the region.

There's another program that builds on this one to also calculate the enthalpy and entropy values, making the calculations also applicable to saturated vapor and liquid regions. However the results it yields don't really correlate with the values from the substance charts. I suspect the issue lies in the subroutines that evaluate the "discrepancies" of those two magnitudes (i.e. the value differences between the real gas and the ideal gas for each enthalpy and entropy). In particular, the formulas used don't seem to make much sense, as some factors are logarithms of dimensional magnitudes.

Since I reversed-engineered those formulas from the program code, I can't be sure whether the error is at the conceptual stage (i.e. bad formula) or due to errors in the code. Needless to say the little I knew about thermodynamics has faded away since then, about 30 years ago and without any exposure to these subjects.

So here are are the suspects:-

The Equation of State used is a variation on Martin's Cubic in volume:

Pr = Tr / [Zc.Vr – B ] – A / { Tr^n [ Zc.Vr – B + 1/8 ]^2 }

with {Zc, A, B, n} non-dimensional constants specific for each substance.

Volumes are in specific terms, i.e. "per mass" (like m^3/kg)

All reduced magnitudes are non-dimensional (Vr=V/Vc, Tr=T/Tc, Pr=P/Pc).

The Discrepancy of Entropy (DS) is obtained with the formula below:

DS(T,P) = (R/M) { (n+1) + n.A.(M.Z"c/Zc) / [Zc.Vr + 1/8 - B].Tr^(n+1) – Ln(M.Z") + Ln[Vr / (Vr - B/Zc)^(M.Z"c/Zc)] }

where M is the molecular weight; Z"= P.V/R.T ; and Z"c = Pc.Vc/R.Tc

The Discrepancy of Enthalpy (DH) is calculated using the Hemholz's Free Energy Discrepancy (DF), as per the relationship:

DH = DF - U - T.DS

where U ~= P.V - T.R/M is the internal energy.

and the formula for DF shown below:

DF(T,P) = (R.T/M).Ln(M.Z") + Pc.Vc {A / [Zc.Tr^n.(Zc.Vr + 1/8 - B)^2] – Tr.[Ln(Vr)/M.Z"c - Ln(Vr-B/Zc)/Zc] }

Do these equations look ok to you?

I can't really tell where they come from, obviously must be derived from the equation of state but how? Besides I'm not sure they're dimensionally correct...

any feedback is welcome:-