CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

Salome cgns format mesh to SU2

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 2 Post By bennn
  • 1 Post By time-
  • 1 Post By giovanni.medici

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2017, 17:49
Post Salome cgns format mesh to SU2
  #1
Member
 
João Lourenço
Join Date: Jan 2017
Posts: 32
Rep Power: 8
JPBLourenco is on a distinguished road
Hey everyone!

I'm trying to create a mesh around a 2D airfoil in Salome to export in .cgns format. I want to run the mesh file in SU2 but I'm with some problems. I have a configure file in SU2 which I change the mesh format from su2 native format to cgns format since Salome don't export in su2 native format.

My problem is when I export the mesh from Salome in cgns format, the name of the boundaries, who I define in Salome, change. I run the SU2 program and I have an error message saying the name is not define in the cgns mesh file. But I define the name that I want for the boundaries in Salome. The name of the boundaries need to be define in Salome, right?

Have anyone try to generate a mesh in SALOME, 2D or 3D, export in cgns format and run in SU2, without problems? Is this possible?

Thanks for your attention.
JLourenco

Last edited by JPBLourenco; June 30, 2017 at 05:23.
JPBLourenco is offline   Reply With Quote

Old   July 1, 2017, 09:16
Default
  #2
Member
 
Ole Burghardt
Join Date: Mar 2016
Location: Kiel, Germany
Posts: 59
Rep Power: 8
Sprotte is on a distinguished road
Hi,

yes, it is. My guess is that you didn't really create boundary element groups in your mesh (but just gave some geometry parts a name, for example) so that they are simply not contained in the CGNS-file.

If that is not the case and the problem arises somewhere else, here is a link to a powerful python-Plugin for SALOME which contains the function "ExportSU2File" to export your mesh directly to a .su2-file:

http://tougeron-cfd.com/downloads/cfdmsh/4.0/

Hope this helps. Regards,
Ole
Sprotte is offline   Reply With Quote

Old   October 24, 2018, 03:52
Default
  #3
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Quote:
Originally Posted by Sprotte View Post
Hi,
here is a link to a powerful python-Plugin for SALOME which contains the function "ExportSU2File" to export your mesh directly to a .su2-file:

http://tougeron-cfd.com/downloads/cfdmsh/4.0/
Hi,
I was interested in cfdmsh plugin but the link is broken as the server ain't reachable.

Does anybody know if there is a mirror anyware?

-time
time- is offline   Reply With Quote

Old   December 19, 2018, 22:29
Default
  #4
Member
 
benoit paillard
Join Date: Mar 2010
Posts: 95
Rep Power: 14
bennn is on a distinguished road
Hi all,


I was also quite sad to see that William Tougeron stopped his activity.


I kept a copy of cfdmsh plugin though, it is attached.


Thumbs up to William, his tool is pretty good indeed !
Attached Files
File Type: zip cfdmsh.zip (58.1 KB, 104 views)
imamwfgf and Aleksandr like this.
bennn is offline   Reply With Quote

Old   January 30, 2019, 10:21
Default
  #5
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
Quote:
Originally Posted by bennn View Post
Hi all,


I was also quite sad to see that William Tougeron stopped his activity.


I kept a copy of cfdmsh plugin though, it is attached.


Thumbs up to William, his tool is pretty good indeed !

Hi,

I am new to Salome. Do you mind explaining how to activate this plugin? I've tried putting it in the plugin folder but then nothing happens after I start Salome up. Thank you.

Will
imamwfgf is offline   Reply With Quote

Old   January 30, 2019, 11:28
Default
  #6
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Hi Will,
in order to activate/use a python script in Salome you need to read the .py file using CTRL+T (or menu File >> Load Script) and select the script file (put it into a easy to reach directory).
At that point from the python console you can call the functions.
I didn't try cfdmsh as I moved from SU2 to OF for now so I can't tell what you need to do exactly but I think you should call:
Code:
ExportSU2File()
while your mesh is selected in the object browser.
If you get any errors try to post them.
I don't think this script is compatible with latest Salome (9.2) as now Salome is single study and has moved to python 3.6 so this should be ported in order to work.
Bye
time- is offline   Reply With Quote

Old   January 30, 2019, 14:25
Default
  #7
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
Hi Mattia,

Thanks for the reply. It indeed is having errors.

Code:
Traceback (most recent call last):
  File "input", line 1, in <module>
  File "string", line 542
    print "[X] The object", object, "doesn't exist in the study tree."
                         ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("[X] The object", object, "doesn't exist in the study tree.")?
Any thoughts?

In case the plugin doesn't work out, do you mind sharing how to assign boundaries on 2D meshes for SU2 in Salome? I tried adding the boundaries to groups of edges and then export to a cgns file but it doesn't seem to carry the boundary names over. All SU2 can see is one random boundary name.

I would love to staying in OpenFOAM world but this shape optimization function in SU2 looks very interesting. :P

Any help is much appreciated.

Will
imamwfgf is offline   Reply With Quote

Old   January 31, 2019, 10:13
Default
  #8
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Hi Will,
which version of Salome are you using?
I just called the function and it works flawlessly on Salome 8.3.0 on Windows 10.
I didn't try on 9.2 yet but I'll let you know.

Anyways I think the error you are getting is because you didn't select the mesh prior to method calling.

Just select your mesh with already created groups (same as exporting in other formats) and while it's selected in the object browser you call ExportSU2File() in the python console and you should find the exported .su2 file in the WORK directory.

It worked for both 2D and 3D meshes.

Let me know how it goes.
Bye
time- is offline   Reply With Quote

Old   January 31, 2019, 10:39
Default
  #9
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
Mattia,

I am using version 9.2 on Ubuntu 16.04.

I can export 2D meshes to OpenFOAM with Salome with no problem. But OpenFOAM is not really 2D so it doesn't really mean anything I guess.

So to clarify the steps, what I am doing now is start up Salome -> load my already meshed file -> select the mesh with groups created -> select "load script" under file -> error pops up.

Did I do something wrong? I am going to try it with 8.3.0 on Windows 7 now.

Will update when I finish trying.
imamwfgf is offline   Reply With Quote

Old   January 31, 2019, 11:34
Default
  #10
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Hi Will,
I just tried with Salome 9.2 and the script fails. The problem is the python version used in newest Salome (python 3) while the script (and previous Salome releases) uses python 2.
It's not a big deal. You can stick to Ubuntu and install Salome 8.5.0.


You can do your work on 9.2, export the mesh in MED format, import it in 8.5 and export su2 file.


Or you could just stick to 8.5


Or you could port python2 script to python3.
This specific error is easy to fix, just change:
Code:
print " bla bla bla"
to this:

Code:
print("bla bla bla")
This will fix print statement error but I can't tell if the plugin will be compatible between 8.x and 9.x version.


Bye
ander likes this.
time- is offline   Reply With Quote

Old   January 31, 2019, 11:48
Default
  #11
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
It worked with 8.3.0 on Windows 7. I am not sure why it doesn't work with 9.2 on Ubuntu 16.04. I will do more testings and see which versions support it and what not.

Thanks for the help.

Edit: Didn't see your post before I posted mine. Sounds good I will do that. Thanks again. That was really helpful.

Will
imamwfgf is offline   Reply With Quote

Old   January 31, 2019, 11:57
Default
  #12
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Using 2to3 python script it fixed syntax error but the function won't work.
There are some breaking changes between 8.x and 9.x Salome python interfaces and you should ask in Salome forum for script porting support.


If you are lucky you'll find some help
Unfortunately documentation ain't that explicit
time- is offline   Reply With Quote

Old   January 31, 2019, 12:27
Default
  #13
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
I see. I am happy with just using 8.3 for now.

I wish I know how to export the correct .cgns that SU2 recognizes. The .su2 mesh exported from the script is giving me error when I run SU2. I'll try meshing something super simple and test it again. Are the meshes exported with the script running fine for you on SU2?
imamwfgf is offline   Reply With Quote

Old   January 31, 2019, 12:41
Default
  #14
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
I can't tell as I don't have a working SU2 environment anymore. I'll try when I get some time but I can't promise anything.

Can you post the error?
time- is offline   Reply With Quote

Old   January 31, 2019, 12:53
Default
  #15
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
Yeah.

Code:
---------------------- Read Grid File Information -----------------------
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
[#:07660] *** Process received signal ***
[#:07660] Signal: Aborted (6)
[#:07660] Signal code:  (-6)
[#:07660] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10330) [0x7f64aac1f330]
[#:07660] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f64aa880c37]
[#:07660] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7f64aa884028]
[#:07660] [ 3] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x155) [0x7f64ab3a9535]
[#:07660] [ 4] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5e6d6) [0x7f64ab3a76d6]
[#:07660] [ 5] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5e703) [0x7f64ab3a7703]
[#:07660] [ 6] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5e922) [0x7f64ab3a7922]
[#:07660] [ 7] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x7d) [0x7f64ab3a7e0d]
[#:07660] [ 8] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znam+0x9) [0x7f64ab3a7ea9]
[#:07660] [ 9] SU2_CFD() [0xac74fa]
[#:07660] [10] SU2_CFD() [0xacf200]
[#:07660] [11] SU2_CFD() [0x83472e]
[#:07660] [12] SU2_CFD() [0x835c03]
[#:07660] [13] SU2_CFD() [0x40e4f3]
[#:07660] [14] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f64aa86bf45]
[skynet:07660] [15] SU2_CFD() [0x7f4a9f]
[skynet:07660] *** End of error message ***
Aborted (core dumped)
I attached the test mesh file im using. It's basically an inner and outer circle with boundary names farfield and airfoil. I am on SU2 6.1.
Attached Files
File Type: zip testMesh.zip (153.0 KB, 6 views)
imamwfgf is offline   Reply With Quote

Old   January 31, 2019, 15:05
Default
  #16
New Member
 
Will
Join Date: Jun 2013
Posts: 17
Rep Power: 11
imamwfgf is on a distinguished road
I think I found a quick solution. The exported .su2 meshes by the script outputs values in .su2 files like

NDIME = 2
NELEM = 2 and so on,

for some reason SU2 does not like the extra space before the equal sign. So just replace all the " =" with "=" and you should be good to go. At least that got my test case running.

Big thanks to Mattia for the help.

Will
imamwfgf is offline   Reply With Quote

Old   November 14, 2019, 04:07
Default
  #17
Member
 
Giovanni Medici
Join Date: Mar 2014
Posts: 38
Rep Power: 10
giovanni.medici is on a distinguished road
I'm sorry to re-open an old thread, but I was wondering whether any of you is actually able to output a CGNS mesh from Salome, that can be given as input to SU2.

I'm currently trying with a simple 2-D mesh. In Salome, Mesh Module I've grouped the edges (Create Group ... --> Group on Geometry ) so to add them to the CGNS.

I've performed some tests (with the cgnstools, i.e. cgnslist, cgnsconvert) and as far as I can tell, Salome writes the CGNS in hdf5 binary format (while SU2 6.0 is expecting it in ADF format, but I can convert it with ease).
Moreover Salome adds the type of element (namely BAR_2 and TRIA_3 ) which apparently are not interpreted as desired by SU2.
Is there a way to ignore the BAR_2 and TRIA_3 Marker so that the real BC can be read?

Thanks

cgnslist console:
Code:
ADF MotherNode
    +-CGNSLibraryVersion
    +-domain
        +-SMESH_Mesh
            +-ZoneType
            +-GridCoordinates
            |   +-CoordinateX
            |   +-CoordinateY
            |   +-CoordinateZ
            +-BAR_2 1 - 484
            |   +-ElementRange
            |   +-ElementConnectivity
            +-TRI_3 485 - 33682
            |   +-ElementRange
            |   +-ElementConnectivity
            +-ZoneBC
                +-Top
                |   +-PointList
                |   +-GridLocation
                +-Outlet
                |   +-PointList
                |   +-GridLocation
                +-Inlet
                |   +-PointList
                |   +-GridLocation
                +-Btm
                |   +-PointList
                |   +-GridLocation
                +-Wall
                    +-PointList
                    +-GridLocation


SU2 console

Code:
---------------------- Read Grid File Information -----------------------
Reading the CGNS file: testWedge_ADF6.cgns.
CGNS file contains 1 database(s).
Database 1, domain: 1 zone(s), cell dimension of 2, physical dimension of 3.
Zone 1, SMESH_Mesh: 16842 vertices, 33198 cells, 0 boundary vertices.
Reading grid coordinates.
Number of coordinate dimensions is 3.
Loading CoordinateX values.
Loading CoordinateY values.
Loading CoordinateZ values.
Number of connectivity sections is 2.
Loading section BAR_2 1 - 484 of element type Line.
Loading section TRI_3 485 - 33682 of element type Triangle.
Successfully closed the CGNS file.

Loading CGNS data into SU2 data structures.
Two dimensional problem.
33198 interior elements.
16842 grid points.
1 surface markers.
484 boundary elements in index 0 (Marker = BAR_21-484).
I'm using Salome 9.3.0, Windows, and SU2 6.0 Windows.
I also tried to use cfdmsh python script (and changed all the prints lines to the 3xx format), but I can not run it successfully. Nevertheless I would prefer binary meshes files so to limit the file size for big meshes.
giovanni.medici is offline   Reply With Quote

Old   November 14, 2019, 07:51
Default
  #18
New Member
 
Mattia
Join Date: May 2018
Location: Novara - Italy
Posts: 29
Rep Power: 6
time- is on a distinguished road
Hi Giovanni,
have you tried with standard CGNS tool "hdf2adf"?
Regarding cfdmsh script, beside converting print statements into function calls you need to convert a couple of calls:
Code:
geompy = geomBuilder.New(salome.myStudy)
becomes
Code:
geompy = geomBuilder.New()
and maybe something else. Just check out script migration tips in salome docs. I don't remember where it is, sorry.
time- is offline   Reply With Quote

Old   November 14, 2019, 10:07
Default
  #19
Member
 
Giovanni Medici
Join Date: Mar 2014
Posts: 38
Rep Power: 10
giovanni.medici is on a distinguished road
Hi Mattia,
Thanks for the very quick reply, as far as I can tell, hdf2adf directly calls cgnsconvert.exe, so unfortunately it doesn't work.
Moreover I've changed the lines in the cfdmsh script, as well as:


Code:
smesh = smeshBuilder.New(salome.myStudy)
into 
smesh = smeshBuilder.New()
But when I click on the mesh, in the mesh module, and run the function, the same error appears :
Code:
ExportSU2File("domain","exportedMesh")  or ExportSU2File()

[X] The input object is not a mesh or the Mesh module was not yet loaded.
Maybe I shall check the script migration tips as you suggested. Nevertheless I would very much prefer to use the CGNS as file format, as they can be considerably lighter.

Do you know whether there is a salome tutorial file that can be used as starting point just to be sure that the hdf I've created is formatted correctly?

I tried, without luck, unfortunately, to put the BAR_2 field in the interior, with the command:
Code:
% Internal boundary marker(s) e.g. no boundary condition (NONE = no marker)
MARKER_INTERNAL= ( BAR_21-484 )
The solver effectively overrides the BAR_2 elements, but overrides the BC as well, which results in an odd simulation.

Last edited by giovanni.medici; November 15, 2019 at 03:15. Reason: Updated strategy
giovanni.medici is offline   Reply With Quote

Old   November 18, 2019, 03:11
Default
  #20
Member
 
Giovanni Medici
Join Date: Mar 2014
Posts: 38
Rep Power: 10
giovanni.medici is on a distinguished road
I've updated the cfdmsh.py script, so to use ExportSU2File with SALOME 9.3.0. I've tested it under Windows10, and SU2 6.0.0, with a 2D mesh.
The script contains a huge amount of functions, which have not been tested, and are very likely to fail (in SALOME 9.3.0), due to changes in the SALOME dictionary.
Attached Files
File Type: zip cfdmsh.zip (55.8 KB, 70 views)
bkay likes this.
giovanni.medici is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Gambit problems Althea FLUENT 22 January 4, 2017 04:19
CGNS mesh format B_Ouissem SU2 2 August 20, 2015 15:10
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
[Commercial meshers] Mesh conversion from Tecplot format - help atmcfd OpenFOAM Meshing & Mesh Conversion 11 February 22, 2014 07:34


All times are GMT -4. The time now is 12:32.