gmsh generating invalid mesh

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
mac_the_bike
Posts: 42
Joined: Sun Jun 30, 2019 12:56 pm

gmsh generating invalid mesh

Post by mac_the_bike »

I have just installed new versions of Ubuntu and freecad.

I am having problems with meshing geometry.

If I follow these steps, a mesh is generated but it is a bit strange, see the attachment.
  • create new Application
  • goto Part WB
  • insert a Cube
  • goto FEM WB
  • detect on cube and generate mesh using gmsh
    set the min element size to 1.

ubuntu version 22.04 LTS, 64 bit

freecad version FreeCAD 0.19 Revision:
installed using apt

gmsh version 4.8.0
installed using apt
in Edit->Preferences->FEM->Gmsh I have explicitly supplied the path as: /usr/bin/gmsh

The following questions arise:

Is gmsh working properly?

and/or

Is freecad not generating the correct data for gmsh?

Can anybody supply a gmsh input file that would have been created by freecad so that I can check that gmsh is working correctly?

Thanks for your help!!
Attachments
gmsh.png
gmsh.png (161.23 KiB) Viewed 1276 times
User avatar
NewJoker
Veteran
Posts: 3016
Joined: Sun Oct 11, 2020 7:49 pm

Re: gmsh generating invalid mesh

Post by NewJoker »

Try using the newest 0.20 version which will be released soon and is currently available from here: https://github.com/FreeCAD/FreeCAD-Bund ... kly-builds

Also, please always paste the About FreeCAD data so that we know exactly which version of FreeCAD and OS you are using.
user1234
Veteran
Posts: 3328
Joined: Mon Jul 11, 2016 5:08 pm

Re: gmsh generating invalid mesh

Post by user1234 »

When i look in your screenshot, there is written 0.19x. And since you are using Ubuntu 22.04, you are probatly using VTK9.x. FEM in FreeCAD 0.19.x is not compatible with VTK9.x. This is fixed in the FreeCAD 0.20master, see https://forum.freecad.org/viewtopic.php?t=66948


So as NewJocker said, use the newest FreeCAD 0.20 you get.

Greetings
user1234
mac_the_bike
Posts: 42
Joined: Sun Jun 30, 2019 12:56 pm

Re: gmsh generating invalid mesh

Post by mac_the_bike »

NewJoker and user1234 -
Thanks for your speedy help.

The link that user1234 gives a good background to the problem.

I will download the V20 AppImage and see what happens.

Where do I find: About FreeCAD?

Thanks.
david69
Veteran
Posts: 1773
Joined: Wed Jan 01, 2014 7:48 pm

Re: gmsh generating invalid mesh

Post by david69 »

you can find the latest version on this page
https://www.freecad.org/downloads.php

scroll down and pick up the one corresponding to your OS. Development versions

next time, provide your FreeCAD's information. refer to the red ribbon of this forum. thanks.
User avatar
NewJoker
Veteran
Posts: 3016
Joined: Sun Oct 11, 2020 7:49 pm

Re: gmsh generating invalid mesh

Post by NewJoker »

mac_the_bike wrote: Fri May 27, 2022 11:10 am Where do I find: About FreeCAD?
In FreeCAD go to Help --> About FreeCAD, click Copy to clipboard and paste that in your post on the forum.
mac_the_bike
Posts: 42
Joined: Sun Jun 30, 2019 12:56 pm

Re: gmsh generating invalid mesh

Post by mac_the_bike »

Mon 30 May 12:43:02 BST 2022

Thanks for you help.

I have downloaded the AppImage and after installing "fuse" it works. The problems below don't appear when the AppImage is run.

I downloaded the source for Version 20 and compiled it. This works. But the following messages are output:

12:37:06 Could not import QtNetwork -- it does not appear to be installed on your system. Please install the package 'python3-pyside2.qtnetwork' on your system and if possible contact your FreeCAD package maintainer to alert them to the missing dependency. The Addon Manager will not be available.
12:37:06 Addon Manager Warning: Could not import QtWebEngineWidgets, it seems to be missing from your system. Please use your system's package manager to install the python3-pyside2.qtwebengine* and python3-pyside2.qtwebchannel packages, and if possible alert your package creator to the missing dependency. Display of package README will be limited until this dependency is resolved.

I have put these in for information. I have installed the requested packages.

I have written some code which is part of the FEM WB, which works in Version 18. I have merged this code into Version 20 and then compiled, without errors. When I run this code I get the following error message:
FreeCAD: /home/peter/freecad-source/src/Base/BaseClass.cpp:92: static void Base::BaseClass::initSubclass(Base::Type&, const char*, const char*, Base::Type::instantiationMethod): Assertion `toInit == Base::Type::badType()' failed.

How can this be corrected?

I am now going to give some comments on Version 20.
  • 1. CAN'T SET THE "EigenModeLowLimit" TO A NEGATIVE NUMBER:
I generated a model with no earthing in order to perform a vibration analysis, it should have 6 rigid body modes. Running a vibration analysis is a good way checking that the model doesn't contain internal constraints or mechanisms, like hinges. Requesting 7 modes and "EigenModeLowLimit" of 0, I get the following output:

Code: Select all

                            
 MODE NO    EIGENVALUE                       FREQUENCY         
                                     REAL PART            IMAGINARY PART
                           (RAD/TIME)      (CYCLES/TIME     (RAD/TIME)
      3   0.1490848E-03   0.1221003E-01   0.1943287E-02   0.0000000E+00
      4   0.3091320E-03   0.1758215E-01   0.2798286E-02   0.0000000E+00
      5   0.7177820E-03   0.2679145E-01   0.4263992E-02   0.0000000E+00
      6   0.1057586E-02   0.3252055E-01   0.5175806E-02   0.0000000E+00
      7   0.8644606E+12   0.9297638E+06   0.1479765E+06   0.0000000E+00
This is not really helpful as there are 2 modes that are not output. What I want to do now is set the "EigenModeLowLimit" to a negative number in the Combo view but this is not possible. The solution is to edit the ".inp" file and changing the entry in the "*FREQUENCY" section setting the " -3, thus:
7,-3.0,1000000.0

I now get the following output:

Code: Select all

                               
 MODE NO    EIGENVALUE                       FREQUENCY         
                                     REAL PART            IMAGINARY PART
                           (RAD/TIME)      (CYCLES/TIME     (RAD/TIME)
      1  -0.9778327E-03   0.0000000E+00   0.0000000E+00   0.3127032E-01
      2  -0.1928038E-03   0.0000000E+00   0.0000000E+00   0.1388538E-01
      3   0.1490848E-03   0.1221003E-01   0.1943287E-02   0.0000000E+00
      4   0.3091320E-03   0.1758215E-01   0.2798286E-02   0.0000000E+00
      5   0.7177820E-03   0.2679145E-01   0.4263992E-02   0.0000000E+00
      6   0.1057586E-02   0.3252055E-01   0.5175806E-02   0.0000000E+00
      7   0.8644606E+12   0.9297638E+06   0.1479765E+06   0.0000000E+00


This is more like what I expect. In Version 18 it was possible to set a negative value; this is what is required in Version 20.
Also, I can't set a negative low frequency limit if I go into:
"Edit-> Preferences->FEM->Calculix"

Additionally, why can't the Real Part be filled in when the Eigenvalue is negative? The calculations can be done using the absolute value of the Eigenvalue and then placing a "-" sign in front of the values.
  • 2. IMPORT PYTHON CODE INTO THE PYTHON CONSOLE
>>> import mouse
starting mouse (this is output from the program)
>>> o = mouse.ViewObserver()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<string>", line 458, in <module>
File "<string>", line 38, in __init__
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pyside2uic'
There are a few Forum entries about this, but it is not clear what the solution is. Is there a simple solution for this problem?
  • 3. NETGEN MESH GENERATOR
The minimum element size was 1000, a more sensible value would be:
1/10 * cuberoot(volume of solid)

I must apologize that this has gone on so much.

Code: Select all

OS: Ubuntu 22.04 LTS (GNOME-Flashback:GNOME/gnome-flashback-metacity)
Word size of FreeCAD: 64-bit
Version: 0.20.28956 (Git)
Build type: Unknown
Branch: master
Hash: 47125d8fda
Python 3.10.4, Qt 5.15.3, Coin 4.0.0, OCC 7.5.1
Locale: English/United Kingdom (en_GB)
Post Reply