fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
HarryvL
Posts: 831
Joined: Sat Jan 06, 2018 7:38 pm

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Feb 10, 2019 7:27 am

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
Posts: 7054
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Feb 10, 2019 12:25 pm

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) Not downloaded yet

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

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Feb 10, 2019 12:28 pm

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 201 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
Posts: 7054
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » 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.
User avatar
HarryvL
Posts: 831
Joined: Sat Jan 06, 2018 7:38 pm

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Feb 10, 2019 1:06 pm

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
Posts: 3829
Joined: Thu Jan 05, 2017 9:03 pm

Re: fcFEM - FEA from start to finish

Postby Kunda1 » Sun Feb 10, 2019 1:11 pm

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: 2322
Joined: Mon Nov 11, 2013 5:29 pm

Re: fcFEM - FEA from start to finish

Postby looo » Sun Feb 10, 2019 1:26 pm

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
Posts: 7054
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Feb 10, 2019 1:40 pm

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
Posts: 7054
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Feb 10, 2019 2:25 pm

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

Re: fcFEM - FEA from start to finish

Postby HarryvL » Mon Feb 11, 2019 11:08 pm

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.