FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

About the development of the FEM module/workbench.

Moderator: bernd

joha2
Posts: 279
Joined: Tue Oct 11, 2016 9:48 pm

FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by joha2 » Sat Jul 25, 2020 10:04 am

Hey bernd,

I had submitted a PR https://github.com/berndhahnebach/FreeCAD_bhb/pull/54 where I implemented multi threading in the GMSH call and did some small changes to the GMSH interface. Is there any update on this? The github history does not reveal much.

In connection with this, some months ago I posted whether someone is interested in code for STL meshing by GMSH. I thought I lost the code (therefore no update on this) and today realized that I only played around with the 'shape2mesh.geo' file where I substitued the '.brep' path with an '.stl' file and GMSH was able to output an FEM mesh (.unv).

So my questions are these:

a) Does it make sense to let the meshing icon also be applied for an STL mesh (i.e. from the meshing workbench), too? This may be of interest for topology optimizing projects, since they usually get an STL from a marching cubes algorithm.
b) Should we revive the old PR above and implement this feature there? (I don't want code doubling for a feature which just needs another file name.)

EDIT: I saw an update on the https://github.com/berndhahnebach/FreeC ... emgmshpref from just a few days ago, incorporating my commits. So, maybe it does not make sense to revive the old PR, does it?

Thanks for your help and best wishes
Johannes
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by bernd » Sat Jul 25, 2020 4:08 pm

I am on the way. Just FYI ... the changes in my branch from your PR are just because I keep the branch rebased on master regularly by a script.

Use my rebased branch or your old and do the rebase yourslf. What ever fits best for you ...

I will answer all the others later on.
joha2
Posts: 279
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by joha2 » Sun Jul 26, 2020 7:38 am

bernd wrote:
Sat Jul 25, 2020 4:08 pm
I am on the way. Just FYI ... the changes in my branch from your PR are just because I keep the branch rebased on master regularly by a script.

Use my rebased branch or your old and do the rebase yourslf. What ever fits best for you ...
Hey bernd,

Thanks for your fast response! Of course, I will use your rebased branch, since I have still no idea how to rebase without messing all up :mrgreen:

Stay safe
Johannes
HoWil
Posts: 1199
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by HoWil » Thu Jul 30, 2020 2:05 pm

joha2 wrote:
Sat Jul 25, 2020 10:04 am
... multi threading in the GMSH....
Sounds very interesting!
So, is it now under way or not :D
The "EDIT" from joha2 in the first post suggests it is already in the pipeline?!
joha2
Posts: 279
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by joha2 » Thu Jul 30, 2020 7:48 pm

HoWil wrote:
Thu Jul 30, 2020 2:05 pm
So, is it now under way or not :D
Hey HoWil! Nice to hear from you! As I far as I understood, bernd rebased my old branch onto the actual FreeCAD master and put all together into the branch I mentioned in my edit. So it is on its way, but has to be approved and merged by him. (You may check out the branch from bernd and you will get an impression, but notice that gmsh needs to be compiled with multi threading support.)

Best wishes
Johannes
HoWil
Posts: 1199
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by HoWil » Thu Jul 30, 2020 8:01 pm

Hello Johannes,

Do you have any documentation on how to compile gmsh for multi threading?
I only found http://gmsh.info/doc/texinfo/gmsh.html# ... ource-code but this is not really satisfying.
BR,
HoWil
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by ulrich1a » Thu Jul 30, 2020 9:22 pm

HoWil wrote:
Thu Jul 30, 2020 8:01 pm
I only found http://gmsh.info/doc/texinfo/gmsh.html# ... ource-code but this is not really satisfying.
ENABLE_OPENMP should include multithreading. See here:
https://de.wikipedia.org/wiki/OpenMP

There is also ENABLE_MPI, but it is not used for meshing, according to the above cited Gmsh documentation.

Ulrich
joha2
Posts: 279
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by joha2 » Fri Jul 31, 2020 6:22 am

HoWil wrote:
Thu Jul 30, 2020 8:01 pm
Do you have any documentation on how to compile gmsh for multi threading?
ulrich1a wrote: There is also ENABLE_MPI, but it is not used for meshing, according to the above cited Gmsh documentation.
Hi HoWil and Ulrich,

For me for compiling gmsh

Code: Select all

cmake -DENABLE_OPENMP=1 -DENABLE_MPI=1
worked, but as Ulrich pointed out, maybe the ENABLE_MPI flag is not necessary. See the code at:

https://github.com/berndhahnebach/FreeC ... 664f11cad1

At the end of the day gmsh meshed a cube with 1 million elements quite fast, but the main bottleneck is the transfer back to FreeCAD (output as text file UNV and read back into FreeCAD, display perhaps). A suggestion on the gitlab repo of gmsh was to use a library gmsh file together with its Python API into FreeCAD and access the mesh structure directly. See

https://gitlab.onelab.info/gmsh/gmsh/issues/552

where I discussed these issues with the creators and maintainers of gmsh.

Best wishes
Johannes
fandaL
Posts: 382
Joined: Thu Jul 24, 2014 8:29 am

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by fandaL » Fri Jul 31, 2020 6:44 pm

joha2 wrote:
Sat Jul 25, 2020 10:04 am
a) Does it make sense to let the meshing icon also be applied for an STL mesh (i.e. from the meshing workbench), too? This may be of interest for topology optimizing projects, since they usually get an STL from a marching cubes algorithm.
Even when FC prescribes loads, BCs and material on geometry, for me it makes sense to mesh STL, becase after topology optimization original geometry (before removing material) can be used to define analysis together with FEM mesh which is not associated to the geometry.
Otherwise I would need to mesh STL externally or transform STL mesh to the geometry in FreeCAD which (after some waiting) results in geometry with many faces.
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: FEM: Status of old GMSH interface PR and discussion of STL meshing through GMSH

Post by bernd » Fri Jul 31, 2020 6:59 pm

have not had the time to do anything in this regard ... :oops:

stl meshing with gmsh would be good, but since this would be a FreeCAD Mesh object and not a FreeCAD FemMesh object we shoould use a separate icon for this even is we use the same code base and even uf we put the tool inside Fem.

Or is the aim to really produce a stl file?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests