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

About the development of the FEM module/workbench.

Moderator: bernd

fandaL
Posts: 440
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 »

bernd wrote: Fri Jul 31, 2020 6:59 pm have not had the time to do anything in this regard ...
No hurry on this.

Maybe I mean it in different way. I thought that you import STL mesh to FC and use GMSH to create FEM mesh from it (including volume) and different element size from original STL. It does not need different icon - output is FEM mesh, but input can be both mesh object or geometrical shape.

Making (STL) mesh object by GMSH is already in Mesh wb: Meshes -> Create Mesh from Shape
joha2
Posts: 303
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 »

fandaL wrote: Fri Jul 31, 2020 6:44 pm 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.

Yeah, that's what I had in mind when bringing this on the table, since the reconstruction of geometry from STL is not optimal!

To improve the reconstruction of geometry from STL we need algorithms to reduce the number of faces via splines which are very sophisticated and not well implementable in our spare time :mrgreen: But this is another issue. So the direct transformation of STL mesh into FemMesh is the only feasible way to go, in my opinion.

fandaL wrote: Fri Jul 31, 2020 7:31 pm
bernd wrote: Fri Jul 31, 2020 6:59 pm have not had the time to do anything in this regard ...
No hurry on this.

Yeah no stress intended, I just brought it up to have it not burried under all the other tasks :mrgreen:.


fandaL wrote: Fri Jul 31, 2020 7:31 pm Maybe I mean it in different way. I thought that you import STL mesh to FC and use GMSH to create FEM mesh from it (including volume) and different element size from original STL. It does not need different icon - output is FEM mesh, but input can be both mesh object or geometrical shape.

Making (STL) mesh object by GMSH is already in Mesh wb: Meshes -> Create Mesh from Shape
Yeah I also had this in mind, as I said above. This is perfectly possible by just modifying the .geo file to point to an STL file which could be exported by FreeCAD. I digged a bit into the code https://github.com/FreeCAD/FreeCAD/blob ... shtools.py and saw that the GMSHTools class - which writes the GEO file and performs the gmsh task - is very strongly coupled to a FemMesh and its part definition. Maybe we have to disentangle that to be able to reuse the code. So the idea was:

Code: Select all

Now:

Geometry ->(via FC) BREP-file -> (merge) GEO-file -> (via GMSH) UNV-file -> (via FC) Femmesh

New:

Geometry ->(via FC) BREP-file -> (merge) GEO-file -> (via GMSH) UNV-file -> (via FC) Femmesh
Mesh ->(via FC) STL-file -> (merge) GEO-file -> (via GMSH) UNV-file -> (via FC) Femmesh
This means:

* either allow the gmsh_mesh_obj to link to a part as well as a mesh from Mesh WB
* or extract the "write GEO file" and "perform GMSH" tasks from GMSHTools such that the first one can be modified before the second one is called

I would prefer the first alternative, because the semantics of the code suggest that GMSHTools is responsible for communicating with GMSH via the GEO-file and performing the task of the meshing as well as reading back the UNV-file into FreeCAD.

When we use the same code for both it has also the advantage that we don't have to write the GMSH invocation logic in a double manner (and therefore maybe also profit from the multi threading improvement at once).

Maybe it is better to get the GMSH interface modification completed (i.e. approved) before modifying the logic of GMSHTools to accept a mesh from MeshWB, since both tasks are not related to each other.

A last comment: I know that we can create STLs from Geometry via the Mesh WB. As far as I remember there already exists a function to create also an STL from a FemMesh. Wouldn't it be nice to provide also a button for the latter one? I had the feeling that Mesh WB is sometimes not as exact w.r.t. geometry as the FemMesh is. (But that's only a feeling don't pin me down on that.)

Best wishes
Johannes
fandaL
Posts: 440
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 »

joha2 wrote: Sat Aug 01, 2020 9:41 am A last comment: I know that we can create STLs from Geometry via the Mesh WB. As far as I remember there already exists a function to create also an STL from a FemMesh. Wouldn't it be nice to provide also a button for the latter one? I had the feeling that Mesh WB is sometimes not as exact w.r.t. geometry as the FemMesh is. (But that's only a feeling don't pin me down on that.)
In order to create mesh object from FEM mesh, select the FEM mesh and click in FEM wb (Mesh -> FEM mesh to mesh) https://wiki.freecadweb.org/FEM_FemMesh2Mesh
joha2
Posts: 303
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 »

fandaL wrote: Sat Aug 01, 2020 1:20 pm In order to create mesh object from FEM mesh, select the FEM mesh and click in FEM wb (Mesh -> FEM mesh to mesh) https://wiki.freecadweb.org/FEM_FemMesh2Mesh
Nice! Seems that I just not realized that this possibility exists. Thank you for pointing this out! :oops:
Then forget my last remark :mrgreen:
Post Reply