Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quadratic tet meshing causes python to crash! #42

Open
1 task done
SimonCom opened this issue Jul 12, 2022 · 5 comments
Open
1 task done

Quadratic tet meshing causes python to crash! #42

SimonCom opened this issue Jul 12, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@SimonCom
Copy link

SimonCom commented Jul 12, 2022

Describe the bug, what's wrong, and what you expected.

Tetgen tetrahedralization with quadratic elements causes Python to crash on surface meshes with concave structures (e.g. a hole), although linear meshing works.

Steps to reproduce the bug.

import pyvista
import pyacvd
import pymeshfix
import tetgen

cyl = pyvista.Cylinder()
cylScale = cyl.scale([2,0.5,0.5]).triangulate()
sphere = pyvista.Sphere()
sphereCut = sphere.boolean_difference(cylScale)

clus = pyacvd.Clustering(sphereCut)
clus.subdivide(3)
clus.cluster(sphereCut.n_points)
remesh = clus.create_mesh()

clus2 = pyacvd.Clustering(remesh)
clus2.subdivide(2)
clus2.cluster(1000)
remesh2 = clus2.create_mesh()

fixer = pymeshfix.MeshFix(remesh2)
fixer.repair()
fixMesh = fixer.mesh

tet = tetgen.TetGen(fixMesh)
tet.tetrahedralize(switches='pq1.1/20Ya0.003o2')
grid = tet.grid

### System Information
--------------------------------------------------------------------------------
  Date: Tue Jul 12 13:51:39 2022 CEST

                OS : Darwin
            CPU(s) : 4
           Machine : x86_64
      Architecture : 64bit
               RAM : 8.0 GiB
       Environment : Jupyter
       File system : apfs
        GPU Vendor : Intel Inc.
      GPU Renderer : Intel Iris OpenGL Engine
       GPU Version : 4.1 INTEL-16.5.9

  Python 3.9.12 (main, Apr  5 2022, 01:53:17)  [Clang 12.0.0 ]

           pyvista : 0.34.1
               vtk : 9.1.0
             numpy : 1.21.5
           imageio : 2.9.0
           appdirs : 1.4.4
            scooby : 0.5.12
        matplotlib : 3.5.1
             PyQt5 : 5.9.2
           IPython : 8.2.0
          colorcet : 1.0.0
             scipy : 1.7.3
              tqdm : 4.64.0
            meshio : 5.3.4

  Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904
  for Intel(R) 64 architecture applications
--------------------------------------------------------------------------------

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@SimonCom SimonCom added the bug Something isn't working label Jul 12, 2022
@akaszynski akaszynski transferred this issue from pyvista/pyvista Jul 12, 2022
@pyvista pyvista deleted a comment from github-actions bot Jul 12, 2022
@akaszynski
Copy link
Member

Looks like the default settings work:

tet = tetgen.TetGen(fixMesh)
tet.tetrahedralize()
grid = tet.grid
grid.plot(show_edges=True, background='w')

tmp

I'd play around with the parameters until you get something that works.

If you can't get it to work with your desired parameters, you may consider downgrading to tetgen==0.5.5 with:

pip install tetgen==0.5.5

I've run into issues after upgrading support for tetgen 1.6

@SimonCom
Copy link
Author

Hi Alex,

thank you very much for your answer. The default setting has always worked for me as well because it uses linear elements, but if you try to use quadratic elements with order=2 or the switch o2, Python crashes.

However, using the tetgen version 0.5.5 with some adjustments on the switches also seems to work for quadratic elements.

Thanks!
Simon

@akaszynski
Copy link
Member

However, using the tetgen version 0.5.5 with some adjustments on the switches also seems to work for quadratic elements.

There's been a request to add support for the older version of tetgen 1.5 and potentially use that as a default. There might be some fundamental issue with 1.6.

@SimonCom
Copy link
Author

Good to know, thanks Alex!

@SimonCom
Copy link
Author

Hi Alex,

I tried everything with tetgen 1.5 (python 0.5.5). Even though quadratic meshing works now (is even the default), using the C++ switches causes python to crash. And the working python inputs are limited. So for example, quality, minratio, and mindihedral work but there is no working volume control (like there would be with the switch -a followed by a number). What causes this issue and are there any intended efforts in solving this problem in the future?

Thanks for your help!
Simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants