gmsh fails on simple cube

About the development of the FEM module/workbench.

Moderator: bernd

wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

gmsh fails on simple cube

Post by wingman »

# dnf list freecad
freecad.x86_64 1:0.19.2-1.fc34

OS: Fedora 34 (Workstation Edition) (KDE/plasmax11)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.Unknown
Build type: Unknown
Python version: 3.9.4
Qt version: 5.15.2
Coin version: 4.0.0a
OCC version: 7.5.0
Locale: English/United States (en_US)

I'm using the gmsh included with FreeCAD. If I install gmsh on my computer and try gmsh from within FreeCAD, the program crashes without any warning.
# dnf list gmsh
Available Packages
gmsh.x86_64 4.7.1-2.fc34


Steps to reproduce:

New file
New part
New body
Select Part Design workbench
Draw a cube
Select FEM
Select New Analysis
Select Material. Select a steel, select the cube as a body.
Set force constraints on the cube, or not
Select a face of the cube
Select GMesh Icon
Select From Shape
Max, Min element sizes = 0.0
Select Apply

The FreeCAD source file is attached below.



In the Gmsh Task window:

Code: Select all

0.0: We are going to start ...
0.0: Start Gmsh ...
0.0: Gmsh had warnings ...
0.0: Error executing: gmsh - /tmp/fcfem_j83785sd/shape2mesh.geo 
0.0: Gmsh done!
In Report View:

Code: Select all

13:03:52  Active analysis found: Analysis
13:03:56  Active analysis found: Analysis
13:03:56    ElementDimension: 3
13:03:56    [b]No Group meshing for analysis.[/b]
13:03:56    /tmp/fcfem_j83785sd/Box_Geometry.brep
13:03:56    /tmp/fcfem_j83785sd/Box_Mesh.unv
13:03:56    /tmp/fcfem_j83785sd/shape2mesh.geo
13:03:56    gmsh
13:03:56  Error executing: gmsh - /tmp/fcfem_j83785sd/shape2mesh.geo
13:03:56  No mesh was created.
13:03:56  Gmsh had warnings ...
13:03:56  Error executing: gmsh - /tmp/fcfem_j83785sd/shape2mesh.geo
/tmp/fcfem_j83785sd/shape2mesh.geo:

Code: Select all

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

// open brep geometry
Merge "/tmp/fcfem_j83785sd/Box_Geometry.brep";

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

// optimize the mesh
Mesh.Optimize = 1;
Mesh.OptimizeNetgen = 0;
Mesh.HighOrderOptimize = 0;  // for more HighOrderOptimize parameter check http://gmsh.i>

// mesh order
Mesh.ElementOrder = 2;
Mesh.SecondOrderLinear = 0; // Second order nodes are created by linear interpolation in>

// 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=Front>
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 "/tmp/fcfem_j83785sd/Box_Mesh.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 Gms>
//
// to see full Gmsh log, run in bash:
// gmsh - /tmp/fcfem_j83785sd/shape2mesh.geo
//
// to run Gmsh and keep file in Gmsh GUI (with log), run in bash:
// gmsh /tmp/fcfem_j83785sd/shape2mesh.geo
****************************************************************************************************************
Attachments
FEM Test.FCStd
(8.8 KiB) Downloaded 80 times
Last edited by wingman on Wed Sep 29, 2021 10:10 pm, edited 3 times in total.
Laurie Hartley
Posts: 526
Joined: Mon Feb 27, 2017 5:33 am
Location: Australia

Re: gmsh fails on simple cube. Linux, FreeCAD-0.19...

Post by Laurie Hartley »

wingman wrote: Mon Sep 27, 2021 8:54 pm I'm using the gmsh included with FreeCAD. If I install gmsh on my computer and try gmsh from within FreeCAD, the program crashes without any warning.
Hello Wingman - you probably should have started a separate thread to find a solution to your problem. Bernd may well do that for you. However in the meantime I had a similar issue on my new Linux laptop so perhaps you may find this thread and the solution achieved useful:

https://forum.freecadweb.org/viewtopic. ... 98#p522998
wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

Re: Request for help meshing and and analysing a part

Post by wingman »

Thanks for the advice and link, Laurie. I'll test using an external gmsh and report what transpires.
wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

Re: Request for help meshing and and analysing a part

Post by wingman »

I installed gmsh on my computer.
$ gmsh --version
4.7.1
$which gmsh
/usr/bin/gmsh

I installed the path into Edit->Preferences->FEM->Gmsh->binary path and deselected Search in known binary directories.

Good news: FreeCAD doesn't crash anymore.
Bad news: it doesn't generate a mesh
Good news: it returns a different warning in Report View:

Code: Select all

16:26:45  Active analysis found: Analysis
16:26:47  Active analysis found: Analysis
16:26:47    ElementDimension: 3
16:26:47    Group meshing for analysis is set to true in FEM General Preferences. Are you really sure about this? You could run into trouble!
16:26:47    {'MaterialSolid': ['Solid1']}
16:26:47    /tmp/fcfem_inkyjvun/Box_Geometry.brep
16:26:47    /tmp/fcfem_inkyjvun/Box_Mesh.unv
16:26:47    /tmp/fcfem_inkyjvun/shape2mesh.geo
16:26:47    /usr/bin/gmsh

16:26:47  Error executing: /usr/bin/gmsh
 - /tmp/fcfem_inkyjvun/shape2mesh.geo
16:26:47  No mesh was created.
16:26:47  Gmsh had warnings ...
16:26:47  Error executing: /usr/bin/gmsh
 - /tmp/fcfem_inkyjvun/shape2mesh.geo
 
Where does one set the group meshing option ?
In Model->Analysis -> FEMMeshGmsh->Data there is a field named Mesh Group List. Right now it is blank. If I press the ... button, objects appear. Also note that Fem Mesh says 0 nodes, edges... groups.

Is this a user error, a FreeCAD error or a gmsh error ?
Last edited by wingman on Wed Sep 29, 2021 6:40 pm, edited 1 time in total.
wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

problems with gmsh

Post by wingman »

I installed gmsh-4.8.4 from the gmsh website.

When I run it, I receive the following in Report View

Code: Select all

16:41:10  Active analysis found: Analysis
16:41:10    ElementDimension: 3
16:41:10    Group meshing for analysis is set to true in FEM General Preferences. Are you really sure about this? You could run into trouble!
16:41:10    {'MaterialSolid': ['Solid1']}
16:41:10    /tmp/fcfem_hi8tn67s/Box_Geometry.brep
16:41:10    /tmp/fcfem_hi8tn67s/Box_Mesh.unv
16:41:10    /tmp/fcfem_hi8tn67s/shape2mesh.geo
16:41:10    /home/me/Downloads/gmsh-4.8.4-Linux64/bin/
16:41:10  Error executing: /home/me/Downloads/gmsh-4.8.4-Linux64/bin/ - /tmp/fcfem_hi8tn67s/shape2mesh.geo
16:41:10  No mesh was created.
16:41:10  Gmsh had warnings ...
16:41:10  Error executing: /home/me/Downloads/gmsh-4.8.4-Linux64/bin/ - /tmp/fcfem_hi8tn67s/shape2mesh.geo
In Edit->Preferences->FEM-General, the Create mesh groups for analysis reference shapes (highly experimental) option is both checked and greyed out. I cannot un check it.
Last edited by wingman on Wed Sep 29, 2021 6:39 pm, edited 1 time in total.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: gmsh fails on simple cube. Linux, FreeCAD-0.19...

Post by -alex- »

Laurie Hartley wrote: Mon Sep 27, 2021 9:38 pm Hello Wingman - you probably should have started a separate thread to find a solution to your problem.
+1

@Wingman, please do not hijack this thread.
wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

Re: Request for help meshing and and analysing a part

Post by wingman »

I'll move my posts later tonight. I thought this was the appropriate thread.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: gmsh fails on simple cube

Post by bernd »

I moved all your posts in a separate topic.

Would you use code tags for long log prints in a post? like this .... https://forum.freecadweb.org/viewtopic. ... 20#p517783
Laurie Hartley
Posts: 526
Joined: Mon Feb 27, 2017 5:33 am
Location: Australia

Re: problems with gmsh

Post by Laurie Hartley »

wingman wrote: Mon Sep 27, 2021 10:43 pm I installed gmsh-4.8.4 from the gmsh website.

16:41:10 Error executing: /home/me/Downloads/gmsh-4.8.4-Linux64/bin/ - /tmp/fcfem_hi8tn67s/shape2mesh.geo
16:41:10 No mesh was created.
16:41:10 Gmsh had warnings ...
16:41:10 Error executing: /home/me/Downloads/gmsh-4.8.4-Linux64/bin/ - /tmp/fcfem_hi8tn67s/shape2mesh.geo
Have you tried copying the download file into your opt folder, and extracting it there.

“Copied and extracted it into the opt folder.
Set the path in FEM - Gmsh preferences to /opt/gmsh-4.8.4-Linux64/bin/gmsh.”
wingman
Posts: 36
Joined: Sun Feb 09, 2020 12:28 pm

Re: gmsh fails on simple cube

Post by wingman »

bernd wrote: Tue Sep 28, 2021 9:48 am I moved all your posts in a separate topic.
Thank you. Sorry, I got busy with another part of the project.
Would you use code tags for long log prints in a post? like this .... https://forum.freecadweb.org/viewtopic. ... 20#p517783
OK.
Post Reply