Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2018-09-14 12:35:39

dbar
Member
Registered: 2018-06-02
Posts: 4

How to Define a mesh to use it in python script

Hello everyone,

I'm trying to export a mesh from Salome to SU2 format to perform calculation under SU2. SU2 only support SU2 mesh format. SU2 can also converts CGNS mesh to SU2  but in my case when I'm exporting directly my mesh from Salome to CGNS I lost all markers or element groups defined in Salome. So SU2 don't fine any markers to set boundary conditions.

So I found a python script that could directly export my mesh from Salome to SU2 called "cfdmsh.py". There is a function ExportToSU2 in which I need to call my mesh which is on Salome study. When I put the name of my mesh (already compute and with the name write in Salome Interface) it says to that the variable is not define.

So I supposed there is no link between mesh name under Salome interface and python script. I wonder how I could make this link? How define my mesh to call it after in python script.

Thank you for you help

Offline

#2 2018-09-14 15:01:49

dbar
Member
Registered: 2018-06-02
Posts: 4

Re: How to Define a mesh to use it in python script

I finally find way with following script in case if some people would be in my case :

>>> import SMESH
>>> mesh1=salome.myStudy.FindObjectByPath("/Mesh/Mesh1")
>>> mesh2=mesh1.GetObject()
>>> ExportSU2File (mesh2, "SU2_Mesh")

Offline

Board footer