FEM CCX error writing mesh for compound

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

FEM CCX error writing mesh for compound

Post by HarryvL »

Hi,

I am trying run a simple case with two materials, combined using a Compound of two cubes:

Screenshot from 2022-05-17 13-41-46.png
Screenshot from 2022-05-17 13-41-46.png (91.74 KiB) Viewed 702 times

TwoMaterials.FCStd
(14.97 KiB) Downloaded 12 times

This crashes with the following error:

Code: Select all

13:30:20  Count finite elements as sum of constraints:   40
13:30:20  Count finite elements of the finite element mesh: 44
13:30:20  ERROR: femelement_table != count_femelements
13:30:20  Error in get_femelement_sets -- > femelements_count_ok() failed!
My FC version and system data is as follows:

Code: Select all

OS: Ubuntu 22.04 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.28896 (Git)
Build type: Unknown
Branch: master
Hash: 8996cddbc043d1d8d27d27c25d2a25916b5287e7
Python 3.10.4, Qt 5.15.3, Coin 4.0.0, OCC 7.5.1
Locale: English/United States (en_US)
Anyone out there who could try this on FC19 and/or FC18?

I suspect that the major changes to the writer base made in FC19 cause problems with writing of the CCX files for multiple materials.

Thanks
Jee-Bee
Veteran
Posts: 2386
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by Jee-Bee »

I don't have gmsh on my laptop. When i run your mesh i get an error too (another that you have but basically missing nodes too).
When i rerun the mesh with Netgen i don't have any problem.
What happens if you recreate the mesh with other parameters?

Code: Select all

OS: macOS 10.15
Word size of FreeCAD: 64-bit
Version: 0.20.28647 (Git)
Build type: Release
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
Edit i had to re-add the materials because they are missing after download ;)
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

I changed Compound to BooleanFragment. Same error.

I had a look at the CCX INP file and indeed 2 elements are missing in each material set, i.e. 44 elements cards (yes, I still use that word) with 6 nodal values each, but only 20 element cards per material definition.

With a single material object and the same mesh everything works well.

The search continues.
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

Getting closer:

Code: Select all

meshdatagetter.femmesh.Volumes:  (61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104)
15:09:24  
meshdatagetter.mat_geo_sets:  [{'ccx_elset': [61, 63, 65, 66, 69, 71, 77, 78, 81, 82, 83, 85, 86, 87, 88, 89, 97, 98, 99, 100], 'ccx_elset_name': 'MaterialSolidSolid', 'mat_obj_name': 'MaterialSolid', 'ccx_mat_name': 'None'}, {'ccx_elset': [62, 64, 72, 74, 75, 76, 79, 80, 84, 90, 91, 92, 93, 94, 95, 96, 101, 102, 103, 104], 'ccx_elset_name': 'MaterialSolid001Solid', 'mat_obj_name': 'MaterialSolid001', 'ccx_mat_name': 'None'}]
15:09:24  
Any help appreciated
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

PS:

meshdatagetter.mat_geo_sets is the list of dicts I need here:

https://forum.freecadweb.org/viewtopic. ... 00#p594555

... but unfortunately it looks like it is broken.
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

Note to self:

node_set here: https://github.com/FreeCAD/FreeCAD/blob ... #L277-L279 contains the combined FEM mesh nodes for both solids. The nodes on the interface of the two solids get counted double in bit_pattern_dict in the same code segment.

In later use of bit_pattern_dict, here: https://github.com/FreeCAD/FreeCAD/blob ... #L524-L531, the node count per solid of nodes connected to that element gets compared to the number of nodes in the element (10 in the case of Tet10). If the count is less than 10, then the element is in another solid. If it is exactly ten then it is in the solid.

However, by doubling nodes in node_set, the result is greater than ten and therefore not considered part of any solid.

In the current test case, 4 elements have nodes that are both in solid1 and solid2 (i.e. at the contact of solid1 and solid2) and 4 elements are therefore missing in total.

This is exactly what the FC error is telling us: 44 elements in total, but 20 in solid1 and 20 in solid2.

Getting closer to a solution ...
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

It's much simpler:

Image

4 elements cut across the two Solids and therefore do not count in either Solid. Clearly this is not the way to model this.
Attachments
TwoMaterialsMesh.png
TwoMaterialsMesh.png (93.21 KiB) Viewed 447 times
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

Boolean Fragments with setting Compsolid works better:


TwoMaterialsMesh_2.png
TwoMaterialsMesh_2.png (84.65 KiB) Viewed 434 times
TwoMaterialsMesh_3.png
TwoMaterialsMesh_3.png (81.51 KiB) Viewed 434 times
Jee-Bee
Veteran
Posts: 2386
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by Jee-Bee »

But why did the version meshed with NETGEN did run well?
User avatar
HarryvL
Veteran
Posts: 1168
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: FEM CCX error writing mesh for compound

Post by HarryvL »

Netgen and GMSH must use different algorithms for meshing a compound of two solids.
Post Reply