Salome multi-body meshes form CAD files with python script
Posted: 21 Nov 2012, 01:03
There is a description in the Wiki how to create a multi-body mesh with Salome. This works perfectly but assumes that the geometry is defined within Salome. And the process is fairly complicated including several steps.
I found that the process also works when the bodies are loaded into Salome from CAD files, usually IGES or STEP. This allows to generate the geometry in a graphical program of your choice that can write IGES or STEP and then mesh them in Salome. (I use SketchUp with an IGES export Plug-In to define my models)
To make the complicated process easier I have created a Python script that automates it.
Just edit a copy of the script to import your bodies and start it within Salome. (or start Salome with the script as a parameter) The script does the rest.
If the bodies are saved to separate CAD files the order of import also defines their index in the mesh. The boundaries however have only one index so the boundaries have to be separated in elmerGrid. The resulting mesh.unv can be opened in elmerGrid. To split the surface select it and use "Divide Surfaces" at an angle of 70 degrees. The mesh can then be saved in elmer format.
One Problem of Salome is that it is not very stable in a Windows environment. Starting up the GUI modules results in frequent crashes and even blue-screens.
The good news is that with the script this does not happen, at least at my computer. I start "run_salome.bat" with the script as a parameter. After the script finished I close down Salome immediately and restart it if needed in the same way. In this mode of operation it works reliably without crashes.
Rainer
I found that the process also works when the bodies are loaded into Salome from CAD files, usually IGES or STEP. This allows to generate the geometry in a graphical program of your choice that can write IGES or STEP and then mesh them in Salome. (I use SketchUp with an IGES export Plug-In to define my models)
To make the complicated process easier I have created a Python script that automates it.
Just edit a copy of the script to import your bodies and start it within Salome. (or start Salome with the script as a parameter) The script does the rest.
If the bodies are saved to separate CAD files the order of import also defines their index in the mesh. The boundaries however have only one index so the boundaries have to be separated in elmerGrid. The resulting mesh.unv can be opened in elmerGrid. To split the surface select it and use "Divide Surfaces" at an angle of 70 degrees. The mesh can then be saved in elmer format.
One Problem of Salome is that it is not very stable in a Windows environment. Starting up the GUI modules results in frequent crashes and even blue-screens.
The good news is that with the script this does not happen, at least at my computer. I start "run_salome.bat" with the script as a parameter. After the script finished I close down Salome immediately and restart it if needed in the same way. In this mode of operation it works reliably without crashes.
Rainer