Altair HyperMesh to Code_Aster: exporting mesh

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:

  1. Choose the “export arrow” from the Toolbar
  2. Choose “Export Solver Deck” from the submenu (second from left)
  3. File Type : select “Custom”
  4. Template : write or select the exact location for the file “mail.tpl”
  5. File : write a path and a name for the output result, use something like “cube.mail” (you should use the “.mail” extension)
  6. Click on the “Export” button
  7. 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 :


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 :


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 “” in this case, since it does not contain any result.

Screenshot from 2018-02-21 19-07-51.png

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s