compile with netgen for FEM meshing

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

compile with netgen for FEM meshing

Post by reox »

As described in this thread https://forum.freecadweb.org/viewtopic.php?f=18&t=35210 I try to create a version of FC with netgen enabled for FEM meshing.
It looks like that the meshing works fine in the mesh design WB, but fails in the FEM WB.
I build on a machine using debian unstable, the full build log can be found here: https://files.reox.at/.buildlog/freecad ... 4_0013.txt
For me, this looks like either some dependency is wrong, or I use the wrong flags.
Is it possible that the SMESH library is too old, when the internal version is used?
But currently there is no salomes mesh in debian IMO.
For the package versions installed, please consult the build log (just grep for "Setting up " in the log)

Summary:

Code: Select all

00:18:34 O: -- Python:              [/usr/bin/python3] [.cpython-37m-x86_64-linux-gnu]
00:18:34 O: -- PCL:                 1.9.1
00:18:34 O: -- pybind11:            2.2.4
00:18:34 O: -- Boost:               106700
00:18:34 O: -- XercesC:             [/usr/lib/x86_64-linux-gnu/libxerces-c.so] [/usr/include]
00:18:34 O: -- ZLIB:                1.2.11
00:18:34 O: -- PyCXX:               [/build/freecad-daily-0.19+git201906240013~daily/src]
00:18:34 O: -- OCC:                 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBin;TKBool;TKBO;TKCDF;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEP;TKSTEPBase;TKSTEPAttr;TKHLR;TKFeat]
00:18:34 O: -- SMESH:               build internal
00:18:34 O: --  MEDFile:            [/usr/lib/x86_64-linux-gnu/libmedC.so] [/usr/include]
00:18:34 O: --  HDF5:               1.10.4
00:18:34 O: --  VTK:                7.1.1
00:18:34 O: -- NETGEN:              6.2-dev [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=393728] [] [/usr/include/netgen/include;/usr/include/netgen] [nglib] [/usr/include/netgen/include;/usr/include/netgen]
00:18:34 O: -- SWIG:                3.0.12
00:18:34 O: -- Eigen3               3.3.7
00:18:34 O: -- Qt5Core:             5.11.3
00:18:34 O: -- Qt5Network:          5.11.3
00:18:34 O: -- Qt5Xml:              5.11.3
00:18:34 O: -- Qt5XmlPatterns:      5.11.3
00:18:34 O: -- Qt5Widgets:          5.11.3
00:18:34 O: -- Qt5PrintSupport:     5.11.3
00:18:34 O: -- Qt5OpenGL:           5.11.3
00:18:34 O: -- Qt5Svg:              5.11.3
00:18:34 O: -- Qt5UiTools:          5.11.3
00:18:34 O: -- Qt5Concurrent:       5.11.3
00:18:34 O: -- Qt5WebKitWidgets:    5.212.0
00:18:34 O: -- Shiboken2:           5.11.2 [/usr/lib/x86_64-linux-gnu/cmake/Shiboken2-5.11.2] [/usr/include/shiboken2]
00:18:34 O: -- PySide2:             5.11.2 [/usr/include/PySide2]
00:18:34 O: -- PySide2Tools:        [/usr/bin/pyside2-uic] [/usr/bin/pyside2-rcc]
00:18:34 O: -- Freetype:            2.9.1
00:18:34 O: -- OpenGLU:             /usr/lib/x86_64-linux-gnu/libGLU.so [/usr/lib/x86_64-linux-gnu/libGLU.so][/usr/include]
00:18:34 O: -- Coin3D:              [/usr/lib/x86_64-linux-gnu/libCoin.so] [/usr/include]
00:18:34 O: -- SPNAV:               [/usr/lib/libspnav.so] [/usr/include]
00:18:34 O: -- Matplotlib:          3.0.2
00:18:34 O: -- Rift:                not enabled (BUILD_VR)
00:18:34 O: -- Doxygen:             not found
configuration flags:

Code: Select all

-DFREECAD_BUILD_DEBIAN=ON 
-DBUILD_QT5=ON 
-DBUILD_FEM_NETGEN=ON 
-DBUILD_FLAT_MESH=ON 
-DFREECAD_USE_PYBIND11=ON 
-DFREECAD_USE_PCL=ON 
-DPYTHON_EXECUTABLE=/usr/bin/python3 
-DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DCMAKE_CXX_FLAGS="-Wall -DHAVE_SWIG=1 -fpermissive -g -O2 -fdebug-prefix-map=/build/freecad-daily-0.19+git201906240013~daily=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2" -DCMAKE_C_FLAGS="-Wall -fpermissive -g -O2 -fdebug-prefix-map=/build/freecad-daily-0.19+git201906240013~daily=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2" 
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,-z,now" 
-DLIB_SUFFIX="" 
-DCMAKE_INSTALL_PREFIX="/usr/lib/freecad-daily" 
-DCMAKE_INSTALL_DATADIR="/usr/share/freecad-daily" 
-DCMAKE_INSTALL_LIBDIR="/usr/lib/freecad-daily/lib" 
-DCMAKE_INSTALL_DOCDIR="/usr/share/doc/freecad-daily-doc
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: compile with netgen for FEM meshing

Post by sgrogan »

reox wrote: Mon Jun 24, 2019 11:28 am Is it possible that the SMESH library is too old, when the internal version is used?
On Windows the 12.1.2 libpack builds use OCC 7.3, NetGen 6.2, and internal SMESH
These builds use PY 3.6, we have seen some stuff with PY3.7?
"fight the good fight"
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Post by reox »

hmm so maybe py3.7 is the culprit?
The thing is, there is not 3.6 on debian... stretch uses 3.5 and buster 3.7
but on stretch this will not compile as the dependencies are missing
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: compile with netgen for FEM meshing

Post by looo »

reox wrote: Tue Jun 25, 2019 7:52 am hmm so maybe py3.7 is the culprit?
py3.7 in general shouldn't be the problem. At least on linux meshing with netgen in fem-workbench works.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: compile with netgen for FEM meshing

Post by looo »

Didn't see netgen isn't used anymore for weekly conda-builds (win).
https://ci.appveyor.com/project/looooo/ ... true#L1070
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Post by reox »

looo wrote: Tue Jun 25, 2019 8:03 am
reox wrote: Tue Jun 25, 2019 7:52 am hmm so maybe py3.7 is the culprit?
py3.7 in general shouldn't be the problem. At least on linux meshing with netgen in fem-workbench works.
hm, yes it kind of works, I get a mesh, but the display is complete crap. Maybe someone can create a small mesh with netgen and post it here? If it shows the same number of nodes, edges, ... but the display is broken too, we would have some indicator where the error is coming from.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: compile with netgen for FEM meshing

Post by UR_ »

reox wrote: Tue Jun 25, 2019 9:51 am Maybe someone can create a small mesh with netgen and post it here?
Screenshot 002.png
Screenshot 002.png (85.53 KiB) Viewed 2327 times
FEMMeshNetgen.FCStd
(348.19 KiB) Downloaded 39 times


OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17127 (Git)
Build type: Release
Branch: master
Hash: 00f082c97de187da3917fa29d8868b1be9c323e0
Python version: 3.7.1
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Post by reox »

As soon as I recompute the mesh:
2019-06-25-184247_1289x522_scrot.png
2019-06-25-184247_1289x522_scrot.png (55.63 KiB) Viewed 2304 times
looks like the netgen is the culprit?

Is it possible to test netgen without freecad? I.e.

Code: Select all

$ netgen -something -whatever generic_testfile
and compare the output?

maybe 6.2.1810 does work? But this is hanging in the NEW queue:(
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: compile with netgen for FEM meshing

Post by UR_ »

netgen standalone can be obtained by: https://ngsolve.org/downloads

external meshing workflow will be:
- export FreeCAD geometry as .brep file
- import into netgen standalone
- mesh with netgen
- set export format to "Abaqus"
- export mesh (don't forget to set extension explicitly to .inp)
- import .inp into FreeCAD FEM analysis

example (netgen 6.2.1903):
cylinder external meshed by netgen.zip
(29.04 KiB) Downloaded 37 times
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: compile with netgen for FEM meshing

Post by reox »

thanks for the documentation!

I tried with the cylinder from your FC file and set the mesh to "very fine":

Code: Select all

1 solid(s)
Preparing visualization (deflection = 0.01) ... done
 Face 1 / 3 (parameter space projection)
 Face 2 / 3 (parameter space projection)
 Face 3 / 3 (parameter space projection)
 Optimize Surface 1
 Optimize Surface 2
 Optimize Surface 3
 
 Meshing subdomain 1 of 1
 Delaunay meshing
 start tetmeshing
 Success !
 2426 points, 12278 elements
 Remove Illegal Elements
 Volume Optimization
 Meshing done, time = 4.35895 sec
 Export mesh to file /home/reox/tmp/ngtest/mesh.inp.... Please Wait!
 Export mesh to file /home/reox/tmp/ngtest/mesh.inp, format is Abaqus Format
I can open the resulting inp file no problem at all and it still looks the same as in netgen.
So I would suspect that SMESH is the problem here as I can confirm that freecad is handling meshes fine and netgen is producing them correctly.
It almost looks like that the NETGENPlugin_Mesher class is not working correctly?
From the git log I see that it should work with 6.2 - see git commit 55160cf50db0b433c9dd13e9e3573ae8c19fa190
Which is interesting, as there is the folder src/3rdParty/salomesmesh/src/NETGEN which says something about netgen 4.5... maybe this folder should be removed?
anyways, I double checked in the build that the NETGEN_VERSION is set correctly, it is set to 393728 == (6 << 16) + (2 << 8).
In the build log I only see a few warnings about redefinitions and casts regarding the NETGENPlugin, but nothing which concerns me (but I'm no C++ pro by any means)
I stripped the lines from the full log: https://files.reox.at/NETGENPlugin_build.txt (due to parallel build, there are some unrelated lines as well)
maybe someone finds a clue there?
Post Reply