Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

About the development of the FEM module/workbench.

Moderator: bernd

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

Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by UR_ »

This topic was shortly raised at https://forum.freecadweb.org/viewtopic. ... re#p454459

Now Gmsh 4.8.0 is out!

MeshSizeFromCurvature has changed

Code: Select all

 Mesh.MinimumElementsPerTwoPi = 12;
is no more necessary.

So I implemented new API. (Please update your gmsh.exe before testing)

Screenshot 004.png
Screenshot 004.png (6.95 KiB) Viewed 3063 times

To shape2mesh.geo following line will be added:

Code: Select all

Mesh.MeshSizeFromCurvature = 12; // number of elements per 2*pi radians, 0 to deactivate

And these are the differences shown up:

MeshSizeFromCurvature ON OFF.png
MeshSizeFromCurvature ON OFF.png (872.32 KiB) Viewed 3063 times

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

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by bernd »

wow this is what netgen is able to do and what makes netgen meshes better cimpored to gmsh in a lot of cases.

We need it to make in a way it workes the old way too for people without the new gmsh binary too.
UR_
Veteran
Posts: 1354
Joined: Tue Jan 03, 2017 8:42 pm

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by UR_ »

ATM, I'm working on a button in gmsh mesh task panel obtaining gmsh's version info and outputting it to a message box and a copy to report view.

Perhaps function can be used to distinguish between version 4.8.0 and lower ones.
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by user1234 »

Sounds nice! But on shaft objects the result is pretty bad.

Here is a rectangle shaft with some radius on it.
01.png
01.png (412.28 KiB) Viewed 2987 times

In general i have seen, that gmsh has serious issues with shafts.

Greetings
user1234
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by bernd »

user1234 wrote: Sun Mar 07, 2021 7:16 pm Sounds nice! But on shaft objects the result is pretty bad.

Here is a rectangle shaft with some radius on it.01.png
How about the geometry as file?
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by user1234 »

Sorry, i never saved that. I made a new similar.

Default settings with cleared mesh. You can clearly see where the seam is. Attention: when you run this with gmsh, this will take a while (195MByte). I use gmsh-4.8.0 and the PR-branch https://github.com/FreeCAD/FreeCAD/pull/4596.

Code: Select all

OS: Debian GNU/Linux bullseye/sid (X-Cinnamon/lightdm-xsession)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.20.Unknown
Build type: Debug
Python version: 3.9.1+
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.5.1
Locale: English/United States (en_US)
test23_gmsh_curviate.FCStd
(27.56 KiB) Downloaded 50 times
01.png
01.png (269 KiB) Viewed 2884 times

Greetings
user1234
UR_
Veteran
Posts: 1354
Joined: Tue Jan 03, 2017 8:42 pm

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by UR_ »

Gmsh and netgen have a two different approaches regarding growth of mesh sizes between edg#es.

For example taking a simple cylinder with a circle shaped bottom and a top edge.
Lets say that mesh at edges is finer than defined max. mesh size.

While netgen uses a input value called growth to enlarge mesh size from outer edges to center of face,
gmesh lets grow mesh only between edges with different mesh sizes.

So you have to place a third circle in the middle (without refined mesh) to let gmsh calculate it's growth rate.

Screenshot 002.png
Screenshot 002.png (166.48 KiB) Viewed 2851 times
shaft.FCStd
(28.37 KiB) Downloaded 279 times
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by user1234 »

Hello!
UR_ wrote: Mon Mar 08, 2021 4:39 pmSo you have to place a third circle in the middle (without refined mesh) to let gmsh calculate it's growth rate.
With that knowledge, now also mesh region on shaft works correctly. Before that, it never worked correct. Many, many thanks! This saves me hours of work per shaft analysis! Before that is was more or less try and error.

01.png
01.png (198.91 KiB) Viewed 2812 times
02.png
02.png (202.11 KiB) Viewed 2812 times

Greetings
user1234
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by Jee-Bee »

Can we request a growth option to the GMSH team?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implemented Gmsh Mesh Property "MeshSizeFromCurvature"

Post by bernd »

Post Reply