Skip to content

Tutorial 1: general framework

Pascal FREY edited this page Jan 22, 2016 · 1 revision

Setting up a simple problem

This section explains how to set up a simple linear elasticity problem and solve it using P1 finite elements.
#####1. creating/importing a mesh
elastic requires the computational domain to be defined by a mesh composed of triangles or tetrahedra, described in the Inria mesh format.
To generate a mesh you can use gmsh, freefem++ or any mesh generator you like or have access to.
Using gmsh if you have defined a .geo file (contour.geo for instance), you can generate a mesh of the domain described by this geometry by entering

gmsh -2 contour.geo -o test.mesh

this will produce a two dimensional triangular mesh named 'test.mesh'.

2. creating a parameter file

in this file, you will specify the boundary conditions (Dirichlet, Neumann), the gravity or body forces and the material properties (Lamé coefficients or Young modulus). A typical parameter file looks like:

Dirichlet      #specify homogeneous boundary conditions
1
1 vertex v 0 0

Load           # surface load along the normal direction to the boundary
1
2 edges n -0.2

Gravity        # body force
0 -9.81e2

Lame           # material properties
1
0 186000.0 3400.0

in this example, one homogeneous Dirichlet condition is supplied and enforced on all mesh vertices labelled '1', a load is exerted along the normal direction on edges labelled '2', the body force (right-hand side) is the gravity, and the domain material labelled '0' is characterized by two Lamé coefficients.

Elastic will first look for the file test.elas associated with the mesh 'test.mesh'. If not found, it will expect the generic file named DEFAULT.elas to contain the problem specifications.

#####3. running elastic to run elastic, simply type

elastic test.mesh

Alternatively, you can also use the options '+v' to increase the level of verbosity, eventually suppressing any output using the option '-v'.

Typical output looks like:

- ELASTIC, Release 5.0c, Jan.19, 2016
   (C) Copyright 2006- , ICS-SU

- LOADING DATA
   test.mesh: 5663 vertices, 257 edges, 11067 triangles
   test.elas: 4 conditions
- COMPLETED: 0.024s

** MODULE ELASTIC: 5.0c
   Matrix and right-hand side assembly
   Solving linear system: 9.236327E-07 in 2983 iterations
** COMPLETED: 6.954s

- WRITING DATA
  test.sol: 5663 data vectors
- COMPLETED: 0.012s

** Cumulative time: 6.990s.

#####4. visualizing the result the file 'test.sol' produced by elastic contains the displacement field associated with the mesh vertices (P1 FEM). It can be visualized using 'medit' tool.