View Issue Details
ID  Project  Category  View Status  Date Submitted  Last Update 

0004119  OpenFOAM  Bug  public  20240729 07:48  20240729 13:22 
Reporter  psturm  Assigned To  henry  
Priority  normal  Severity  minor  Reproducibility  N/A 
Status  closed  Resolution  no change required  
Summary  0004119: Calculation of heat capacity in the janaf thermodynamic model  
Description  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/userguidev12/thermophysical): Cp = R*((((a4*T + a3)*T + a2)*T + a1)*T + a0) (note the additional R here!) lowCpCoeffs (5.14988 0.013671 4.91801e05 4.84744e08 1.66694e11 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.  
Tags  No tags attached.  

Can you provide an example case which demonstrates that the heat capacity values used in OpenFOAM are incorrect? 

Hello, There is a call in the constructor called convertCoeffs that converts the polynomial parameters to mass basis: https://github.com/OpenFOAM/OpenFOAMdev/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/OpenFOAMdev/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? 

Here it is: https://github.com/OpenFOAM/OpenFOAMdev/blob/e45bad9beb38b1aaceb36e94a12656ecd62cd062/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C#L74 The janafThermo.C converts the molar polynomials to massbasis polynomials without a conditional within janafThermo, so returned value should be correct. 

Yes, you are completely right. The coefficients are converted to massbasis 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. 

User support request 
Date Modified  Username  Field  Change 

20240729 07:48  psturm  New Issue  
20240729 08:25  henry  Note Added: 0013327  
20240729 12:03  blttkgl  Note Added: 0013328  
20240729 12:18  blttkgl  Note Added: 0013329  
20240729 12:26  psturm  Note Added: 0013330  
20240729 13:22  henry  Assigned To  => henry 
20240729 13:22  henry  Status  new => closed 
20240729 13:22  henry  Resolution  open => no change required 
20240729 13:22  henry  Note Added: 0013331 