Introduction to Code_Aster
Theory: command-file flow and verification
Overview
Code_Aster is free but said to be hard to master. What's different about it?
Its unusual syntax and its wealth of verification material. Code_Aster was built by EDF to assess nuclear-plant structures; analyses are written as command files (.comm), effectively Python scripts. Command names are French abbreviations (LIRE_MAILLAGE = read the mesh, AFFE_MODELE = assign the model, and so on), confusing at first. On the other hand, thousands of verification cases and their theory are published, so you can trace which cases verify a given feature — a strength other open-source codes lack. A good entry is to run the whole chain once on a simple problem with a known solution in the Salome-Meca environment: mesh, assemble commands in AsterStudy, and view results.
Command flow for a static analysis
- LIRE_MAILLAGE: read the mesh (MED format).
- AFFE_MODELE: assign element type (PHENOMENE='MECANIQUE', MODELISATION='3D', etc.).
- DEFI_MATERIAU, AFFE_MATERIAU: define material (Young's modulus, Poisson's ratio) and assign to mesh groups.
- AFFE_CHAR_MECA: apply supports (DDL_IMPO) and loads.
- Solve with MECA_STATIQUE, compute stresses with CALC_CHAMP and write results with IMPR_RESU.
Beam theory for comparison
P is tip load, L length, E Young's modulus, I second moment of area, b and h section width and height, G shear modulus, A area and k the shear correction factor.
An open solver born from nuclear verification
Code_Aster has been developed at EDF since 1989 and was released as open source in 2001. Because analyses must be justified to nuclear regulators, writing verification cases and theory documents for each new feature is a development rule. The result is a rare open-source code whose quality-assurance documentation rivals commercial solvers.
Worked examples
Example 1: steel cantilever (50 mm × 100 mm, 1 kN at the tip, N-mm-MPa)
| Length (L/h) | Bending deflection | Shear contribution | Total | Max bending stress |
|---|---|---|---|---|
| 1,000 mm (10) | 0.3810 mm | 0.0030 mm (0.8%) | 0.3839 mm | 12.0 MPa |
| 500 mm (5) | 0.0476 mm | 0.0015 mm (3.1%) | 0.0491 mm | 6.0 MPa |
E = 210,000 MPa, Poisson's ratio 0.3, second moment of area 4.167×10⁶ mm⁴. Shorter beams carry a larger share of shear deformation, so 3D element results come out slightly above beam theory.
Example 2: a unit mix-up
With an mm mesh but Young's modulus entered as 210×10⁹ (the Pa value), deflection becomes 3.81×10⁻⁷ mm — a millionth of the correct value. Code_Aster has no units, so this raises no error.
Solving with a 3D mesh, I only got about 0.30 mm deflection. What went wrong?
Suspect element order. Linear tetrahedra (4 nodes) represent bending poorly and behave too stiffly, underestimating deformation; with only a few elements through the beam depth, deflection 20% or more below theory is common. Switching to quadratic tetrahedra (10 nodes) or quadratic hexahedra should bring it near 0.38 mm at similar element counts. In Code_Aster you only make the mesh quadratic (specify quadratic elements in Salome or convert with CREA_MAILLAGE); MODELISATION='3D' stays the same. Then confirm the value stops changing as you refine, and the verification is complete. If the gap to theory is around 0.8% (the shear contribution), supports and loading are applied correctly too.
Getting started
- Install Salome-Meca and run one bundled example.
- Build the cantilever geometry and mesh and define groups for supported and loaded faces.
- Assemble commands in AsterStudy, fix the unit system and enter materials and loads.
- Compare deflection and stress with beam theory.
- Find official verification cases using the same features and use them as references.
“An analysis with loads 1000 times too large”
In one contract analysis, Code_Aster stresses came out 1000 times the hand calculation. The mesh was in metres, but the load — meant in kN per the drawing — was multiplied by 1000 to convert to N and applied as a pressure while areas were computed in m². With a unit-free solver, the team now states at the top of each input which unit every quantity uses and first checks orders of magnitude on a known problem such as a cantilever; the mistake has not recurred.
Common mistakes
Mistakes and fixes
| Mistake | Effect | Fix |
|---|---|---|
| Inconsistent units | Results off by orders of magnitude | Use N-mm-MPa or similar consistently |
| Linear tets for bending | Deflection underestimated | Quadratic elements |
| Mismatched group names | Load not applied | Check mesh and commands |
| Insufficient supports | Rigid-body error | Check DOFs |
| No known-solution check | Errors unnoticed | Verify with a cantilever |
I'd like to learn related topics.
Related pages include Code_Aster structural analysis, Code_Aster contact analysis, CalculiX introduction, SALOME meshing and cantilever beam bending.
Related Topics
Experience the theory firsthand with the interactive simulator for this field
All Simulators