Why does FEM meshing doesn't generate volume elements in some cases

About the development of the FEM module/workbench.

Moderator: bernd

jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby jmaustpc » Wed Apr 27, 2016 12:04 pm

bernd wrote:I have never compiled occt and thus never compiled FreeCAD against my own occt. I'm on Debian Jessie and would like to give your repo a try. Just to get it done the right way. I need to:

- pull OCCT 7.0.0 from http://git.dev.opencascade.org/gitweb/
- did you use the latest branch or the tag 7.0.0 ?
- compile OCCT 7.0.0

- pull FreeCAC from your occt7 branch https://github.com/vejmarie/FreeCAD/tree/occt7
- compile FreeCAD against the fresh new compiled OCCT 7.0.0
Hi Bernd, you probably already thought of this but in case you did not....when you Cmake configure OCE/OCC code, change the "install prefix" that way you can have more than one OCE/OCC on your system at once. This is easiest done with Cmake-Gui (I use Cmake-qt-gui). You have to "sudo make install" OCE after compilation and you don't want to over write the files that you may have installed with your package manager.

Then when you configure FreeCAD, once again run Cmake-Gui, it will find the default OCE on the first run through Configure, you then just change the directories for OCE to point at the version you want to use with the file browser in Cmake-Gui. And of course change any other FreeCAD cmake flags, like build type "Debug or Release" for example.

Jim
User avatar
bernd
Posts: 8332
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby bernd » Wed Apr 27, 2016 12:28 pm

@jim

thanks very much for reminding me in the regard of all the cmake stuff
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby vejmarie » Wed Apr 27, 2016 2:56 pm

Hi Bernd,

This is roughly what you will be needing yes you are right.
You might be using also and updated netgen 5.3.1 to run properly with the new OCCT. I can make a tar of the current version I use. It will be easier for you.

Just for your ref I have currently a crash into

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x000000011d46e298 in NCollection_BaseMap::BeginResize(int, int&, NCollection_ListNode**&, NCollection_ListNode**&) const ()
   from /usr/local/lib/libTKernel.7.dylib
(gdb) where
#0  0x000000011d46e298 in NCollection_BaseMap::BeginResize(int, int&, NCollection_ListNode**&, NCollection_ListNode**&) const ()
   from /usr/local/lib/libTKernel.7.dylib
#1  0x000000011ea90f86 in NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>::ReSize(int) () from /usr/local/lib/libTKBRep.7.dylib
#2  0x000000011ea905dc in NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>::Add(TopoDS_Shape const&) () from /usr/local/lib/libTKBRep.7.dylib
#3  0x000000011ea8deae in TopExp::MapShapes(TopoDS_Shape const&, NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>&) ()
   from /usr/local/lib/libTKBRep.7.dylib
#4  0x00000001225244a4 in SMESHDS_Mesh::ShapeToMesh(TopoDS_Shape const&) () from /Users/jmverdun/git/build/lib/libSMESHDS.dylib
#5  0x00000001230ff306 in SMESH_Mesh::ShapeToMesh(TopoDS_Shape const&) () from /Users/jmverdun/git/build/lib/libSMESH.dylib
#6  0x000000012210b650 in MeshPart::Mesher::createMesh() const () from /Users/jmverdun/git/build/Mod/MeshPart/MeshPart.so
#7  0x00000001220e3046 in MeshPart::Module::meshFromShape(Py::Tuple const&, Py::Dict const&) () from /Users/jmverdun/git/build/Mod/MeshPart/MeshPart.so
#8  0x00000001220e4c65 in Py::ExtensionModule<MeshPart::Module>::invoke_method_keyword(void*, Py::Tuple const&, Py::Dict const&) ()
   from /Users/jmverdun/git/build/Mod/MeshPart/MeshPart.so
#9  0x000000010138c5d4 in method_keyword_call_handler () from /Users/jmverdun/git/build/lib/libFreeCADBase.dylib
#10 0x00000001016856cb in PyEval_EvalFrameEx () from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
at the early stage of the mesh creation when using MEFISTO or netgen. Looks like we have some homework in front of us. The remaining Workbench are working pretty well which is good to know when you have applied the patches on my repo.

The crash is not coming from the FEM module but from the Mesher module which is generating surface mesh, but I like to go step by step.
If you need any help feel free, I am using slack and IRC if needed.

vejmarie
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby vejmarie » Wed Apr 27, 2016 3:03 pm

Just give a try with the Mesher code into Fem

and it crashed but not in the same place

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x0000000121b07ce5 in SMDS_MeshNode::getCoord() const () from /Users/jmverdun/git/build/lib/libSMDS.dylib
(gdb) where
#0  0x0000000121b07ce5 in SMDS_MeshNode::getCoord() const () from /Users/jmverdun/git/build/lib/libSMDS.dylib
#1  0x0000000121b07905 in SMDS_MeshNode::X() const () from /Users/jmverdun/git/build/lib/libSMDS.dylib
#2  0x000000011668847d in Fem::FemMesh::copyMeshData(Fem::FemMesh const&) () from /Users/jmverdun/git/build/Mod/Fem/Fem.so
#3  0x000000011668ad8f in Fem::FemMesh::operator=(Fem::FemMesh const&) () from /Users/jmverdun/git/build/Mod/Fem/Fem.so
#4  0x00000001166dc2dc in Fem::PropertyFemMesh::setValue(Fem::FemMesh const&) () from /Users/jmverdun/git/build/Mod/Fem/Fem.so
#5  0x0000000116677c72 in Fem::FemMeshShapeNetgenObject::execute() () from /Users/jmverdun/git/build/Mod/Fem/Fem.so
#6  0x0000000100ed3b53 in App::DocumentObject::recompute() () from /Users/jmverdun/git/build/lib/libFreeCADApp.dylib
#7  0x0000000125b30abd in FemGui::TaskDlgMeshShapeNetgen::accept() () from /Users/jmverdun/git/build/Mod/Fem/FemGui.so
#8  0x000000010040dac4 in Gui::TaskView::TaskView::accept() () from /Users/jmverdun/git/build/lib/libFreeCADGui.dylib
which is

Code: Select all

double* SMDS_MeshNode::getCoord() const
{
  return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myVtkID);
}
We might be needing to open some VTK context perhaps ? (I am probably saying the most stupid things, but this is just the results of a quick dirty try). Anyway perhaps Ickby could be helpfull on this ;) now that FreeCAD compile with OCCT 7, we need to make it executable on the two meshing module.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby vejmarie » Wed Apr 27, 2016 9:41 pm

Good news as of tonigth the mesher workbench is now working with OCCT 7 and Salome 7.7.1 code from my repo.
Next step the Fem module and the port will be done ;). I will need some help to test all of this on other O/S than MacOS.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby vejmarie » Thu Apr 28, 2016 7:59 am

@bernd,

I just have published the Netgen source tree I am using in a quick and dirty mode on https://github.com/vejmarie/Netgen.git . Feel free to upload it it does contain the "small" fixes required to work with OCCT 7. I never give a try to Netgen 6 which might be including them, as I didn't had the time up to now, but if Netgen 5.3.1 works I don't see too many showstopper to move to 6 quickly after.

If you configure it you need to have something like this

./configure --with-tcl=/opt/local/lib --with-tk=/opt/local/lib --enable-occ --with-tclinclude=/opt/local/include --enable-shared --enable-nglib CXXFLAGS=-DNGLIB_EXPORTS --includedir=/usr/local/include/opencascade

by adapting your pathes to the relevant place. Then after just kick off a make install.

-> The default installation directory will be into /opt/netgen, your FreeCAD master CMakeList.txt file shall be setup to point to that directory otherwise you will see some dlopen issue when you will kick off the Fem or Mesher workbench.
Good luck keep me posted if you have any issues.

vejmarie
User avatar
bernd
Posts: 8332
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby bernd » Fri Apr 29, 2016 4:32 am

Started to get it compiled ... Occt worked out well.

I missed that it needs vtk, which is somehow broken on Debian (installed to non standard location but triggered as it would be installed in standard location). I need to fix this first. I may compile vtk myself ...

bernd
User avatar
bernd
Posts: 8332
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby bernd » Sun May 01, 2016 8:42 pm

got FreeCAD compiled with vtk. YEAH I can use ickbys output stuff now ! But back to occt 7.0.0 ...
jmaustpc wrote: Then when you configure FreeCAD, once again run Cmake-Gui, it will find the default OCE on the first run through Configure, you then just change the directories for OCE to point at the version you want to use with the file browser in Cmake-Gui.
I compiled OCCT 7.0.0 (make and make install to /usr/local) . The OCE_DIR of cmake directs to /usr/lib/x86_64-linux-gnu/oce-0.15 but unfortunally occt installed nothing in /usr/local/lib only in /usr/local/include/opencascad But this one does not work.

Code: Select all

Build type: 
CMake Warning at src/3rdParty/salomesmesh/CMakeLists.txt:21 (find_package):
  By not providing "FindOPENCASCADE.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "OPENCASCADE", but CMake did not find one.

  Could not find a package configuration file provided by "OPENCASCADE" with
  any of the following names:

    OPENCASCADEConfig.cmake
    opencascade-config.cmake

  Add the installation prefix of "OPENCASCADE" to CMAKE_PREFIX_PATH or set
  "OPENCASCADE_DIR" to a directory containing one of the above files.  If
  "OPENCASCADE" provides a separate development package or SDK, be sure it
  has been installed.


CMake Error at src/3rdParty/salomesmesh/CMakeLists.txt:22 (find_package):
  By not providing "FindMEDFile.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "MEDFile", but
  CMake did not find one.

  Could not find a package configuration file provided by "MEDFile" with any
  of the following names:

    MEDFileConfig.cmake
    medfile-config.cmake

  Add the installation prefix of "MEDFile" to CMAKE_PREFIX_PATH or set
  "MEDFile_DIR" to a directory containing one of the above files.  If
  "MEDFile" provides a separate development package or SDK, be sure it has
  been installed.


Configuring incomplete, errors occurred!
Last edited by bernd on Sun May 01, 2016 8:47 pm, edited 1 time in total.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby vejmarie » Mon May 02, 2016 7:14 am

Hi Bernd,

You just need to install the MED library which is available on the OCCT website.If you need just ping me, it took me some time to find it ;)

vejmarie
User avatar
bernd
Posts: 8332
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Why does FEM meshing doesn't generate volume elements in some cases

Postby bernd » Mon May 02, 2016 5:38 pm

vejmarie wrote:You just need to install the MED library which is available on the OCCT website.If you need just ping me, it took me some time to find it ;)
These ones https://packages.debian.org/jessie/libmed-dev ? I have them installed already !