Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 454
    • Issues 454
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #2506
Closed
Open
Issue created Jun 06, 2022 by Vaggelis Papoutsis@vaggelispDeveloper

Potential bugs in integratedNonUniformTable and nonUniformTable

Summary

  1. nonUniformTable::index(...) will return a negative index if the input temperature is lower than Trange_.min(), which will then cause the simulation to crash when used in the jumpTable_

  2. The piece-wise integrals of f and fByT seem to be computed wrongly in the constructor of integratedNonUniformTable. Since the intfdT and intfByTdT functions already add the integral up until the previous point, these shouldn't be added again in the constructor, right?

Environment information

  • OpenFOAM version : develop branch
  • Compiler : gcc-9.3.0

Possible fixes

  1. In nonUniformTable::index, use maybe
      if (T >= Trange_.min() && T <= Trange_.max())                                                  
      {                                                                                              
          nd = (T - Trange_.min())/deltaT_;                                                          
      }                                                                                              
      else if (T > Trange_.max())                                                                    
      {                                                                                              
          nd = (Trange_.max() - Trange_.min())/deltaT_;                                              
      }                                                                                              
      else if (T < Trange_.min())                                                                    
      {                                                                                              
          nd = 0;                                                                                    
      }   

instead of

      if (T > Trange_.min() || T < Trange_.max())                                    
      {                                                                              
          nd = (T - Trange_.min())/deltaT_;                                          
      }                                                                              
      else if (T > Trange_.max())                                                    
      {                                                                              
          nd = (Trange_.max() - Trange_.min())/deltaT_;                              
      } 

lines 40-47 of nonUniformTableThermophysicalFunctionI.H.

As the code stands, if T < Trange_.min, the first branch will give a negative nd value.

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

lines 69-70 of integratedNonUniformTable.C.

since intf_[i-1] and intfByT_[i-1] are already added in the intfdT and intfByTdT functions.

Assignee
Assign to
Time tracking