|
[Sponsors] |
Tool to convert OpenFoam mesh to SU2 mesh (2D and 3D) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 11, 2013, 09:39 |
Tool to convert OpenFoam mesh to SU2 mesh (2D and 3D)
|
#1 |
Member
Join Date: Sep 2013
Posts: 43
Rep Power: 12 |
Since I needed to convert OpenFoam meshes to SU2 format (*), I have developed a python tool that does it.
Its use is very easy and it allows you to convert: - "true" 3D meshes with hexas, tetras, prisms and pyramids elements - 3D meshes obtained by extrusion (of one or several cells along X, Y or Z) to 2D meshes (so it converts hexas and prisms in quads and triangles) How to use it (on Linux but it must be very similar under other OS): 1) Download the file "ConvertOpenFoam2SU2.py" (in attachment) 2) Create an input file (templates for 2D or 3D cases are given in attachment) 3) Write in your terminal, in the directory that contains the file "ConvertOpenFoam2SU2.py": "python ConvertOpenFoam2SU2.py" (without quotes) 4) The tool asks the name of the input file: write it! 5) After some comments to tell what the code is doing, the mesh is created! Format of the input file (4 lines for 3D meshes, 5 lines for 2D meshes): Line 1: Path to openfoam mesh files (it should end with "/polyMesh") Line 2: Path where to write the .su2 mesh file Line 3: Name of the .su2 mesh file (for example "airfoil.su2") Line 4: "2D" or "3D" Line 5: "X", "Y" or "Z" to give the axis of projection (only for 2D) Kind of mesh supported: Only 3D OpenFoam meshes, with hexas, tetras, pyramids and prisms cells are supported. Validation: The tool has been tested for the following meshes (and it works): - 2D conversion from a 3D mesh with hexas - 3D conversion from a 3D mesh with hexas - 3D conversion from a 3D mesh with tetras and prisms Remark: For "big" meshes (several million cells) take care that it can be quite long (several minutes) and use a lot of RAM... Python code: If needed, you can modify it. It is not very long and I have written some comments to help developers to understand what is done. I hope this tool will be helpful! Laurent (*) In fact, I use meshes in Fluent .msh format that I convert in a first time in OpenFoam format (with fluentMeshToFoam command) and then to SU2 format, so if anyone has a method to convert directly Fluent meshes (.msh) directly to SU2 without using Fluent, it would be easier for me... And I woud avoid bugs of fluentMeshToFoam... |
|
|
|