[ANSWERED]Help learning FEM

About the development of the FEM module/workbench.

Moderator: bernd

bzb.dev001
Posts: 73
Joined: Sun May 05, 2019 3:08 am

[ANSWERED]Help learning FEM

Postby bzb.dev001 » Sat Jul 20, 2019 5:19 am

I've been following the instructions of https://youtu.be/dhrynRdBOIg for learning about using FEM.
I got as far as creating a gmsh and got a error message. I'm stuck at this point. I do not know what the error message means and how to proceed to fix the issue.
Any help is appreciated.
Thanks
z.png
z.png (62.51 KiB) Viewed 343 times
FreeCAD details:
OS: Ubuntu 18.04.2 LTS (LXDE/Lubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16966 (Git) AppImage
Build type: Release
Branch: master
Hash: fbafd698aefeae2dbb5a711647346b9cac7794e9
Python version: 3.7.1
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
Attachments
sample-fem.FCStd
(33.91 KiB) Downloaded 4 times
Last edited by bzb.dev001 on Thu Aug 08, 2019 2:32 pm, edited 1 time in total.
openBrain
Posts: 1595
Joined: Fri Nov 09, 2018 5:38 pm

Re: Help learning FEM

Postby openBrain » Sat Jul 20, 2019 4:02 pm

Is gmsh installed on your computer ?
User avatar
Kunda1
Posts: 4812
Joined: Thu Jan 05, 2017 9:03 pm

Re: Help learning FEM

Postby Kunda1 » Sat Jul 20, 2019 4:04 pm

Mod note: Moved to FEM subforum.

OP, please update your 0.19dev version it's is woefully behind (current us r17443). Especially with anything FEM related you want the most updated 0.19 version
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 4812
Joined: Thu Jan 05, 2017 9:03 pm

Re: Help learning FEM

Postby Kunda1 » Sat Jul 20, 2019 4:06 pm

openBrain wrote:
Sat Jul 20, 2019 4:02 pm
Is gmsh installed on your computer ?
The report view shows 'GMSH done' I wonder if that is hardcoded and not a conditional...in other words it will output GMSH done no matter what ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
openBrain
Posts: 1595
Joined: Fri Nov 09, 2018 5:38 pm

Re: Help learning FEM

Postby openBrain » Sat Jul 20, 2019 4:17 pm

FEM needs extra tools that aren't install with FC.
You can run

Code: Select all

sudo apt-get install netgen gmsh calculix-ccx
bzb.dev001
Posts: 73
Joined: Sun May 05, 2019 3:08 am

Re: Help learning FEM

Postby bzb.dev001 » Mon Jul 22, 2019 3:49 am

I've updated my FreeCAD to ...
OS: Ubuntu 18.04.2 LTS (LXDE/Lubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17445 (Git) AppImage
Build type: Release
Branch: master
Hash: 741dddf25485f692596faa9b7911e2e0f5d362a3
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)

-Installed gmsh
$ gmsh --version
4.4.0

-Installed netgen
$ netgen
NETGEN-6.2-dev
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
Including OpenCascade geometry kernel
optfile ./ng.opt does not exist - using default values
togl-version : 2
OCC module loaded
loading ngsolve library
NGSolve-6.2.1905
Using Lapack
Including sparse direct solver UMFPACK
Running parallel using 4 thread(s)
importing NGSolve-6.2.1905
Thank you for using NGSolve

-Using the same example FreeCAD file, I'm still getting an error message when creating FEM mesh via gmsh. The error message at the task window is...
0.0: We are going to start ...
0.0: Start Gmsh ...
0.9: Gmsh had warnings ...
0.9: Error : Unable to recover the edge 376 (1/2) on curve 15 (on surface 3) Error : Unable to recover the edge 11267 (14/29) on curve 38 (on surface 5) Error : Unable to recover the edge 11280 (17/30) on curve 42 (on surface 21) Error : No elements in volume 1 Error : ------------------------------ Error : Mesh generation error summary Error : 0 warnings Error : 4 errors Error : Check the full log for details Error : ------------------------------ Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid Warning : Unknown element type for UNV export (MSH type 15)
[*** comment:I removed repeated messages ***]
0.9: Gmsh done!

-The ReportView shows the following messages...
We are going to start Gmsh FEM mesh run!
Part to mesh: Name --> Fusion001, Label --> Fusion001, ShapeType --> Compound
CharacteristicLengthMax: 1e+22
CharacteristicLengthMin: 0.0
ElementOrder: 2
ElementDimension: 3
/tmp/Fusion001_Geometry.brep
/tmp/Fusion001_Mesh_TmpGmsh.unv
/tmp/shape2mesh.geo
gmsh
No Group meshing for analysis.
The Part should have a pretty new FEM mesh!
Error : Unable to recover the edge 376 (1/2) on curve 15 (on surface 3)
Error : Unable to recover the edge 11267 (14/29) on curve 38 (on surface 5)
Error : Unable to recover the edge 11280 (17/30) on curve 42 (on surface 21)
Error : No elements in volume 1
Error : ------------------------------
Error : Mesh generation error summary
Error : 0 warnings
Error : 4 errors
Error : Check the full log for details
Error : ------------------------------
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
...
bzb.dev001
Posts: 73
Joined: Sun May 05, 2019 3:08 am

Re: Help learning FEM

Postby bzb.dev001 » Mon Jul 22, 2019 3:56 am

I tried using a different solid to perform FEM on and it seems to work albeit there was a warning message. I wonder if there could be something wrong with the original solid.

-When creating a FEM mesh gmsh, the warning message is
0.0: We are going to start ...
0.0: Start Gmsh ...
0.5: Gmsh had warnings ...
0.5: Warning : Surface mesh: worst distortion = -1.73981 (avg = 0.94883, 2 elements with jac.
0.5: Gmsh done!

-ReportView show the following messages...
We are going to start Gmsh FEM mesh run!
Part to mesh: Name --> Body, Label --> Body, ShapeType --> Solid
CharacteristicLengthMax: 1e+22
CharacteristicLengthMin: 0.0
ElementOrder: 2
ElementDimension: 3
/tmp/Body_Geometry.brep
/tmp/Body_Mesh_TmpGmsh.unv
/tmp/shape2mesh.geo
gmsh
No Group meshing for analysis.
The Part should have a pretty new FEM mesh!
Warning : Surface mesh: worst distortion = -1.73981 (avg = 0.94883, 2 elements with jac. < 0); worst gamma = 0.00357077
Warning : Volume mesh: worst distortion = -64.1264 (avg = 0.837595, 8 elements with jac. < 0)
Warning : ------------------------------
Warning : Mesh generation error summary
Warning : 2 warnings
Warning : 0 errors
Warning : Check the full log for details
Warning : ------------------------------
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
...
0.png
0.png (52.38 KiB) Viewed 239 times
Attachments
sample-beam fem.FCStd
(129.28 KiB) Downloaded 6 times
thschrader
Posts: 1403
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Help learning FEM

Postby thschrader » Mon Jul 22, 2019 3:27 pm

For me it works.
Try to use a finer mesh.
Here: max Element size 1 mm.
sampleBeamResult.JPG
sampleBeamResult.JPG (79.85 KiB) Viewed 202 times
openBrain
Posts: 1595
Joined: Fri Nov 09, 2018 5:38 pm

Re: Help learning FEM

Postby openBrain » Mon Jul 22, 2019 5:35 pm

bzb.dev001 wrote:
Mon Jul 22, 2019 3:56 am
I tried using a different solid to perform FEM on and it seems to work albeit there was a warning message. I wonder if there could be something wrong with the original solid.
Definitely there are. I took your OP example file and ran a geometry check with BOP enabled. There are some errors that probably lead to your final problem. They come from your array that has intersecting shape.
The good news is that this isn't a big issue, and everything get solved by setting "Refine = true" in the object properties.
Then gmsh still complains (AFAIK it always complains :lol: ) but it generates a good mesh that can seamlessly be used for FEM analysis.
Eg. below I fixed the feet and pushed 50 kg it's too much :D ) :
fem_table.png
fem_table.png (22.85 KiB) Viewed 187 times
I'll attach the FreeCAD file but I have to clean it so it is accepted by the forum. ;) => EDIT : I had to remove the results from the FEM analysis !
Beware that refining the shape will mostly break the existing FEM constraints and material attachment.

HTH
Attachments
sample_FEM_OB.FCStd
(323.66 KiB) Downloaded 4 times
bzb.dev001
Posts: 73
Joined: Sun May 05, 2019 3:08 am

Re: Help learning FEM

Postby bzb.dev001 » Mon Jul 22, 2019 8:55 pm

Thanks for the reply. The particular sample FreeCAD file I uploaded, in which you responded to, was a working model. It's purpose was to prove that FEM mesh by gmsh was installed ok and working ok. That's how I determined that it must've been something wrong with the solid in question. The original non-working FreeCAD model was provided at the start of this posting.
thschrader wrote:
Mon Jul 22, 2019 3:27 pm
For me it works.
Try to use a finer mesh.
Here: max Element size 1 mm.
sampleBeamResult.JPG