Elmer module for Salomé

Discussion about coding and new developments
Post Reply
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Elmer module for Salomé

Post by mzenker »

Hi,

in a previous post, I had a short discussion with Peter Raback on integrating Elmer into one of the ongoing integrated simulation environment projects (viewtopic.php?f=4&t=3485&p=12160&sid=75 ... b42#p11534).
Now I have started to learn Salomé, and I am impressed. It has a really powerful geometry and mesh module. It is able to deal with the multibody problem which has haunted me for years (no conformal mesh at the interface). They have integrated ParaView as postprocessor. And it runs reasonably stable under Windoze (so far, at least). So as of today, Salomé is my favorite candidate for attempting to integrate Elmer. The target would be to have the whole workflow integrated in one platform.

I will look into that in a background task in the next time. If someone out there (including the Elmer team of course ;) ) is willing (and has some time) to join the effort, I would be happy.

I would like to evaluate if a part of the ElmerGUI code could be reused. My attempt would be to remove the ElmerGUI mesh viewer and use most of the remaining parts as a Salomé module. Is there some kind of documentation about the inner workings of the GUI? From a first glance at the source, it is a mixture of C++ and Python with Qt. Ideally, one would try to build a modified version which shares code with the full ElmerGUI, but can be compiled as Salomé module. There has been a similar project with a thermal FEM solver called SYRTHES some time ago, see this presentation (in french) http://files.salome-platform.org/Salome ... e_RUPP.pdf.

So that is the starting point I would like to take. I am still learning to use Salomé as geometry builder and mesher, and have just had a very short glance into the documentation on how to build modules for Salomé, and into the ElmerGUI code. But my feeling is that it can be done. I cannot predict how much time I will have to devote for that project. But it is definitively exciting. So as I said, if someone wants to join, you are welcome!

Matthias
RaJa
Posts: 77
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Re: Elmer module for Salomé

Post by RaJa »

Hi Matthias,

I just saw your reference to this post. An Elmer module for Salome would be really neat. Since we seem to use the same software tools to deal with FEM problems, maybe we could join forces. Unfortunately, my C++ knowledge is quite rusty. So I would have to focus on the Python part. As I am currently having a 9-5 job, I could invest some weekends and mabye some rainy nights. And as the juggling between different tools and GUIs became time-killing during the latest project, I would be happy to improve the situation.

Did you already had some deeper thoughts about how an integration could be achieved? I would prefer some kind of Elmer GUI as a Salome module, so that functionality is the same. We would just have to define some kind of interface to bring the meshes into Elmer. Basically, the "sif-file generation" is all that is "required". Invoking the solver is the easier part.

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

Re: Elmer module for Salomé

Post by mzenker »

Hi Rainer,

thanks for reactivating the issue.
As I said in the other post, I did not even start to work on that project due to lack of time. I just did some investigations here and there. Building a Salomé module seems to be more involved than I thought, and learning how to do it and getting it to work seems not a matter of a few hours. In addition, we would have to use Salomé's the med format if we want real integration in Salomé, requiring to write converters for Elmer mesh and output formats.
Since you have seen the other post (I assume you are talking about this one), you have also noticed that there is the alternative to build a FreeCAD module. This seems to be much easier than for Salomé. But as far as I have seen, the FreeCAD meshing module is by far not as mature as Salomé's, even if it is said to be based on the same code. I did not succeed to make a partition of several bodies, and to export the mesh in a decent format.
So what I think of at the moment as starting point is a kind of rewrite of ElmerGUI in Python (using PyQt) intended to work with, but not within Salomé. It would just contain the menus needed for sif construction, using the edf files from ElmerGUI. The mesh would be converted by calling elmergrid. The bodies and boundaries would be named, since the names from Salomé would be imported. No mesh display would ne needed, since we could have Salomé open in another window to see what the names correspond to. Then the solver would be called, and that's it.
I hope that this tool would be more stable and easier to maintain, debug and extend than ElmerGUI, and more people could contribute. And one day, it could serve as starting point for a real Salomé or FreeCAD module.

I'm running out of time for today - what do you think?

Cheers,

Matthias
RaJa
Posts: 77
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Re: Elmer module for Salomé

Post by RaJa »

Hi,

I had almost the same idea, but as a generic window generator that takes the Elmer edf-files as input when a certain solver is activated. It would then generate a form out of the file input so that one could change the solver settings. So you would not have to rewrite everything with new features. Only thing to to would be paying attention to the format and contents of the edf files. That could than serve as one step within the workflow to create the sif-file.

Maybe one could adapt the meshing module of Salome by integrating parts of Elmer workflow there. When dealing with multiple bodies and faces you usually create groups. Now we could hook into the context menu and add options like "define boundary condition" or "define bode properties". So we could use the graphical display of Salome to set the correct properties and afterwards via an additional step generate the unv-mesh and the Elmer-mesh files as well as the sif file. That would not involve to much coding for a complete Salome module. Moreover, we would not have to convert meshes betweend modules. Maybe we can get the Salome team to help us on that part.

I also had a look at FreeCAD after reading the other topic and a struggled with the same multi-body mesh problem. So I will stick to Salome for my meshs and maybe use the parametric CAD of FreeCAD when Salome is not sufficient anymore.

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

Re: Elmer module for Salomé

Post by mzenker »

Hi Rainer,

add Elmer specific GUI elements to the MESH module sounds like a good idea to me. :)
I have tried to experiment with a mini-module in Python some time ago, see this post in the Salomé forum. But I didn't find the time to pursue that further.
I have also found a page in the documentation explaining how to add Python plugins to Salomé: http://docs.salome-platform.org/latest/ ... nager.html
I think we can take that as starting point.
I will not have much time to spend for this until the end of September, since I am working on a project which I need to terminate until then. So if you have the time now, just go ahead - I will be happy to discuss and test - and participate in the coding as soon as I have more time...

Cheers,

Matthias
RaJa
Posts: 77
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Re: Elmer module for Salomé

Post by RaJa »

mzenker wrote:I have also found a page in the documentation explaining how to add Python plugins to Salomé: http://docs.salome-platform.org/latest/ ... nager.html
This is exactly what I had in mind.
mzenker wrote:So if you have the time now, just go ahead - I will be happy to discuss and test...
OK, I will have a look. But, as I am kind of busy during workdays, that will be restricted to the weekends. Anyway, I will start looking into the Qt GUI and how to get this window generator for the Solver settings. That can then be used as a template for generating the windows for boundary conditions/body properties. Fortunately, one of my coworkers started creating some Qt-GUIs (in C) just some weeks ago. Maybe he gan give me a short introduction.

Regards,
Rainer
RaJa
Posts: 77
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Re: Elmer module for Salomé

Post by RaJa »

Hi,

I have started putting some thoughts into this little project.

First, there is a github-rep that contains my output and a small install instruction. So far it is just the interaction with Salomes plugin manager:
https://github.com/physici/ElmerSalome

Next item on the list is the graphical interface. Fortunately, Elmer is based on Qt too, so we could benefit from the stuff that the Elmer-guys are doing. My idea is to use the .ui-files from the github-rep to recreate the windows by porting and adapting the corresponding cpp-files to Python. They seem to be general containers where modifications are implemented by the .edf-files that are distributed during installation.

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

Re: Elmer module for Salomé

Post by mzenker »

Hi Rainer,

I have downloaded your start module files and tried to get them to run without the setting the SALOME_PLUGINS_PATH environment variable (under Windoze). I have made a directory MODULES\GUI\RELEASE\GUI_INSTALL\share\salome\plugins\gui\Elmer in my Salome installation directory and copied the ElmerSalome directory and the salome_plugins.py file there. Then the salome_plugins.py is executed, and I can create a basic message box from Tools -> Plugins -> ELMER. I will see if I find the time to get the "import elmer_window_handler" to run again.

Cheers,

Matthias
RaJa
Posts: 77
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Re: Elmer module for Salomé

Post by RaJa »

Hi,

It should work when you change line 17 in the salome-plugins.py. This line declares the additional search path for python that will be appended to the environment in the line 18.

Usually,

Code: Select all

path = os.path.dirname(os.path.abspath(__file__))
returns the path of the current interpreted file. But I do not know if this works in Salome too.

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

Re: Elmer module for Salomé

Post by mzenker »

Hi Rainer,

a search in the Salomé forum revealed that it works when we do the following:

In salome_plugins.py, add

Code: Select all

import inspect
and change the line 17 to

Code: Select all

plugin_path = os.path.dirname(inspect.getfile( inspect.currentframe() ))  + "\\ElmerSalome"
Now we have a starting point!
I will have to install Elmer and Salomé at home now to help with the coding on evenings and weekends...

Cheers,

Matthias
Post Reply