This post provides is a step by step tutorial for beginners. Before to start, a working installation of Salome and Code_Aster on Windows is required, some help can be found here for Salome and here for Code_Aster.
Note : you can follow this more recent post to begin with AsterStudy module in Salome-Meca on Windows. AsterStudy is said to be more a more user friendly way to begin with Code_Aster.
Introduction
The usual way to learn about a new mechanical simulation framework is to do step by step:
- geometry
- mesh
- model and materials
- run
- post-processing
Salome + Code_Aster framework is known to be less intuitive comparing to commercial solutions. At the same time, Code_Aster is much better than the latter in term of ease to access documentation, freely available at code-aster.org, and examples (more than 3000), available in the release version. The key point is that each example, available in the release (installtestingtests directory), has an online dedicated validation document.
The step by step way to start with Code_Aster that I propose here is:
- Pick up an existing case
- Set up input files
- Run and analyze results
- Customize for your needs
Pick up an existing case
Go to the DOCUMENTATION page, on http://code-aster.org/
On the left panel, click on Code_Aster version 13, then testcases by name
FORMAT cases correspond to the official training material. Let’s open the example Practical training in basic use of Code_Aster corresponding to FORMA02:
In this dedicated document, the format02 cases are summarized in the Reference problem section:
And the particular case format02a is described in the Modelization A section:
It is possible to verify that the case forma02a runs successfully in the installed version. Navigate into the Code_Aster installation directory and launch:
install\bin\as_run.bat --test forma02a
At the end of the run, cmd console should display:
DIAGNOSTIC JOB : OK
Set up input files
Copy and past the forma01a files from installtestingtests into a dedicated working directory forma02:
- forma02a.mmed
- forma02a.comm
- forma02a.export
The “mmed” file
Binary file containing the mesh of the model : nodes, elements and groups. It is possible to open it using Salome for Windows.
Launch Salome and create a new document. Then open the mesh module.
It is then possible to import a mmed file by selecting in the menu, File -> Import -> MED file. Go to the dedicated directory forma02 and open forma02a.mmed.
Click on the eye to show the mesh, the scale button may also be helpful.
On the left, the object browser allows to navigate into the opened mesh.
The “comm” file
Contains all Code_Aster operator calls, that will be interpreted and executed sequentially by the code aster executable. It also use Python syntax. Let’s open forma02a.comm to have an overview on some operators.
DEBUT(CODE=_F(NIV_PUB_WEB='INTERNET'),DEBUG=_F(SDVERI='OUI'));
DEBUT is used to start with the command file
MAIL=LIRE_MAILLAGE(FORMAT='MED',);
LIRE_MAILLAGE will read the mesh file forma02.mmed
TEMPE=THER_LINEAIRE(MODELE=MODTH, CHAM_MATER=CHMATER, EXCIT=_F(CHARGE=CHARTH, FONC_MULT=F_MULT,), INCREMENT=_F(LIST_INST=LINST,), ETAT_INIT=_F(VALE=20,),);
THER_LINEAIRE resolve a linear thermal problem.
RESU=MECA_STATIQUE(MODELE=MODMECA, CHAM_MATER=CHMECATH, EXCIT=_F(CHARGE=CHMECA,), LIST_INST=LINST,);
MECA_STATIQUE resolve a linear mechanic problem. Since the chaining with THER_LINEAIRE, one can notice a thermo-mechanic case.
IMPR_RESU(FORMAT='MED', RESU=(_F(MAILLAGE=MAIL, RESULTAT=RESU,), _F(RESULTAT=TEMPE,),),);
IMPR_RESU write the results in forma02a.rmed
FIN();
FIN is used to ends with the command file.
The “export” file
Contains some parameters used for the code aster launch, like time, memory, … and also the input/output files. Let’s open it to do some modifications:
The parameters “time_limit” and “memory limit” are used for validation, we should replace them by “tpmax” and “memjeveux” (with a factor 8 i.e 512 -> 64.0) respectively.
The input/output files are defined as follow: the first letter “F” means we are dealing with a file (it is possible to define a directory as “D”), then the type of file (comm or mmed …), then the file name (or directory name), then the letter “D” means data (or “R” means result), and finally the number at the end of a line correspond to the Fortran unit. Input file “datg” is useless, let’s remove it and add outputs “mess”, “resu” and “rmed”. The “mess” file (message) will contain the log of the run, also printed in the stdout in case of interactive run. The “rmed” file forma02a.rmed will be a med binary file, containing the results of the run. It will be possible to open it using Salome for Windows.
Add “version testing” to tell as_run we want to use testing version, and “action make_etude” means that as_run should run the study.
Finally the export file should look like this:
A tpmax 60.0 A memjeveux 64.0 P ncpus 1 P mpi_nbcpu 1 P mpi_nbnoeud 1 P testlist verification sequential F comm forma02a.comm D 1 F mmed forma02a.mmed D 20 F mess forma02a.mess R 6 F resu forma02a.resu R 8 F rmed forma02a.rmed R 80 P version testing P actions make_etude
Run the case and analyze the results
In a cmd, into the forma02a directory, launch Code_Aster for windows using your installed version:
Code_Aster_path_installation\install\bin\as_run.bat forma02a.export
At the end of the run, the working directory contains the mess and rmed files.
Go back to Salome for Windows and open the ParaVIS module.
It is then possible to import the rmed file by selecting in the menu, File -> Open ParaView File … Go to the dedicated directory forma02 and open forma02a.rmed.
Click apply button to load the file with default parameters and click on the eye for the mesh to appear on the viewer. Then right click on the mesh and select Color By -> RESU____DEPL.
The displacement field is now visible. It is possible to navigate between the different increments.
Customize for your needs
It is possible to use Salome to modify the mesh, or make a new mesh from scratch or using your geometry. Then it is also possible to modify the comm file by using other operators or modifying parameters in already used operators (young modulus, loadings, number of increment, mesh groups where loads or materials are applied …)
Playing with the input data and using the user online documentation is a good way to progress with Code_Aster operators. Once you get a sufficient understanding you may also create your own comm files from scratch.
conclusion
I hope this post will motivate some people to go into Code_Aster. Plenty of documentation available online can be found to learn about Salome (Geom, Mesh and Viewer modules) and about Code_Aster (user operators for comm file). There are also tutorials dedicated to Salome_Meca, that may be used with Code_Aster for Windows + Salome for Windows framework solution provided here.
Other ways, not discussed there, exist to use Code_Aster on Windows. One can for example use Gmsh for Windows as a pre and post pro instead of Salome.
Finally, if you want to start with Code_Aster and already have some knowledge with commercial solutions, I suggest the reading of theses posts Nastran to Code_Aster : elasto-plastic deformation, Nastran to Code_Aster: nonlinear gap elements and Abaqus to Code_Aster : plane stress.
Hi,
Following your guidelines, I managed to install code_aster in my PC and got a Diagnostic job OK by running forma02a.export file. Similarly, I tried using your readme file, to run the below case. But I got error “The system cannot find the path specified.”
To execute a sample of test cases provided in the testing/test directory :
> bin\as_run.bat astout\run_test.export
How to run the export files placed on different directories?
LikeLike
Hi,
I manage to install and run code_aster using your guidelines and successfully run forma02a to get OK.
I tried :
To execute a sample of test cases provided in the testing/test directory :
> bin\as_run.bat astout\run_test.export
received message “The system cannot find the path specified” . Could you help me to run the export files in different directories?
Thanks and Regards,
Hemanand
LikeLike
you can specify an absolute path in the export file i.e “c:\Users\…\folder\file.comm” instead of “file.comm”
LikeLike
Thanks!
LikeLike
I tried today in Windows, and it all run as you explained. Thank you.
LikeLike