tabulatedThermophysicalProperties
tabulatedThermophysicalProperties copied to clipboard
Calculation of CpMCv in tabularEOS
I have looked over the calculation of the CpMCv method in tabular EOS.
Currently you have it implemented as,
return -(p/sqr(densityTable(p,T)))*densityTable.Tderivative(p,T)
I have made the derivation myself from the beginning and came to following result:
return (T/sqr(densityTable(p,T)))
*sqr(densityTable.Yderivative(p,T))/densityTable.Xderivative(p,T);
Can you explain me how you get to your formulation?
One Note, I have changed the table derivations to X and Y derivation to generalize it
I test the formulation that is implemented in OpenFOAM (the first one) for perfect gas where Cp - Cv = R and it works well. So I think the formulation is correct.
Hello Yuusha,
I have just seen my old issue and wanted to explain why I opened it. Please see attached image.

Hi, Thank you for the explanation. I found the problem. When I change cp - cv to R, I forgot to change the expression for non-perfect gas.
Unfortunately, I do not use the tables as a standalone any more but I will continue to maintain it. Could you make a merge request with your changes and I will merge it on the code.
Hello,
unfortunately my initial proposed solution is incorrect as well. I right now do not see a better way than assuming ideal gas, as from the density table alone I do not know how to determine the partial derivative of pressure to temperature. Therefore, I would leave it as is but maybe make a comment to say that there is this assumption.
Thank's. I let the bug open but changing it as an enhancement (be able to use non-perfect gas). I will change the README too. By the way OpenFOAM-8 and OpenFOAM-dev (future OpenFOAM-9) has new method to read from tables if you want.
Hello Yuusha, my proposed solution actually does work. I am a bit confused myself about the equations but there are many ways to express CpMCv depending on the assumptions you make. A very general approach is described here: https://www2.ph.ed.ac.uk/~gja/thermo/lectures/lecture9.pdf which also considers liquids.
This can be rewritten into the expression, originally posted in my first comment. I checked the results with CoolProp and they agree. So it seems to me to be valid.
Thank you for your feedback. I will take it for next version.