tabulatedThermophysicalProperties icon indicating copy to clipboard operation
tabulatedThermophysicalProperties copied to clipboard

Calculation of CpMCv in tabularEOS

Open JanGaertner opened this issue 7 years ago • 8 comments

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?

JanGaertner avatar Jul 25 '18 15:07 JanGaertner

One Note, I have changed the table derivations to X and Y derivation to generalize it

JanGaertner avatar Jul 25 '18 15:07 JanGaertner

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.

Yuusha0 avatar Jan 01 '19 18:01 Yuusha0

Hello Yuusha,

I have just seen my old issue and wanted to explain why I opened it. Please see attached image. Screenshot from 2021-04-16 17-12-27

JanGaertner avatar Apr 16 '21 15:04 JanGaertner

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.

Yuusha0 avatar Apr 16 '21 15:04 Yuusha0

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.

JanGaertner avatar Apr 16 '21 15:04 JanGaertner

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.

Yuusha0 avatar Apr 16 '21 16:04 Yuusha0

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.

JanGaertner avatar Aug 17 '21 09:08 JanGaertner

Thank you for your feedback. I will take it for next version.

Yuusha0 avatar Sep 13 '21 09:09 Yuusha0