## Meshing time conundrum

About the development of the FEM module/workbench.

Moderator: bernd

ettaka
Posts: 5
Joined: Mon Sep 02, 2019 8:19 pm

### Meshing time conundrum

Hello,

we have yet another mesh related issue. This is really a conundrum.

As explained in another post: https://forum.freecadweb.org/viewtopic.php?f=18&t=39039
we are trying to use a library for automatic meshing.

There was a time when we didn't know how to decide between two different approaches for finding solids. So we implemented both:
1. the first method is suggested somewhere here (I apologize for not remembering the thread): first taking the common of the compared solids and then checking if the volume is positive
2. the second method was home-brewed: first we take a point from the other solid and then check if the point is also in the other
Both methods are here in few lines of code:
https://github.com/ElmerCSC/elmerfem/bl ... ls.py#L357

So this method is only used for checking which solid belongs to what compound filter. So it should not have any effect on the actual input that the library produces for Gmsh. Now these methods can easily be tested with this script: https://github.com/ElmerCSC/elmerfem/bl ... eshtest.py

First we run the first method:
\$ python cubemeshtest.py -n 10 -m 100 -ca -am 100 -fe freecad-daily
-Create mesh: 9.7
-Total time: 12.3

And then the second method:
\$ python cubemeshtest.py -n 10 -m 100 -ca -am 100 -fe freecad-daily -ps
-Create mesh: 21.0
-Total time: 22.7

The two lines after the command are the time used in Gmsh and the total time in the script, respectively.

The conundrum is as follows: why gmsh is using so much more time when the second method is used? The resulting mesh files have identical size. Note that the time is really the time that Gmsh uses..

I would be grateful if someone else could at least test the script and check if he/she gets similar results. Moreover, if someone has an idea what would be the issue, I would be very happy: it seems the point search can be quicker in our case for finding the bodies but for some reason gmsh run is hindered for no good reason! Smells like a bug to me...

BR,

Eelis
bernd
Posts: 9318
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Meshing time conundrum

The first I would probably check: Does the script produce different geo files as input for gmsh?
ettaka
Posts: 5
Joined: Mon Sep 02, 2019 8:19 pm

### Re: Meshing time conundrum

bernd wrote:
Wed Sep 11, 2019 3:55 am
The first I would probably check: Does the script produce different geo files as input for gmsh?
How did we now implement the possibility to choose the place for the temporary files? (how to use the feature in practice?) And do the files stay there or are they removed after the mesh has been done?

Cheers,

Eelis
bernd
Posts: 9318
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Meshing time conundrum

bernd
Posts: 9318
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland