#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0004119 OpenFOAM Bug public 2024-07-29 07:48 2024-07-29 13:22 psturm henry normal minor N/A closed no change required 0004119: Calculation of heat capacity in the janaf thermodynamic model There seems to be an inconsistency between the calculation of the specific heat capacity Cp and the provided coefficients in the janaf thermodynamic model. From looking at the source code I believe Cp is always meant to be the mass heat capacity in units of J/kg/K and Cp is calculated in the janaf model as Cp = (((a4*T + a3)*T + a2)*T + a1)*T + a0 However, the JANAF database contains Cp in J/mol/K and also the coefficients given in the tutorials (e.g. "\tutorials\multicomponentFluid\simplifiedSiwek\constant\speciesThermo") and in the documentation point to the fact that Cp is calculated as a molar heat capacity in units of J/mol/k. Using the methane (fuel) example of the user guide (https://doc.cfd.direct/openfoam/user-guide-v12/thermophysical): Cp = R*((((a4*T + a3)*T + a2)*T + a1)*T + a0) (note the additional R here!) lowCpCoeffs (5.14988 -0.013671 4.91801e-05 -4.84744e-08 1.66694e-11 -10246.6 -4.64132); T = 300 K gives a value of 35.8, which is the correct molar heat capacity in J/mol/K. The mass heat capacity, however, is Cp = R/molWeight*1000*((((a4*T + a3)*T + a2)*T + a1)*T + a0) = 2229 J/kg/K. So, are these molar values converted to the correct units somewhere else in the code? If not, using the janaf thermodynamic model will result in wrong Cp, enthalpy and entropy values. No tags attached.

#### Activities

 2024-07-29 08:25 manager   ~0013327 Can you provide an example case which demonstrates that the heat capacity values used in OpenFOAM are incorrect? 2024-07-29 12:03 reporter   ~0013328 Hello, There is a call in the constructor called convertCoeffs that converts the polynomial parameters to mass basis: https://github.com/OpenFOAM/OpenFOAM-dev/blob/e45bad9beb38b1aaceb36e94a12656ecd62cd062/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H#L68 If this flag is on, it would multiply the polynomial values with the specific gas constant of methane, giving you the correct answer of 2229 J/kg/K. However the flag is by default is set to false: https://github.com/OpenFOAM/OpenFOAM-dev/blob/e45bad9beb38b1aaceb36e94a12656ecd62cd062/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H#L187 I wonder if the construction of the janafThermo from the compressible modules takes care of this conversion by setting it to true? 2024-07-29 12:18 reporter   ~0013329 Here it is: https://github.com/OpenFOAM/OpenFOAM-dev/blob/e45bad9beb38b1aaceb36e94a12656ecd62cd062/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C#L74 The janafThermo.C converts the molar polynomials to mass-basis polynomials without a conditional within janafThermo, so returned value should be correct. 2024-07-29 12:26 reporter   ~0013330 Yes, you are completely right. The coefficients are converted to mass-basis and then Cp is calculated using the converted coefficients. Stupid enough, I have missed this conversion step on the coefficients. So all seems correct. Apologies for bothering. 2024-07-29 13:22 manager   ~0013331 User support request