Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #2443

Closed
Open
Created Apr 13, 2022 by Scurry GunHong Kim@duckfly

thermophysicalFunctions/integratedNonUniformTable <revised>

Summary

This code-bug is a simple mistake, but it can produce a serious problem at least for me. For several monthes, I've tried to test a tabulated thermo-data and found this bug. Today I found there is a worng formula to integrate the tabulated data to calculate the enthalpy of specie, for example table(T, Cp).

The bug is in "integratedNonUniformTableThermophysicalFunction.C" under src/thermophysicalProperties/thermophysicalFunctions/integratedNonUniformTable/.

Steps to reproduce

Just look the Constructor of "integratedNonUniformTable" or the fuction of "intfdT".

  • integral formula: Integral from Tst to Ti = Integral[i-1] + intfdT(Ti)*dT

  • in "intfdT" function, it returns the full integral value from Tst to Ti. return-value = intf_[i] + (fi + 0.5lambda(values()[i + 1].second() - fi))*dT

Example case

  • There are 2 tutorials in $FOAM_TUTORIALS, they use the thermo-type of tabulation. multiphase/icoReactingMultiphaseInterFoam/inertMultiphaseMultiComponent multiphase/icoReactingMultiphaseInterFoam/mixerVesselAMI2D

  • the bug is related only to calculate the enthalpy of hTabulated-thermo. Actually, two cases work. However if you use a large table of Cp, then a serious error occur to stop.

What is the current bug behaviour?

  • If the element-number of tabulated data is small, then it might not produce a serious problem. Therefore, nobody notice any wrong result.
  • for a large tabulated data, in most cases, the calculation must stop to say wrong temperature.

What is the expected correct behavior?

Relevant logs and/or images

Environment information

  • OpenFOAM version : v2112(or any)
  • Operating system : ubuntu
  • Hardware info : any
  • Compiler : any

Possible fixes

  • code: https://www.openfoam.com/documentation/guides/latest/api/integratedNonUniformTableThermophysicalFunction_8C_source.html

  • one simple suggestion for constructor "integratedNonUniformTable"

original code

 for (label i = 1; i < intf_.size(); ++i)
 {
     intf_[i] = intf_[i-1] + intfdT(0, values()[i].first());
     intfByT_[i] = intfByT_[i-1] + intfByTdT(0, values()[i].first());
 }

suggestion

 for (label i = 1; i < intf_.size(); ++i)
 {
     intf_[i] = intfdT(0, values()[i].first());
     intfByT_[i] = intfByTdT(0, values()[i].first());
 }
Edited Apr 15, 2022 by Scurry GunHong Kim
Assignee
Assign to
Time tracking