Finite Elements in Scilab
The goal of this page is to present the finite element tools which are available in the Scilab environment.
We present the following tools:
- the Femtruss module,
the FreeFem module for Scilab,
the OpenFem module for Scilab,
the GetFem module for Scilab,
- the CEMEF-UTN scripts,
- the connection between SAMCEF® and Scilab.
The Femtruss module is a a Truss finite element code for scilab:
It has been created by Yann Collette in 2009-2010 and is maintained as an open-source project under GPL on :
In the demos directory, you will find some demos related to structural optimization, computation of partial derivatives and display of structures.
The following is the list of functions in this module :
- build_fem_test : Create some test structures in 2 or 3 dimensions.
- dfemtruss_ana : Compute the analytical partial derivative of the nodal displacements.
- dfemtruss_smw : Compute the partial derivative of the nodal displacements.
- femmode : Computes the modes of a structure.
- femtruss : Computes the deformation of a truss structure.
- localise2d : Returns the position in the matrix of a given point (2D).
- localise3d : Returns the position in the matrix of a given point (3D).
- plot_truss : Plot a truss structure.
- plotdeforme : Plot a deformed truss structure.
- plotmesh : Plot a truss structure.
- plotsection : Plot the sections of a truss structure.
- rank_efficient_struct : Test the validity of a stiffness matrix.
To install this module:
The following figure presents a 2D bridge before optimization.
The following figure presents the same bridge after optimization.
The following figure presents a 3D bridge before optimization.
The following figure presents the same bridge after optimization.
GetFEM++ is basically a generic C++ finite element library which aims to offer the widest range of finite element methods and elementary matrix computations for the approximation of linear or non-linear problems, possibly in hybrid form and possibly coupled. The dimension of the problem is arbitrary and may be a parameter of the problem. GetFEM++ offers a description of models in the form of bricks whose objective is to enable reusability of the approximations made. The system of bricks, now mature, is used to assemble components such as standard models (elasticity in small and large deformations, Helmholtz problem, scalar elliptic problem ...) to components representing the boundary conditions (Neumann, Dirichlet, Fourier-Robin, contact, friction...), also to components representing constraints (incompressibility, removing rigid motions ...) and to coupling components for coupled models.
Two strong points of GetFEM++ are structural mechanics (in particular contact mechanics) and taking into account discontinuities by fictitious domain methods of XFEM type (eg cracking).
It is proposed three interfaces (with Scilab, Matlab and Python) that allow to use of the main features of the software without the need of C++ programming and allowing graphical post-processing.
There is an interface from Scilab, created by Yann Collette in 2009 - 2010:
This module provides the following functions:
- Draw Command reference
- Command reference
This work is documented in :
"Scilab Interface, Release 4.1.1", Yann Colette, Yves Renard, Julien Pommier, November 03, 2011
which is available at:
FreeFem++ is an implementation of a language dedicated to the finite element method. It enables you to solve Partial Differential Equations (PDE) easily. Problems involving PDE (2d, 3d) from several branches of physics such as fluid-structure interactions require interpolations of data on several meshes and their manipulation within one program. FreeFem++ includes a fast 2^d-tree-based interpolation algorithm and a language for the manipulation of data on multiple meshes (as a follow up of bamg).
FreeFem++ is written in C++ and the FreeFem++ language is a C++ idiom. It runs on any Unix-like OS (with g++ version 3 or higher, X11R6 or OpenGL with GLUT) Linux, FreeBSD, Solaris 10, Microsoft Windows (95, 98, 2000, NT, XP, Vista) and MacOS X (native version using OpenGL). FreeFem++ replaces the older freefem and freefem+.
There has been several attempts to connect Scilab with FreeFem:
A module by par Yann Collette (2006) : Contribution #883
A module by Yann Collette (2006) : Contribution #879
A module by Frederic Hecht (2000) : Contribution #149
Yann Collette as suggested to work on this topic as a GSOC (Google Summer of Code) project:
OpenFEM is an open-source software freely distributed under the terms of the "GNU Lesser Public License" (LGPL) co-owned by INRIA and SDTools.
OpenFEM is a general purpose multi-physic FEM environment. It addresses people familiar with FEM who want state of the art performance with the ease of use of MATLAB. Easier learning and more user friendly access is provided by SDTools in the OpenFEM version integrated in SDT. OpenFEM by itself is thus mostly used by academics who are willing to develop in a non graphical mode. SDTools is the main contributor to OpenFEM but has collaborations with a number of other developers, who need to rely on an Open Source environment.
A module by Yann Collette (2008) : Contribution #1077
A module by Yann Collette (2003) : Contribution #151
July 2010: Mmodd for Partial Differential Equations
The MmodD project contains tools for the study and solution of partial differential equations (PDEs) in 2d and 3d. A set of command-line functions and a graphical user interface let you preprocess, solve, and postprocess generic PDEs for a broad range of engineering and science applications.
The project is leaded by Thierry Clopeau, with the help of the following developpers :
- Sofian Smatti
- Marcel Ndeffo
- David Delanoue
- Wu Yiwen
- Kevin Vervier
- Amandine Berger
- Hocéane Kadio
- Laurence Siao
- Mbiengop Alex
- Yvon Goudron
- Feriel Ben Cheikh
- Simon Géraud
- Laurène Soyeux
- Yannick Meyapin
- Marion Neyroud
- Karine Mari
- Antoine Landra
- Ahmed Radji
The module provides the help pages of the following functions:
- line2d — Type declaration
- line3d — Type declaration
- p1_1d — Type declaration
- p1_2d — Type declaration
- square2d — Create a mesh on a square
- tri2d — Type declaration
The following functions are available:
June 2011 : CEMEF-UTN
Marcos Cesar Ruggeri, from the Universidad Tecnológica Nacional in Argentina, developped CEMEF-UTN, a set of FEM scripts for Scilab.
This module implements the 3D Linear Bar Element (bar3d) formulation to solve truss structures for linear static stress-strain analysis.
Input data is imported from a .xls file, where the table of nodes, table of elements, nodal external loads vector and boundary conditions are stored.
This program only considers concentrated loads on the nodes. In case there be distributed loads or thermal loads, they must be calculated separately and then included into the nodal external loads vector. Flexion and shear effects are not considered due to the element formulation, which satisfy the hypothesis of the Finite Element Method.
This tool provides the following functions:
- stressbar3d: coordinates transformation for stress computation on each bar element
- stiffbar3d: local stiffness matrix and deformation matrix, transformation matrix of the element and global stiffness matrix
- spdverif: symmetric positive definite stiffness matrix verificator
- preplottruss3d: pre-plot of three dimensional truss structure
- postplottruss3d: contourplot of uni-dimensional normal stresses on each element of the structure
- bc: importation of boundary conditions and reduction of system
- assemb3d: table of connectivity and asssembly process
- inpbar3d: data migration and geometric and mechanical properties computation
- spdsolve: solve symmetric possitive definite system
The CEMEF-UTN scripts are available on ATOMS under the BSD license:
The following is an example, extracted from "CEMEF-UTN v1.1-6, High Voltage Tower Example" by Marcos C. Ruggeri. It is based on a structure which has 10 nodes.
cd F:\Downloads\cemef-utn_v1.1-6_comm\cemef-utn1.1-6 exec('inpbar3d.sci'); exec('stiffbar3d.sci'); exec('assemb3d.sci'); exec('preplottruss3d.sci'); exec('bc.sci'); exec('SPDverif.sci'); exec('SPDsolve.sci'); exec('stressbar3d.sci'); exec('postplottruss3d.sci'); [M,nod,elem,E,A,L,dircos,nn,ne]=inpbar3d('example_hvtower.xls'); [kL,B,T,kG]=stiffbar3d(E,A,L,dircos,ne); [tc,K0]=assemb3d(elem,3,6,kG,nn,ne); preplottruss3d(nod,elem,nn,ne,2) [K,P,cDOF,cDOFasc]=bc(M,K0); SPDverif(K0,cDOFasc,K); [u0,u,P0]=SPDsolve(K0,K,P,cDOF,cDOFasc,nn); [ue,sigma,f]=stressbar3d(E,A,B,T,tc,u0,ne); disp(sigma) postplottruss3d(nod,elem,nn,ne,2,sigma,u0,100,24)
The previous produces the following output:
Connection to SAMCEF®
The SAMCEF® software is a Finite Elements tool developped by SAMTECH. The SAMCEF® suite is SAMTECH's general-purpose analysis software. It is based on the Finite Elements Method and covers a large range of applications, from basic to very advanced, in numerous industrial fields. See http://www.samtech.com/ for more details.
Paul Carrico, from ESTERLINE ADVANCED SENSORS, uses SAMCEF® from Scilab to design sensors. This analysis requires to perform a parameter fitting computation, based on results computed by SAMCEF®. The connection to SAMCEF® is based on simple file exchanges. In this case, Scilab is first used as a way to drive an external program, which is, here, a Finite Elements software. Moreover, the parameter fitting uses the fminsearch function of Scilab, a direct search method which does not require the derivatives of the objective function. The fminsearch function is based on the Nelder-Mead algorithm. In the case where the parameters are bounded, the function used is "neldermead".
Paul Carrico reported his experiments in the following report.
"The Experiences of Esterline Advanced Sensors using SAMCEF® in the development of Aeronautic Sensors", Paul Carrico, Designer /Materials Expert, Esterline Advanced Sensors – AUXITROL SA – Bourges (France), 12th SAMTECH Conference, 15th & 16th November 2011 - Crowne Plaza, Liège Belgium
"This presentation comprises 3 main discussion topics :
- A quick overview of FEA’s performance over the past few years using the SAMCEF® module for sensors development (THERMAL®, MECANO®, DYNAM®, REPDYN®, SPECTRAL®)
- The ability of SAMCEF® to interface with external routines for increased reliability i.e. leading to a good correlation of the modelling to the test measurements : a specific development including an hyperelastic material is presented for model analysis (modal analysis and dynamic response)
- A few examples which highlight gains in efficiency (the ability to launch multiple runs, automatic post-processing...)"
The paper of this event is provided here with authorization of ESTERLINE ADVANCED SENSORS:
This work has been performed with participation from the Scilab Consortium.
- There has been several attempts in the past, which are gathered in the former "Toolbox Repository" :