Skip to content

TEqn.H error in compressibleInterFoam

Summary

The energy equation in compressibleInterFoam is implemented in a wrong way. Specifically the (divU * p) term in TEqn.H. This should instead read div(U * p) = divU * p + gradp * U. Current implementation eliminates the gradp * U term.

Example case

I made an oblique shock benchmark case (taken from the tutorial section) in order to demonstrate the error. Three different solvers, which all solve the energy equation, are used: rhoCentralFoam, sonicFoam and compressibleInterFoam. These solvers should perform equal and give the same output. Due to the error, the compressibleInterFoam does not perform well. When the bug is fixed and the term is properly implemented the expected behavior is obtained as demonstrated by compressibleInterFoam_divUp solver. The results of all four solvers can be seen in the video.

Relevant logs and/or images

ObliqueShockBenchamrk_fixed.avi

Environment information

  • OpenFOAM version :v1812 (also seen in 1706,1712,1806,1906)
  • Operating system :ubuntu

Possible fixes

The fix that works for me is (in TEqn.H) change (divU*p)() --> fvc::div(fvc::absolute(phi,U),p)(). Similarly this is also how equation is written in OF6.