Gmsh class 'RuntimeError'

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
JeanPierreLumiere
Posts: 14
Joined: Fri Mar 29, 2019 4:30 am

Gmsh class 'RuntimeError'

Postby JeanPierreLumiere » Thu Aug 29, 2019 11:18 am

Hello everyone,

To begin thanks to the community, for allowing me the use of a cool CAD Software and the possibility to post here.


OS: Ubuntu 18.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.3.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/Switzerland (fr_CH)

I made an Object and made a simple copy of it for the FEM analysis (I attached it here).
I try to create the mesh:

Code: Select all

We are going to start Gmsh FEM mesh run!
  Part to mesh: Name --> Fusion001,  Label --> Pont-5.5mm-8mm-10mm, ShapeType --> Compound
  CharacteristicLengthMax: 1e+22
  CharacteristicLengthMin: 0.0
  ElementOrder: 2
  ElementDimension: 3
  /tmp/Fusion001_Geometry.brep
  /tmp/Fusion001_Mesh_TmpGmsh.unv
  /tmp/shape2mesh.geo
  /usr/bin/gmsh
  No Group meshing for analysis.
Unexpected error when creating mesh:  <class 'RuntimeError'>
I think the error is von Gmesh.

Do you have any idea?

Thank you again.
Attachments
MyObject.FCStd
object_Gmesh_RuntimeError
(71.99 KiB) Downloaded 25 times
UR_
Posts: 1153
Joined: Tue Jan 03, 2017 8:42 pm

Re: Gmesh class 'RuntimeError'

Postby UR_ » Thu Aug 29, 2019 1:37 pm

These two parts are not fused, just compounded. :o
Therefore meshes will not be connected properly.

Screenshot 006.png
Screenshot 006.png (35.8 KiB) Viewed 1197 times
User avatar
JeanPierreLumiere
Posts: 14
Joined: Fri Mar 29, 2019 4:30 am

Re: Gmesh class 'RuntimeError'

Postby JeanPierreLumiere » Fri Aug 30, 2019 8:29 pm

It does the same with 1 Part of 1 Solid, I upload the file.

Code: Select all

We are going to start Gmsh FEM mesh run!
  Part to mesh: Name --> Connect001,  Label --> Connect001, ShapeType --> Compound
  CharacteristicLengthMax: 17.0
  CharacteristicLengthMin: 3.0
  ElementOrder: 2
  ElementDimension: 3
  /tmp/Connect001_Geometry.brep
  /tmp/Connect001_Mesh_TmpGmsh.unv
  /tmp/shape2mesh.geo
  /usr/bin/gmsh
  No Group meshing for analysis.
Unexpected error when creating mesh:  <class 'RuntimeError'>
Attachments
My2ndObject.FCStd
Failed again to create a Mesh
(64.29 KiB) Downloaded 24 times
UR_
Posts: 1153
Joined: Tue Jan 03, 2017 8:42 pm

Re: Gmesh class 'RuntimeError'

Postby UR_ » Fri Aug 30, 2019 9:03 pm

bernd wrote: *ping*
bernd, there is a little regression :shock:
Please see line 4 of shape2mesh.geo

Code: Select all

// geo file for meshing with Gmsh meshing software created by FreeCAD

// open brep geometry
Merge  + self.temp_file_geometry + ;

// Characteristic Length
// no boundary layer settings for this mesh
// min, max Characteristic Length
Mesh.CharacteristicLengthMax = 5.0;
Mesh.CharacteristicLengthMin = 0.0;

// optimize the mesh
Mesh.Optimize = 1;
Mesh.OptimizeNetgen = 0;
Mesh.HighOrderOptimize = 0;  // for more HighOrderOptimize parameter check http://gmsh.info/doc/texinfo/gmsh.html

// mesh order
Mesh.ElementOrder = 1;

// mesh algorithm, only a few algorithms are usable with 3D boundary layer generation
// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad)
Mesh.Algorithm = 2;
// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree)
Mesh.Algorithm3D = 1;

// meshing
Geometry.Tolerance = 1e-06; // set geometrical tolerance (also used for merging nodes)
Mesh  3;
Coherence Mesh; // Remove duplicate vertices

// save
Mesh.Format = 2;
// Ignore Physical definitions and save all elements;
Mesh.SaveAll = 1;
Save "C:\Users\aio\AppData\Local\Temp\Connect001_Mesh_TmpGmsh.unv";


//////////////////////////////////////////////////////////////////////
// Gmsh documentation:
// http://gmsh.info/doc/texinfo/gmsh.html#Mesh
//
// We do not check if something went wrong, like negative jacobians etc. You can run Gmsh manually yourself: 
//
// to see full Gmsh log, run in bash:
// C:/Program Files/FEMbinpack/bin/gmsh_4.4.1.exe - C:\Users\aio\AppData\Local\Temp\shape2mesh.geo
//
// to run Gmsh and keep file in Gmsh GUI (with log), run in bash:
// C:/Program Files/FEMbinpack/bin/gmsh_4.4.1.exe C:\Users\aio\AppData\Local\Temp\shape2mesh.geo

done with:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18009 (Git)
Build type: Release
Branch: master
Hash: 0641ca0d1e020d18f23d2adb49959195266f04f7
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
UR_
Posts: 1153
Joined: Tue Jan 03, 2017 8:42 pm

Re: Gmesh class 'RuntimeError'

Postby UR_ » Fri Aug 30, 2019 9:11 pm

Nice mesh with netgen meanwhile :roll:

Screenshot 001.png
Screenshot 001.png (137.21 KiB) Viewed 1153 times
========================== Dump contents of mesh ==========================

1) Total number of nodes: 43074
2) Total number of edges: 5735
3) Total number of faces: 61880
4) Total number of polygons: 0
5) Total number of volumes: 161411
6) Total number of polyhedrons: 0

7) Total number of linear edges: 5735
8) Total number of linear faces: 61880
8.1) Number of linear triangles: 61880
8.2) Number of linear quadrangles: 0
9) Total number of linear volumes: 161411
9.1) Number of linear hexahedrons: 0
9.2) Number of linear tetrahedrons: 161411
9.3) Number of linear prisms: 0
9.4) Number of linear pyramids: 0

10) Total number of quadratic edges: 0
11) Total number of quadratic faces: 0
12) Total number of quadratic volumes: 0

===========================================================================
UR_
Posts: 1153
Joined: Tue Jan 03, 2017 8:42 pm

Re: Gmesh class 'RuntimeError'

Postby UR_ » Fri Aug 30, 2019 9:23 pm

Nice mesh with Gmsh 4.4.1 too

Screenshot 002.png
Screenshot 002.png (12.46 KiB) Viewed 1150 times
Screenshot 003.png
Screenshot 003.png (21.11 KiB) Viewed 1150 times
Screenshot 004.png
Screenshot 004.png (175.69 KiB) Viewed 1150 times
========================== Dump contents of mesh ==========================

1) Total number of nodes: 19616
2) Total number of edges: 3616
3) Total number of faces: 35644
4) Total number of polygons: 0
5) Total number of volumes: 63283
6) Total number of polyhedrons: 0

7) Total number of linear edges: 3616
8) Total number of linear faces: 35644
8.1) Number of linear triangles: 35644
8.2) Number of linear quadrangles: 0
9) Total number of linear volumes: 63283
9.1) Number of linear hexahedrons: 0
9.2) Number of linear tetrahedrons: 63283
9.3) Number of linear prisms: 0
9.4) Number of linear pyramids: 0

10) Total number of quadratic edges: 0
11) Total number of quadratic faces: 0
12) Total number of quadratic volumes: 0

===========================================================================

UR_
Posts: 1153
Joined: Tue Jan 03, 2017 8:42 pm

Re: Gmesh class 'RuntimeError'

Postby UR_ » Sat Aug 31, 2019 5:40 am

bernd wrote: *ping*
Hello bernd,
can you please commit this tiny diff file. Thanks!

gmshtools.diff.zip
(393 Bytes) Downloaded 18 times

Code: Select all

diff U C:/Users/aio/Miniconda3/envs/freecad-dev/Library/Mod/Fem/femmesh/gmshtools.py C:/Users/aio/Desktop/gmshtools.py
--- C:/Users/aio/Miniconda3/envs/freecad-dev/Library/Mod/Fem/femmesh/gmshtools.py	Sat Aug 31 07:25:09 2019
+++ C:/Users/aio/Desktop/gmshtools.py	Thu Aug 29 08:32:40 2019
@@ -564 +564 @@
-        geo.write("Merge " + "'" + str(self.temp_file_geometry) + "'"+ ";\n")
+        geo.write("Merge "" + self.temp_file_geometry + "";\n")
User avatar
JeanPierreLumiere
Posts: 14
Joined: Fri Mar 29, 2019 4:30 am

Re: Gmesh class 'RuntimeError'

Postby JeanPierreLumiere » Sat Aug 31, 2019 6:06 am

Yes! Thanks UR_!

Image

It works with Gmesh 3.0.6.

But why? Why doing a 3d mesh works and not with shape?
What is the difference?
Until now I had done everything with Shape.

Yesterday I tried a shape mesh without the thin-wall tubes between the two plates and it worked. So I guess it came from the thin-wall tubes.

Bernd told me once it could cause problems because the difference was too big between the overall geometry and the wall thickness.
So I also tried FEM - Tubular Connection with Shell Elements but then I obtained a mesh without Volume.
I don't really know if I can use that here because I don't have only thin-wall tubes but also full 6mm plates.

Thx
Attachments
OUIII.png
OUIII.png (27.04 KiB) Viewed 1125 times
User avatar
bernd
Posts: 9003
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Gmesh class 'RuntimeError'

Postby bernd » Sat Aug 31, 2019 6:04 pm

In the regard of gmsh class. I will have a look when I am back on a computer. ATM I am a camping site on the river rhein for a few days without any computer.
User avatar
bernd
Posts: 9003
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Gmesh class 'RuntimeError'

Postby bernd » Sat Aug 31, 2019 6:06 pm

ahh nice meshes guys. what is it?