## fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

HarryvL
Posts: 1039
Joined: Sat Jan 06, 2018 7:38 pm

### Re: fcFEM - FEA from start to finish

HarryvL wrote:
Sat Feb 09, 2019 7:44 am
I am planning to profile the code and report out on where time is spent. Clearly, solving the matrix equations is the most computationally intensive, but here is where NumPy/SciPy comes the rescue. Including smart use of preconditioning with classical techniques, like Cuthill McKee band optimization (also available as a routine in SciPy btw). Assembly of the global stiffness matrix is not normally the most intensive, but involves a lot of loops. Here I Need to focus on maximizing use of masking, matrix multiplication and list comprehension instead of dum loops. Suggestions on cutting out for loops are welcome.
without any optimisation applied and naive application of Numpy I get the following results:

extract information from FreeCAD objects....................... 0.006 seconds
prepare finite element input................................... 0.528 seconds
calculate the global stiffness matrix and global load vector... 1.407 seconds
apply displacement boundary conditions......................... 0.003 seconds
solve the global siffness matrix equation...................... 18.344 seconds
calculate stresses from displacements.......................... 0.000 seconds
paste results in the FEM result object......................... 0.013 seconds

This is with 785 2nd order tetrahedral elements and 1399 nodes.
bernd
Posts: 7908
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: fcFEM - FEA from start to finish

HarryvL wrote:
Sun Feb 10, 2019 5:28 am

yeah sure Harry. I need to duplicate faces and tried Boolenfragments Mode: Split, but that does not give the desired result. In fact all three mode types give exactly the same mesh. In all three cases the report view just says “Part to mesh: ... ShapeType —> Compound”. Is there a way to force duplicate element faces at a contact? I tried a simple Part>Compound of two separate Compsolids, but that won’t guarantee the element faces will be lined-up at the contact (right?) ... which is a must for interface elements. I also read about GMSH physical surfaces and wanted to specify that in the geo file, but can not locate that file (or the tmp directory for that matter) on my hard disk. Does it get deleted after use?
- make two solids
- make a compound out of them
- shoud do the job ...
- but it does not
- I swear years ago it was that way, because I spent hours on creating CompSolid (a compsolid shares faces ..., a compound does not, Just check shape geometry ) to solve exact this issue.

...

I need to have a closer look ...

duplicate_face_nodes.FCStd

Screenshot_20190210_132224.png (147.97 KiB) Viewed 375 times
bernd
Posts: 7908
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: fcFEM - FEA from start to finish

the compound shape is good. Shape check geoemtry gives 12 faces (one is duplicate, the one we would like to have duplicate nodes for ... ) and a lot self intersections ...

Screenshot_20190210_132559.png (99.87 KiB) Viewed 372 times

may be gmsh uses different standard preferences than years ago. I need to have a look, it can be adjusted in gmsh too. ...
bernd
Posts: 7908
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: fcFEM - FEA from start to finish

Ahh try netgen with my file. At moment netgen is broken for me on Linux and no windows before Monday. I had no time to have a closer look how to compile FreeCAD with Netgen on Debian Buster.
HarryvL
Posts: 1039
Joined: Sat Jan 06, 2018 7:38 pm

### Re: fcFEM - FEA from start to finish

Thanks Bernd. I will give it all a try. Unfortunately Netgen never worked for me on Ubuntu (where I do development work). Also, do you have any idea where the geo file may be saved? Can’t find it anywhere. Does it get deleted after use?
Kunda1
Posts: 4584
Joined: Thu Jan 05, 2017 9:03 pm

### Re: fcFEM - FEA from start to finish

bernd wrote:
Sun Feb 10, 2019 12:29 pm
Ahh try netgen with my file. At moment netgen is broken for me on Linux and no windows before Monday. I had no time to have a closer look how to compile FreeCAD with Netgen on Debian Buster.
The netgen devs aren't very responsive either. https://ngsolve.org/forum/ngspy-forum/7 ... ending-prs
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
looo
Posts: 2612
Joined: Mon Nov 11, 2013 5:29 pm

### Re: fcFEM - FEA from start to finish

regarding netgen:

the conda-packages of freecad and the py3-appimage have a working (in the sense of "simple meshes work") netgen. I have tried to compile on ubuntu with netgen, but failed because 1. internal smesh doesn't work with updated netgen and 2. external smesh was not available for me in ubuntu18.04 (but should regarding @normandc)

Current netgen-master didn't work for me, because some stuff was refactored... So I am currently using netgen6.2.1808 for the conda packages.
bernd
Posts: 7908
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: fcFEM - FEA from start to finish

thanks for the informations in the regard of netgen.

In the regard of geo file, whach report window, the file location is printed. In the geo file you will find the gmsh command to create the mesh even with a open gmsh gui to change the mesh.
bernd
Posts: 7908
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: fcFEM - FEA from start to finish

Geometry.OCCSewFaces=1 connect the face nodes in gmes
HarryvL
Posts: 1039
Joined: Sat Jan 06, 2018 7:38 pm

### Re: fcFEM - FEA from start to finish

I now approach it as follows:

1) create boolean fragments for the contacting solids
2) bring the boolean fragments together in a compound
3) in the gmsh object set "coherence mesh" to FALSE

Then I cycle through the boolean fragments to check if they share coinciding faces ... at least that's the intent.

I looked for some old posts and found this https://forum.freecadweb.org/viewtopic. ... 95#p111032

Bernd, it looks like you tried the same, but it is unclear to me from the post how you resolved this. So in your words, I am looking for equal geometry, not the same geometry. In my words: I am looking for coinciding faces, not equal faces.