Integrating Elmer into FreeCAD FEM workbench

General discussion about Elmer
vejmarie
Posts: 4
Joined: 18 Jul 2016, 09:49
Antispam: Yes

Integrating Elmer into FreeCAD FEM workbench

Post by vejmarie »

Hi,

My name is vejmarie, I am working on FreeCAD for a couple of months and updated a few part of it since I started to work with this very good code. FreeCAD contains a FEM module, which aims to create a full CAD/Simulation toolchain from part design to simulation back and forward. We are far away from that step, but some implementation of Calculix and z88 have been successfull.

It happens that I work pretty closely to the Salome team (about 200m from them), and that the multiphysic approach of Elmer might be really interesting for our daily work in Open Hardware. My company is dedicated to designing computers using Open Hardware license and releasing most of the thing we can do. We have initiated a program to move from proprietary solutions (Solidworks, Hyperview, Flotherm etc ...) to OpenSource as to help contributor to our project to commit changes. Our flagship project is called RuggedPOD (http://ruggedpod.qyshare.com)

I have decided to start an integration of Elmer into FreeCAD, I am really really far away from it, there is a lot of things into ElmerGUI and ElmerPost, but I can use what has been done in FreeCAD to accelerate that. For the one who are interested to have a look just get there

http://forum.freecadweb.org/viewtopic.p ... 87#p131787

For the one who wants help me, just go on github http://github.com/vejmarie, I will initiate a branch on my FreeCAD repository for this work, I am quite convinced that using the key force of these two code could lead up to create a very nice piece of code.

I am doing that on my spare time currently so please accept my apologies if I could be late in some case as I am travelling a lot for my job.

vejmarie
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Integrating Elmer into FreeCAD FEM workbench

Post by mzenker »

Hi,

I was once about to start building an Elmer module for Salomé, see here. Unfortunately I did not find the time to really start working on it, but I still think that it would be desirable to have such a module. Salomé has a CAD module, a meshing module, and integrates ParaView as postprocessor. A solver module is the only piece missing for an integrated FEM environment.
If I understand correctly, you want to create a similar thing based on FreeCAD. You said you work "pretty closely to the Salomé team" - how does your approach relate to Salomé? I don't know FreeCAD - does it have the functionality that Salomé offers?
If not, shouldn't one consider to create synergies between FreeCAD and Salomé?

Matthias
crobar
Posts: 49
Joined: 30 Mar 2014, 14:50
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by crobar »

mzenker wrote:
I don't know FreeCAD - does it have the functionality that Salomé offers?

Matthias
I can answer this, FreeCAD is a far far superior solid modelling program than Salome, you can create complex parametrised models, that are built up in a tree like modern commercial modellers (so changes in one place propagate through the object and you don't have to start from scratch to make a small change to an object). There is also python based scripting, like with Salome, but with the advantage that it can run 'headless' as part of any normal python script, whereas Salome scripts have to run from within Salome. Both FreeCAD and Salome are based on the same OpenCASCADE geometry modelling kernal, but FreeCAD uses it in a more modern way.

FreeCAD now has basic meshing based on SMESH, the same code as in Salome, but only a small portion of the functionality of the Salome SMESH module is currently exposed, so it's much more limited.

FreeCAD is very modular and it is very easy to create new FreeCAD modules (workbenches) as they can be created entirely in python if you want. This encourages development.
vejmarie
Posts: 4
Joined: 18 Jul 2016, 09:49
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by vejmarie »

Hi Matthias,

FreeCAD is using OpenCascade as 3D engine and Salome SMESH module for meshing. I worked on getting latest SMESH , OCCT working with FreeCAD. The versions were totally outdated (OCE 6.7 and SMESH 5). The meshing technology is based on Netgen which is integrated as a module. There is still a lot of development, but we are able to make work Calculix and z88. There are some ongoing work with OpenFoam, and I started the Elmer port.

Salome CAD module is not parametric which is one major limitation. It will change shortly by integrating FreeCAD parametric solver. When I saied we are closed this is from a geographical perspecitive (Salome team is 200 meters from my office).

Salome and FreeCAD are both good approach. Salome is heavily used by scientific community while in FreeCAD we are more targetting hobbyist, developpers, hackers, and SMB's. FreeCAD CAD module is also far much better than SAlome one, while Salome Mesh management is probably one of the best I ever used.

So, there are soon a lot of synergies between both, and we even think at organizing a first joint meeting ;)

vejmarie
crobar
Posts: 49
Joined: 30 Mar 2014, 14:50
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by crobar »

vejmarie, are you and the Salome team aware of PythonOCC and their SMESH version? They've recently updated it to work with OCC 17, although I don't think their python interface for SMESH works yet.
vejmarie
Posts: 4
Joined: 18 Jul 2016, 09:49
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by vejmarie »

crobar wrote:vejmarie, are you and the Salome team aware of PythonOCC and their SMESH version? They've recently updated it to work with OCC 17, although I don't think their python interface for SMESH works yet.
Hi, I have "heard" and quickly looked at pythonOCC. Unfortunatly, I am not a python expert, I am far much more efficient with C/C++ (getting old sorry). Why, any specific interest or idea behind that ?
crobar
Posts: 49
Joined: 30 Mar 2014, 14:50
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by crobar »

vejmarie wrote:
crobar wrote:Why, any specific interest or idea behind that ?
A couple of reasons,

FreeCAD shape objects in python support easy translation to and from pythonOCC objects, so you could in theory create FreeCAD solids and easily mesh them using all the power of SMESH in the same script.

The other reason is that they have a working standalone patched SMESH build but that is different from the one currently bundled with FreeCAD. It would seem sensible for FreeCAD, Salome and pythonOCC to combine forces and all work on the same version of SMESH rather than duplicate efforts.

P.S. I also use C++ but often glue things together with python or similar.
vejmarie
Posts: 4
Joined: 18 Jul 2016, 09:49
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by vejmarie »

crobar wrote:
vejmarie wrote:
crobar wrote:Why, any specific interest or idea behind that ?
A couple of reasons,

FreeCAD shape objects in python support easy translation to and from pythonOCC objects, so you could in theory create FreeCAD solids and easily mesh them using all the power of SMESH in the same script.

The other reason is that they have a working standalone patched SMESH build but that is different from the one currently bundled with FreeCAD. It would seem sensible for FreeCAD, Salome and pythonOCC to combine forces and all work on the same version of SMESH rather than duplicate efforts.

P.S. I also use C++ but often glue things together with python or similar.
We just upgraded FreeCAD with latest SMESH version coming directly from Salome with the intend to stop forking things and follow parallel path. We report bugs to each other now and FreeCAD is currently able to MESH without any issue through SMESH either using python or C++ (the C++ side is far much better I agree). I will have a look to pythonOCC I promise, but currently the "framework" in FreeCAD is quite stable, and work is concentrated on Qt5 and Python 3 migration, moving to pythonOCC will require some work.
crobar
Posts: 49
Joined: 30 Mar 2014, 14:50
Antispam: Yes

Re: Integrating Elmer into FreeCAD FEM workbench

Post by crobar »

vejmarie wrote:
We just upgraded FreeCAD with latest SMESH version coming directly from Salome with the intend to stop forking things and follow parallel path. We report bugs to each other now and FreeCAD is currently able to MESH without any issue through SMESH either using python or C++ (the C++ side is far much better I agree). I will have a look to pythonOCC I promise, but currently the "framework" in FreeCAD is quite stable, and work is concentrated on Qt5 and Python 3 migration, moving to pythonOCC will require some work.
Ahh, ok, I see, I didn't know about this. That's great then! I wasn't really thinking of moving to pythonOCC, just thinking that they might have useful input on SMESH as they have their own version and also seem to have a very deep knowledge of the OCC C++ code so would probably have useful contributions.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Integrating Elmer into FreeCAD FEM workbench

Post by mzenker »

Hi,

all that sounds very interesting. So I will have a look on FreeCAD with SMESH and Elmer modules after the holidays (that is end of August for me :) ). At the very least I can test it and provide feedback, and if really module development is so much easier with FreeCAD, I might try to help with the Elmer module.
As I wrote in the other post, my vision would be to implement the ElmerGUI functionality (excluding postprocessing, here ParaView is the software of choice IMHO) in the module, so it would cooperate closer with SMESH and become more stable and comfortable to use.

Matthias
Post Reply