Troubles with gmsh in FEM wb (netgen nostalgy)

Having trouble installing or compiling FreeCAD? Get help here.
oddtopus
Posts: 123
Joined: Tue Sep 20, 2016 6:17 pm

Troubles with gmsh in FEM wb (netgen nostalgy)

Postby oddtopus » Wed Apr 25, 2018 9:23 am

Hello. I'm struggling from three weeks to generate any mesh with the new mesh generator used in FEM. I guess now I need some help.
Maybe it's a matter of version of gmsh but here's what it's happening.

OS: Linux Mint 18.3 Sylvia
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.13524 (Git)
Build type: None
Branch: master
Hash: 04a7f566fe71dcad8fda92af2f467d3cc211a372
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Italian/Italy (it_IT)

First try.
Just for sample I create a cube with Part and then try to apply a simple mesh.
I installed gmsh from the repository of the linux distribution, which I know it's not updated (2.10.1) but that's the first thing to do. So I select the cube, run the command "FEM mesh from shape by Gmsh", click on Apply and then the program sticks! Also after I xkilled the graphic window of FreeCAD, gmsh continue to run in backgroud, spinning the fan of my laptop at 10000 rpm to cool it down: I have to kill separately also the process of gmsh from the terminal.
Below is the log, where I commented the point when the program starts to loop.
gmsh2.10.1fails.log
(13.93 KiB) Downloaded 40 times
Second try.
I purge the previous version of gmsh and, since it's not updated in the repository, I downloaded .deb package of version 2.15.0. Checked all the dependencies and installed. Did the same mesh sample as before and got in the console the following snappy message.

We are going to start Gmsh FEM mesh run!Msg:
Msg: Part to mesh: Name --> Box, Label --> Cubo, ShapeType --> SolidMsg:
Msg: CharacteristicLengthMax: 1e+22Msg:
Msg: CharacteristicLengthMin: 0.0Msg:
Msg: ElementOrder: 2Msg:
Msg: ElementDimension: 3Msg:
Msg: /tmp/Box_Geometry.brepMsg:
Msg: /tmp/Box_Mesh_TmpGmsh.unvMsg:
Msg: /tmp/shape2mesh.geoMsg:
Msg: /usr/bin/gmshMsg:
Msg: No Group meshing for analysis.Msg:
Msg: ('Unexpected error when creating mesh: ', <type 'exceptions.RuntimeError'>)Msg:
gmsh2.15.0fails.log
(13.33 KiB) Downloaded 29 times
Third try.
I purge also the version 2.15.0 of gmsh from the system and finally try to compile it by my own. I downladed from gitlab the 144 MB of the repository of gmsh version 3.0.7. I've been warned to include the support for OpenCASCADE while compiling and I checked that the flag ENABLE_OCC is ON by default so I run cmake->make->sudo make install and wait a long time after which I have the latest compiled gmsh file in ../bin folder.
Try to generate the mesh on the cube and... alas!

We are going to start Gmsh FEM mesh run!Msg:
Msg: Part to mesh: Name --> Box, Label --> Cubo, ShapeType --> SolidMsg:
Msg: CharacteristicLengthMax: 1e+22Msg:
Msg: CharacteristicLengthMin: 0.0Msg:
Msg: ElementOrder: 2Msg:
Msg: ElementDimension: 3Msg:
Msg: /tmp/Box_Geometry.brepMsg:
Msg: /tmp/Box_Mesh_TmpGmsh.unvMsg:
Msg: /tmp/shape2mesh.geoMsg:
Msg: /home/rtreu74/Documenti/gmsh/tempGMSH3.0.7Msg:
Msg: No Group meshing for analysis.Msg:
Msg: ('Unexpected error when creating mesh: ', <type 'exceptions.AttributeError'>)Msg:
gmsh3.0.7fails.log
(13.73 KiB) Downloaded 32 times
..then I find out that ENABLE_OCC is not the only flag that should be ON and lost myself in the forums claiming problems when compiling gmsh.

So, does anyone know the secret vodoo dance necessary to install gmsh in order to make it work with FreeCAD?
I'll be forever in debt if can give a clear word about the right steps to do.


After that, I wonder why Netgen option has been eliminated from the GUI. As I could understand from other posts, several users were familiar with Netgen mesh generator and found similar problems in using gmsh.
I can understand gmsh may offer more choices (1D and 2D) but maybe the Netgen option can be still provided in the daily-builds and also in the stable release for those who prefer that, without the need to compile each time a customized version of FC.
looo
Posts: 2749
Joined: Mon Nov 11, 2013 5:29 pm

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby looo » Wed Apr 25, 2018 9:32 am

I use this setup for gmsh 3.0.6 and it works with FreeCAD.
https://github.com/FreeCAD/FreeCAD_Cond ... h/build.sh

edit: I guess netgen will come back to freecad sooner or later. There is a gsoc project aiming to solve this. Another alternitive is using conda.
oddtopus
Posts: 123
Joined: Tue Sep 20, 2016 6:17 pm

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby oddtopus » Wed Apr 25, 2018 3:03 pm

Thanks for this advice. It seems exactly what I needed.
Only, what is the variable $PREFIX on the first line of the script? I didn't find it in my env, or at least it's null.
Shall I prepare the env for ninja install before running the script?
looo
Posts: 2749
Joined: Mon Nov 11, 2013 5:29 pm

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby looo » Wed Apr 25, 2018 3:13 pm

$PREFIX is a variable from conda. You can remove it for a std install. you can also remove the ninja stuff. I use ninja only for consitency with other plattforms.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby NormandC » Wed Apr 25, 2018 5:00 pm

oddtopus wrote:
Wed Apr 25, 2018 9:23 am
After that, I wonder why Netgen option has been eliminated from the GUI.
It was explained in this post that was pinned at the top of this forum for more than a year until a couple of weeks ago.

Ubuntu Daily Builds PPA now using OCC 7.1.0

Unfortunately, packaging a newer version of netgen proved difficult. And unfortunately the people who came to provide help didn't complete the work fully. So the regular packagers who wear many hats already (mainly sgrogan and myself second) are the ones left to try to complete the job.

We will gladly welcome your help if you're willing to finish the netgen packaging.
User avatar
bernd
Posts: 8242
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby bernd » Sat Apr 28, 2018 1:41 pm

open the geo file which is created by FreeCAD. At the end of the file the is the bash comand to run Gmsh standalone without FreeCAD. Does it work for you? If not, open Gmsh Gui, in Gmsh open the brep file from the same directory as the geo file and try to mesh it. Does it work?

If netgen is disabled in Gui, FreeCAD was not compiled with Netgen. You could compile FreeCAD yourself to get Netgen mesh.

bernd
oddtopus
Posts: 123
Joined: Tue Sep 20, 2016 6:17 pm

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby oddtopus » Sat Apr 28, 2018 2:07 pm

Hi bernd,
open the geo file which is created by FreeCAD.
FC stuck before generating any .geo file (at least in the folder where the .fcstd file is located. I don't know if it saves it in other folders such as /var). What should the command look like?

Anyway I did run gmsh standalone (2.10.1) and its GUI works: I can open .geo files, create meshes and so on. I tryed already to generate a mesh and saved it as STL, but when I reopen it in FC it does not show the mesh but just the surfaces.

I'll try (now I must run away) to export brep from FreeCAD to generate the mesh, but how to import it back? In what format?

I'll let you know tomorrow. Thanks.
Jee-Bee
Posts: 1942
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby Jee-Bee » Sat Apr 28, 2018 3:18 pm

It depends partly on you're settings. In the FEM settings you can choose where the to store the files.
  • Temperay location
  • beside fcstd file
  • custom directory
But in my experience on windows still it export the file to the temporary folders...
User avatar
bernd
Posts: 8242
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby bernd » Sat Apr 28, 2018 3:24 pm

geo and brep files for gmsh are save in system temporary systemfolder. Location is printed during gmesh run in FreeCAD in FreeCAD report window.
User avatar
bernd
Posts: 8242
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Troubles with gmsh in FEM wb (netgen nostalgy)

Postby bernd » Sat Apr 28, 2018 3:25 pm

FOr you it is /tmp ... See your first post of this topic