fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: fcFEM - FEA from start to finish

Post by HarryvL »

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.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: fcFEM - FEA from start to finish

Post by bernd »

HarryvL wrote: Sun Feb 10, 2019 5:28 am
:lol: 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
(106.5 KiB) Downloaded 60 times

Screenshot_20190210_132224.png
Screenshot_20190210_132224.png (147.97 KiB) Viewed 2096 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: fcFEM - FEA from start to finish

Post by bernd »

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
Screenshot_20190210_132559.png (99.87 KiB) Viewed 2093 times


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

Re: fcFEM - FEA from start to finish

Post by bernd »

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.
User avatar
HarryvL
Veteran
Posts: 1283
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

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?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: fcFEM - FEA from start to finish

Post by Kunda1 »

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
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: fcFEM - FEA from start to finish

Post by looo »

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.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: fcFEM - FEA from start to finish

Post by bernd »

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.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: fcFEM - FEA from start to finish

Post by bernd »

Geometry.OCCSewFaces=1 connect the face nodes in gmes
User avatar
HarryvL
Veteran
Posts: 1283
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

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.
Post Reply