Personal tools
You are here: Home Forum Use Export to CGNS

Export to CGNS

Up to Use

Export to CGNS

Posted by Bacci David at November 10. 2012

Hi to all!

Recently I created a Mesh file and I converted in the CGNS format. However when i try to open from my flow solver (EDGE) it states that the file is not readable because is in HDF5 format. Also if i try to open with one of the cgns tools it continually states that the file cannot be open because is in HDF5 format.

Does anyone has any suggestions?

 

Thanks a lot

 

David

Re: Export to CGNS

Posted by Vadim SANDLER at November 12. 2012

Hello David,

It's not clear how you converted Mesh file to CGNS format. If you use ExportToCGNS function of SALOME Mesh module (menu File/Export/CGNS file), resulting CGNS file should be readable by cgns utilities.

For example, I succeded to see mesh data in the exported CGNS file with such utilities as cgnscheck, cgnsview, cgnsplot.

Regards,
Vadim.

Previously Bacci David wrote:

Hi to all!

Recently I created a Mesh file and I converted in the CGNS format. However when i try to open from my flow solver (EDGE) it states that the file is not readable because is in HDF5 format. Also if i try to open with one of the cgns tools it continually states that the file cannot be open because is in HDF5 format.

Does anyone has any suggestions?

 

Thanks a lot

 

David

 

Re: Export to CGNS

Posted by William Tougeron at November 12. 2012

Hello David,

According to my experience, the CGNS files exported with Salome cannot be imported in Edge properly.

But last year I developed a script to export directly meshes from Salome into the ASCII FFA format (.amsh format), that you can convert into .bmsh files with the Edge command ffaa2b.

This script should be available very soon from the www.vzlu.cz website. I let you know as soon as it will be.

Best regards,

William

Re: Export to CGNS

Posted by Bacci David at November 12. 2012

Thanks William

While I'm waiting for this script to be available can I ask you how you export meshes created in Salome to EDGE?

Thanks a lot

David

Re: Export to CGNS

Posted by William Tougeron at November 12. 2012

Actually, its not trivial at all... And since I did it one year ago, I can't remember preciselly how I did it. My script is pretty huge, but works very fine.

First you have to understand the .amsh file structure. Something like this, for a 3D mesh having two groups and two types of element inside the domain:

unstr_grid_data N 0 0 2
    title L 1 1 0
        'name of the mesh'
    region N 0 0 4
        region_name L 1 1 0
            'volume_elements'
        coordinates DF 3 443 0

all the node X coordinates
then all the node Y coordinates
then all the node Z coordinates
       

boundary N 0 0 2
            boundary_name L 1 1 0
                'Name of the group 1'
            belem_group N 0 0 2
                bound_elem_type L 1 1 0
                    'Type of the group 1 elements'
                bound_elem_nodes IF 4 36 0

all the Group_1 element first node IDs
then all the Group_1 element second node IDs
then all the Group_1 element third node IDs
etc.

       

boundary N 0 0 2
            boundary_name L 1 1 0
                'Name of the group 2'
            belem_group N 0 0 2
                bound_elem_type L 1 1 0
                    'Type of the group 2 elements'
                bound_elem_nodes IF 3 72 0

all the Group_2 element first node IDs
then all the Group_2 element second node IDs
then all the Group_2 element third node IDs
etc.

       

element_group N 0 0 2
            element_type L 1 1 0
                'Type of the domain elements'
            element_nodes IF 5 36 0

all the volume element first node IDs
then all the volume element second node IDs
then all the volume element third node IDs
etc.
       

element_group N 0 0 2
            element_type L 1 1 0
                'Type of the domain elements'
            element_nodes IF 4 1768 0

all the volume element first node IDs
then all the volume element second node IDs
then all the volume element third node IDs
etc.

Examples of element types: tria3, hexa4, quad4 for 2D ; tetra4, penta5, penta6, hexa8 for 3D.

This structure is just an example and changes depending how many groups you have, how many types of elements you have, etc.

Also the numbers above change according to the number of elements.

Then, you just have to write this file by reading the position of all the mesh nodes, then the ID of the nodes of all the elements of each group, then inside the domain, respecting this amsh file structure. Some times you have to invert the IDs of elements because the order in Salome and in Edge are different.

That's it...

Re: Export to CGNS

Posted by William Tougeron at November 12. 2012
OK, my HTML tags didn't work well. So I enclose a text file containing the .amsh file structure I gave below.
Attachments

Re: Export to CGNS

Posted by William Tougeron at November 12. 2012
Here I enclose a full .amsh file example.
Attachments

Re: Export to CGNS

Posted by William Tougeron at November 12. 2012
And here a dump of the Salome study from which I exported this .amsh file.
Attachments

Re: Export to CGNS

Posted by Bacci David at November 12. 2012

Thank you really much, I'll start to work on this material immediately!

Please let me know as soon as the script is available for download!!!

Thanks a lot!!!

David

Re: Export to CGNS

Posted by Yvan Fournier at November 21. 2012

Hello,

I am not sure this would work here, but going back to the original issue, when built with HDF5, CGNS comes with an adf2hdf and an hdf2adf utility. This is also the case in the build of CGNSlib provided with SALOME. You could try to run the latter on your exported file if your code was linked with a version of CGNS built without HDF5.

Best regards,

  Yvan

Re: Export to CGNS

Posted by William Tougeron at November 29. 2012

Hi Yvan,

The script is now available. I present it here :

http://www.salome-platform.org/forum/forum_12/238346311

To export an AMSH file after installation of this script (see the documentation), type in the Python console of the Salome GUI:

import cfdmsh
> cfdmsh.ExportAmshFile( 'Mesh_1' )<em>

replacing Mesh_1 by the name of your mesh in the study tree.

Best regards,

William

Powered by Ploneboard
Document Actions