Workflow for a Code-Aster simulation
There are many ways to perform the sequence of a simulation: preparing the geometry, creating the mesh, analysing the model, postprocessing. And perhaps you wish also to fill in in a software-driven manner a template for your report with the analysis results...
We describe here briefly only one of these ways. Thereby we seek to keep as much as possible seperated and independent the several tasks. So we start them all from the Linux Shell and do not use SalomeMeca's AsterStudy module to setup and run an analysis.
We presume that you have installed SalomeMeca. If you use a different mesher and postprocessing tool you must procure translators for the mesh conversion and/or for reading Code-Aster's output files. Or you may insert suitable python commands in the Code-Aster command file to procure for the translation.
1. Start SalomeMeca (or Salome):
The path where salome and the other programs reside may be different in your installation.
2. In Salome (or SalomeMeca) open the Geometry module
Then import an existing geometry in .step or .brep-format (Menu: File - import). Or create your geometry step-by-step starting with Menu: New Entity. When ready explore your geometry with Menu: Measures - What is?. This informs you about the "SubShapes" contained in your geometry object. Example: for a cube solid you will find the follwing SubShapes: 1 shell (closed hull composed of 8 faces), 8 faces, 6 wires (closed sequence of lines enclosing a face), 12 lines, 8 vertices.
3. Change in Salome (or SalomeMeca) to the Mesh module
Create the mesh based on your geometry (Menu: Mesh - Create Mesh). A mesh contains:
- nodes and elements (element types SEG2, QUAD8, TETRA4, HEXA8-elements and many others,..), and
- groups of nodes (GROUP_NO) and groups of elements (GROUP_MA)
A mesh does not contain any physical information (materials, properties, loads etc.).
Groups are added to the mesh with Menu: Mesh - Create Group. They will be used later to assign materials, properties, loads, output requests etc. to parts of the mesh.
When the mesh with all groups is ready, explore it with Menu: Mesh - Mesh information. Visualize your mesh or groups of your mesh by highlighting in Salome's object browser your mesh object or a group and then (in the context menu) right Mouse click - Show (or Show only).
Then export the mesh (Menu File - Export) in .med format. The mesh is now on your hard disk.
When creating groups (Menu: Mesh - Create Group) you may choose to create a "Standalone-Group" or a "Group on geometry" or a "Group on filter". With the first mentioned method the group is defined by a set of IDs of elements (or nodes). The geometry-based group is defined by a SubShape of the geometry object on which your mesh is defined. This SubShape must be exploded in order to be referenced. It can be exploded "on-the-fly" meanwhile creating the group, or turning back to Salome's Geometry module and doing there Menu: New Entity - Explode. For example: if you want to fix a cube-shaped solid mesh on it's base surface, you need to explode this face as a SubShape of your solid geometry object in order to create a proper geometry-based group of nodes.
4. Beside the Mesh you need a second input file: the command-file (.comm)
This is a file in ASCI-format containing a sequence of Code-Aster commands. During the Code-Aster run these commands will be processed successively in order to perform the desired analysis steps. The commands perform tasks such as reading the mesh file from the hard disk (LIRE_MAILLAGE), assigning materials to groups of elements or to the whole mesh (AFFE_MATERIAU), assigning loads and boundary conditions to groups of nodes or elements (AFFE_CHAR_MECA), starting the solver for a linear mechanical analysis (MECA_STATIQUE), and so on. A novice in Code-Aster, but also an experienced user will never know the vast quantity of Code-Aster commands and all their options. That's why the developpers of Code-Aster have created a very nice tool: the AsterStudy module in SalomeMeca.
AsterStudy guides you to find out all the options belonging to the Code-Aster commands by making them graphically selectable or hiding them. It protects you from writing wrong syntax and arranges all commands automatically in the right sequence.
Beside AsterStudy there are also other ways to get a command file:
- use an existing command file which you (or a collegue) developped earlier (and edit it if necessary)
- use a text editor and copy and paste commands from an existing command-file
Creating a command-file is the most challanging task when you plan to use advanced features of Code-Aster for the first time. Then you might contact us as a service provider to help you.
For each Code-Aster command there is one dedicated document in the Code-Aster documentation, see Code-Aster-Commands
5. Next you need an export-file (.export)
The .export-file is basically a list of the names of all files - input and output files - participating at the Code-Aster run and of a set of parameters (specifying memory, simulation time, number of processors etc). The tool to create the export-file is astk:
/opt/salome-meca/2018.0.1/appli_V2018.0.1_public/salome shell -- astk
It is common and practical (but of course not exhaustive) to include at least two input files: .med (mesh in med-format) and .comm, and three output-files: .resu, .mess and .rmed. The output files contain the printed results in ASCI-format, the .messages about the execution of the Code-Aster commands, and the results in .rmed-format used for the visual Postprocessor ParaVis.
Beside astk there are other methods to create an .export file:
- do it inside the AsterStudy module of SalomeMeca
- use a copy of an existing export file and edit it
- do it with a text editor (requires expert knowledge!)
The use of astk and the creation of an .export file is for a beginner the most troublesome, unpleasant, tedious and painful task which he has to survive. Please do not swear, do not blaspheme. There is no one who has got it easier. We are waiting for a revision of the Code-Aster user interface.
6. Now start the analysis:
/opt/salome-meca/2018.0.1/appli_V2018.0.1_public/salome shell -- as_run yourfile.export
If the analysis runs well (generally it does not at the beginning!) you will find all output files on your hard disk.
There are also ways to start the Code-Aster run from astk and from the AsterStudy module of SalomeMeca.
Let's hope that you have inserted the command IMPR_RESU (print result to output file) in your command file after the solver command. Depending on the format specification (FORMAT='MED' or FORMAT='RESULTAT') given in IMPR_RESU the results will be printed to the .rmed-file or in ASCI-Format to the .resu-File. The .rmed-file can be opened in a graphical postprocessor such as
- the ParaViS module of SalomeMeca, or
where you can create the usual plots of the deformed structure, vanMises stresses, temperature and so on.
- gmsh is very handy for small and medium sized models. With larger models gmsh becomes slow, use better ParaViS
- gmsh is also a versatile and scriptable meshing tool
- gmsh is able to read meshes in Nastran format and export them in .med-format. So it is a means to transfer a Nastran mesh to Code-Aster. But caution: not all element topologies are transfered, and no groups are contained in the .med file after the transfer.
- ParaViS is nothing different than ParaView, plugged in SalomeMeca and provided with a .med-format reader to read Code-Aster's .rmed result files.