This post is about how to export a Code_Aster compatible mesh from a widely used professional pre-processor: Altair HyperMesh™.
To read this article one will need some knowledge both in HyperMesh™ and in Code_Aster.
Special thanks to:
Dr. Enrico Bertocchi from “Enzo Ferrari” department at Unimore University for his precious help with the HyperMesh™ interface and testing the script,
Dr. Roberto Lugli for his support, suggestions and contacts
HyperMesh™ is a component of a very professional suite allowing to create/prepare geometries for finite element calculation, create complex meshes and writing a complete finite element study in a graphical way. Since it is also solver-agnostic, it is possible with a bit of scripting to use it to obtain a mesh readable from Code_Aster, groups included.
First of all, you will need an “export template”, that is an HyperMesh™ script which will allow us to extract information about nodes, cells and groups and write them in a specific text format. For a discussion about this method and documentation you can have a look at the first part of this forum post.
Since it is definitely too long to be included in a post, here you can download the mail.tpl template (you should decompress the zip archive after downloading: what you really need is the text file inside).
Now you also need to create a geometry in Altair HyperMesh™, mesh it, add some constraints, some loads, etc. In this case, a simple cube, with pression over the top face, constrained at some points at the bottom.
Please have a look at the image below, you will need to:
- Choose the “export arrow” from the Toolbar
- Choose “Export Solver Deck” from the submenu (second from left)
- File Type : select “Custom”
- Template : write or select the exact location for the file “mail.tpl”
- File : write a path and a name for the output result, use something like “cube.mail” (you should use the “.mail” extension)
- Click on the “Export” button
- When the export is complete, you should see a “Finished” message in the left bottom part of the window
This script should create a valid file for Code_Aster in MAIL format.
By looking at the conversion result, you will see that the script created much more than node coordinates and element connectivity: many node and element groups are present.
The groups will be really helpful when writing the Code_Aster command file, for example “GN_DDLX” are nodes that should be blocked in the DX dof, GN_DDLY for DY, etc.
Now you can use this file in any Code_Aster study, for example by using this line in a command file :
... MAIL=LIRE_MAILLAGE(FORMAT='ASTER', VERI_MAIL=_F(VERIF='OUI',),); ...
If you want, you can also convert this file in the MED format, which is a binary format that you can open using Salome or Gmsh. You need to write a very short command file, let’s call it mail2med.comm :
DEBUT() MAIL=LIRE_MAILLAGE(FORMAT="ASTER") IMPR_RESU(FORMAT="MED",RESU=_F(MAILLAGE=MAIL)) FIN()
This is all you need to convert your MAIL format into the MED file: Code_Aster will simply open the first one with LIRE_MAILLAGE(FORMAT=”ASTER”) and write it back with IMPR_RESU(FORMAT=”MED”…).
To run the calculation from command line you can use the “–quick” option of as_run:
as_run --quick mail2med.comm cube.mail cube.rmed
The result file will be named “cube.rmed”, you can rename it simply as “cube.med” in this case, since it does not contain any result.
5 thoughts on “Altair HyperMesh to Code_Aster: exporting mesh”
Elements are not defined in the template is coming.
1. I want to know in which user profile we want to do the meshing?
Ex. Ansys, Hypermesh, NAstran, Etc.
2. Whether we want to assign material & properties to the mesh or not?
Ex. Solid, Shell, Etc Or Steel, Copper, Etc.
3. What element type that the Salome will read?
Very nice work. Thank you for sharing.
I used to export in the UNV format from Hypermesh and import it in code_aster.
I wrote an article about this procedure.
If anyone has an interest, here is the article https://www.opencae.com.br/artigos/82-hypermesh2code-aster.html
Thank you for sharing your article! 🙂
Thank you. This is helpful to export to Elmer from HM too. Any idea how to keep the identity of seperate bodies and not have it come under a single body.
You are welcome, nice to hear that this is useful to someone else too 🙂 Maybe you could work with components and sets to handle separate parts? You can see them at the end of the tpl script.