Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 426
    • Issues 426
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #1777
Closed
Open
Issue created Jul 16, 2020 by Philip Cardiff@philipc

primitiveMesh::pointInCell(const point& p, label celli) may fail on non-convex cells

Summary

Steps to reproduce

The function primitiveMesh::pointInCell(const point& p, label celli) may fail on non-convex cells i.e. if p is inside the cell, this function may return false if the cell is non-convex.

I understand that OpenFOAM expects convex cells but there are cases where slightly convex cells can be used without introducing significant errors.

Example case

Consider a mesh with one non-convex hexahedral cell, and the coordinates (given in blockMesh compatible ordering): (0 0 0) (1 0 0) (0.2 0.2 0) (0 1 0) (0 0 1) (1 0 1) (0.2 0.2 1) (0 1 1)

The point (0.3 0.1 0.5) is within the cell, but pointInCell will return false.

What is the current bug behaviour?

Valid points are incorrectly characterised as outside the cell.

What is the expected correct behavior?

Valid points should be correctly characterised as inside the cell.

Relevant logs and/or images

N/A

Environment information

  • OpenFOAM version : ALL
  • Operating system : N/A
  • Hardware info : N/A
  • Compiler : N/A

Possible fixes

I can think of at least two fixes:

  1. Print a warning if there are non-convex cells letting the user know that this function may fail

  2. Create a pointInNonConvexCell function, for example, using an algorithm like the one described here https://stackoverflow.com/questions/44513525/testing-whether-a-3d-point-is-inside-a-3d-polyhedron

I have implemented 2 in pointInNonConvexCell.C and it works on the test cases I have tried.

Assignee
Assign to
Time tracking