Better mesh last instead of mesh first?

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Better mesh last instead of mesh first?

Post by bernd »

I had a few minutes today. Just updated the defs to your up to date algorithm and tested with tet10. I did neither look into the integration to the whole class nor into the get_volumes for replacing the get_femelements_by_femnodes().

I need to test with other element types.

cheers bernd

https://github.com/berndhahnebach/FreeC ... mgmshgroup
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

I tried to include the volume search to replace the method get_femelements_by_femnodes() with the binary search. Some problem arised. Your binary search only works on volume elements, but the get_femelements_by_femnodes() works on all element from http://www.freecadweb.org/wiki/index.ph ... ment_Types without checking the element type. Would it be possibel to extend the search to all element types or should I check the element type befor the binary search is called?

commit:
https://github.com/berndhahnebach/FreeC ... 31eb8921d4

Branch https://github.com/berndhahnebach/FreeC ... mgmshgroup only has the changes in the regard of your MeshInfoClass. All other changes in the regard of FEM especially GMSH and group meshing are on top in branch https://github.com/berndhahnebach/FreeC ... emgmshtool which implements a GMSH meshing tool inside FreeCAD. Would be cool if you could give it a try.

cheers bernd
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Better mesh last instead of mesh first?

Post by ulrich1a »

bernd wrote:Would it be possibel to extend the search to all element types or should I check the element type befor the binary search is called?
It would be possible to extent the method to other elements as well.
There are a few things to be considered. Currently the now by me called pattern_dict is only build from the volumes. Searching shell elements would require to build a separate dictionary from the shell elements.
I do distinguish the different type of elements just by the number of nodes per element. There is a coincidence with 4 nodes for a tet and 4 nodes for rectangular shell element. Therefore the search has to need to know, if a search is needed for volumes or for shells or for both.

The Gmsh-approach does also supply shell elements for the physical entities. Searching for elements in both volumes and shells may result in unwanted shell-elements. In the long term, there would be a requirement to filter the supplied mesh from Gmsh, so we can have both volume-elements from solids and shell-elements from shells, but not the shell-elements from the needed physical surfaces of the solids.

Ulrich
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: Better mesh last instead of mesh first?

Post by fandaL »

It would be possible to extent the method to other elements as well.
There are a few things to be considered. Currently the now by me called pattern_dict is only build from the volumes. Searching shell elements would require to build a separate dictionary from the shell elements.
I do distinguish the different type of elements just by the number of nodes per element. There is a coincidence with 4 nodes for a tet and 4 nodes for rectangular shell element. Therefore the search has to need to know, if a search is needed for volumes or for shells or for both.
I had similar problem with recognising element type in FemMeshtToMesh macro. Now it uses mesh.faces dict to search for face elements, but this makes whole macro slow.
https://github.com/fandaL/FreeCAD_macro ... esh.py#L35
viewtopic.php?f=22&t=17724
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

Mesh with 7315 volumes:

old volume search:
9.6 sekunden

new volume search:
4.6 sekunden

It works for sure on volume meshes without face data. Shell and Edge meshes use the old search. I need to exclude or trigger the volume mesh with face and or edge data. I may find a solution for the problem. May be for your mesh converter too fandaL.

see last commit in branch, development still in progress:
https://github.com/berndhahnebach/FreeC ... mgmshgroup
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

50199 volumes
binary search: Writing time input file: 43.623497
standard search: Writing time input file: 262.482714
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Better mesh last instead of mesh first?

Post by PrzemoF »

x5 speed up? Great!!! :D
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

PrzemoF wrote:x5 speed up? Great!!! :D
As more elements as more speed up. Means on 1000000 we may have factor 100.

BTW: made some tests and it worked out well. It works for volume element. Since FreeCAD FEM does not support mixed meshes (It can save mixed meshes, but not make a proper CalculiX inputfile from it.) we can distinguish easily what kind of mesh we have.

see https://github.com/berndhahnebach/FreeC ... mgmshgroup

I activated the binary search for all volume meshes in my up to date development branch for gmsh tool too https://github.com/berndhahnebach/FreeC ... emgmshtool


BTW:
As more changes I make on FemMeshTools as more the swithch to a MeshInfoClass goes up in my ToDoList
Post Reply