GMSH plugin doesn't generate mesh [SOLVED]

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
kamocat
Posts: 17
Joined: Mon Jul 11, 2022 10:39 pm

GMSH plugin doesn't generate mesh [SOLVED]

Post by kamocat »

Hi All,

I'm having trouble generating FEM meshes in FreeCAD.

Steps to reproduce:
Create a cube from the Design workspace.
Select the cube and create a mesh from the "FEM Mesh from shape by GMSH" button in the FEM workspace.
An empty mesh is created.

There's another variation:
Create a cube
Change the height to 1mm.
Select the Cube and create a mesh with GMSH.
A very strange mesh is created. (I added transparency to the Cube for clarity)
A very strange mesh is created. (I added transparency to the Cube for clarity)
bad mesh.png (34.72 KiB) Viewed 1439 times
Save the file.
Close the file.
Open the file.
The mesh is empty. (The file size also decreases from 38.3kiB to 6.2kiB, so I think the mesh gets deleted because FreeCAD realizes it's invalid)

I'm pretty sure that GMSH works, because I can create meshes without issue and import them into ElmerGUI.

Here's my system info:
OS: Arch Linux (Budgie:GNOME/Budgie Desktop)
Word size of FreeCAD: 64-bit
Version: 0.20.31245 (Git)
Build type: Release
Branch: makepkg
Hash: 096210d21183e9dfdc3b25777760bfb6c00a210b
Python version: 3.10.5
Qt version: 5.15.5
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)
Attachments
bad mesh.FCStd
(38.29 KiB) Downloaded 24 times
Last edited by kamocat on Tue Jul 12, 2022 2:37 pm, edited 1 time in total.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GMSH plugin doesn't generate mesh

Post by uwestoehr »

kamocat wrote: Mon Jul 11, 2022 11:02 pm Word size of FreeCAD: 64-bit
Version: 0.20.31245 (Git)
This is wrong because FreeCAD is at

Code: Select all

Version: 0.21.29487
And your version info does not include the VTK version.

Therefore please install a valid FreeCAD, if possible the plain FreeCAD 0.20 release, no development build.
You need at least Gmsh 4.8. For VTK if possible avoid VTK 9.x, if this is no option, use the latest VTK 9.x version you can get.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GMSH plugin doesn't generate mesh

Post by bernd »

Have you seen and read the "small" red box above the forum? ;)
image843.png
image843.png (12.11 KiB) Viewed 1379 times
kamocat
Posts: 17
Joined: Mon Jul 11, 2022 10:39 pm

Re: GMSH plugin doesn't generate mesh

Post by kamocat »

Thanks. I didn't realize that the nightly builds were incomplete.
I'm on the regular appimage and gmsh works fine now.

Code: Select all

OS: Arch Linux (Budgie:GNOME/Budgie Desktop)
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20)
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.9.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: English/United States (en_US)
User avatar
samudge
Posts: 16
Joined: Fri Nov 19, 2021 11:45 am

Re: GMSH plugin doesn't generate mesh [SOLVED]

Post by samudge »

I experienced this same issue when compiling on Linux (and Windows) with:

* FreeCAD 0.20
* VTK 9
* Internal SMESH

The issue is with the now old (~version 7) internal SMESH module. It is not compatible with VTK 9. If you compile with external SMESH enabled (and build and install the SMESH project on github) in the CMake settings, it fixes the issue. However, the default CMake scripts for the external SMESH setting do not work. They are not fully implemented.

This PR I made (at least for the realthunder fork, but it should work the same on the main fork) fixes the external SMESH mode, and this issue goes away on my machine when compiling against VTK 9.

https://github.com/realthunder/FreeCAD/pull/522
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GMSH plugin doesn't generate mesh [SOLVED]

Post by bernd »

BTW: In FEM gmsh only uses unv importer of internal smesh. I would assume the problem ist on unv import ...

But what has VTK9 to do with meshing? IMHO VTK is used for postprocessing only.

strange ...

Which version of gmsh was used?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: GMSH plugin doesn't generate mesh [SOLVED]

Post by wmayer »

Some time ago we already had a problem with broken meshes when using VTK9 and the internal SMESH. The problem has been reported here: issue #6553 (forum thread: https://forum.freecadweb.org/viewtopic.php?f=18&t=66948) and its confirmed fix git commit d60dd085b
samudge wrote: Mon Aug 01, 2022 9:44 am I experienced this same issue when compiling on Linux (and Windows) with:

* FreeCAD 0.20
* VTK 9
* Internal SMESH
Could it be that your FreeCAD build is by far too old? If you have a fairly recent build but it still fails then double check that VTK_CELL_ARRAY_V2 is defined in SMDS_UnstructuredGrid.cpp. What's also possible is that you have encountered a different problem. In this case it would be good if you could upload your original mesh file (.unv format or similar) as the FCStd file of the OP is of no help here.
The issue is with the now old (~version 7) internal SMESH module. It is not compatible with VTK 9.
The problem with unstructured grid is the internal representation of the IDs in the old and new VTK version.
bernd wrote: Tue Aug 02, 2022 8:01 pm But what has VTK9 to do with meshing? IMHO VTK is used for postprocessing only.
Inside FreeCAD VTK is only used for post-processing but SMESH makes heavy use of it, too.
Post Reply