modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
472 stars 169 forks source link

Old value for universal gas constant used for calculation of specific gas constant #4233

Closed Parti-Gyle closed 8 months ago

Parti-Gyle commented 10 months ago

I noticed that the specific gas constant stated in the data records for the ideal gases (SingleGasesData.mo), has been calculated with a universal gas constant value of $R=8.3144720$; which I believe would have been the value for $R$ when the Media library was written.

However, in the McBride B.J., Zehe M.J., and Gordon S. (2002) (NASA Glenn coefficients) paper they use a value $R=8.314510$ (Appendix A). Yet since then, the universal gas constant has been redefined $R=N_A.k=8.31446261815324\; \: J\cdot K^{-1}\cdot mol^{-1}$.

I know we're talking about a difference in the 5th/6th significant figure, but should all the specific gas constants be recalculated $R_S$? And if so, what value of the universal gas constant $R$ should be used?

I'm happy to submit a pull request the the relevant changes if it's deemed necessary.

beutlich commented 10 months ago

Thanks for raising this issue.

I am not sure if we really need the calculated value for R_s, or rather can live with an expression final R_s=Modelica.Constants.R/MM. @thorade

Parti-Gyle commented 10 months ago

I agree that would remove the need to update all the specific gas constants whenever the universal gas constant in Modelica.Constants.mo gets updated. However, $R$ in MSL is a different value to that which was used in the NASA paper and this difference will propagate to the thermodynamic properties calculated with the NASA Glenn coefficients.

I know the error will be small, using a newer value of $R$, but the thermodynamic properties calculated will differ from what the original NASA model produces.

Should the specific gas constants not be recalculated with $R=8.314510$, to remain true to the NASA source?

mestinso commented 10 months ago

I did a cursory glance here and based on my experience with fluid property routines such as this one, yes normally one should always use the universal gas constant that was used by the authors of the routine. In this case, that appears to be the 8.314510 value.

So, the R_S value in each data record should probably be replaced by MM/R_NASA2002, where R_NASA2002=8.314510.

...moving forward, it will be nice when all new routines use the new truly constant universal gas constant value. But for all routine created before ~2020, yes, I think we will have these other/older gas constant values in the mix. (Note that the alternative is much messier).

With that said, probably best to get agreement/confirmation from the author/officer for this portion of the library.

thorade commented 9 months ago

The value for R is to my understanding final, so it will not change any more. Here is a related ticket from RefProp: https://github.com/usnistgov/REFPROP-issues/issues/239 They decided to use the new final value everywhere, and I would follow that recommendation

hubertus65 commented 9 months ago

Thanks Matthis, for the link, quite insightful. I don't find this easy, trivial to decide.

My feeling is that it would be best to: update the R-value to the current final value and live with the (very minor) differences that gives for the original NASA data. I'm happy to hear further opinions.

casella commented 8 months ago

See discussion in #4238