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.