FEM Install

Introduction
To be able to perform finite element analysis (FEA) within the, FreeCAD makes use of two external programs: one is used for generating the FEM Mesh, and the other for numerically solving the actual analysis. You can test if your FreeCAD installation is ready for FEA by running the FEM CalculiX Cantilever 3D example which is included with every installation of FreeCAD since v0.17.



FEM solver
The default solver to perform finite element calculations is CalculiX, a simple solver for analysis of structures. FreeCAD writes a CalculiX input file, starts the solver, and reads the output, which can then be presented visually in the viewport; this means the CalculiX binary is standalone and independent from FreeCAD. Given that there are many programs that can generate a mesh, it is recommended to install the solver, and make sure it's working first.

If the solver is correctly installed, you may run the single command in the terminal to obtain a simple response:

If the solver is installed, make sure the FEM Workbench is able to find the binary; go to. If you compiled the solver yourself, untick the option, and give the correct path to the binary. For other solvers that could be used with FreeCAD, see FEM Solver.

FEM mesh generator
In order to create a FEM Mesh, FreeCAD uses Gmsh as the default mesher. For this to work, Gmsh should be installed separately from FreeCAD.

If the program is correctly installed, you may run the command in the terminal to launch the graphical interface of the program. This interface is not used by FreeCAD but demonstrates that the program is installed.

If the mesher is installed, make sure the FEM Workbench is able to find the binary; go to. If you compiled the mesher yourself, untick the option, and give the correct path to the binary. See FEM Mesh for various possibilities of obtaining a valid mesh for analysis.

Netgen
In previous versions of FreeCAD, Netgen was the default mesher. For it to work with the FEM Workbench, FreeCAD had to be linked against the Netgen libraries at compile time. As FreeCAD transitioned from OCE 0.17 to OCCT 7.1, Netgen 4.9.13 failed to link against this version of OCCT, so it was decided to drop Netgen support in the FEM Workbench (the Netgen button was removed). Nevertheless, shortly afterwards some users reported success in patching Netgen 5.3.1, so that it worked with OCCT 7.x and FreeCAD.

For historical reference, see the threads:
 * (Ubuntu Daily PPA) Transitioning to OCCT7, VTK7...
 * Ubuntu Daily Builds PPA now using OCC 7.1.0
 * patching Netgen 5.3.1 to work with OCCT 7.1
 * Troubles with gmsh in FEM wb (netgen nostalgy)

Despite Netgen not being available from within the FEM Workbench, it can still be used by itself to produce meshes that can then be imported.

If the program is correctly installed, you may run the command in the terminal to launch the graphical interface of the program.

Installing on Windows
The FreeCAD packages available from the download page already include Netgen and CalculiX, so no additional software needs to be installed. Some links where to get a better Calculix executable than included in FreeCAD can be found here alternative ccx executables

Installing on Linux
Linux distributions have different ways of installing software. Many distributions have software repositories and package managers; before compiling source code, look in your package manager for, , or , and install them following the instructions of your own distribution.

Ubuntu PPA
The freecad-stable and freecad-daily personal package archives (PPA) provide a more recent version of FreeCAD than is available in the official Ubuntu repositories. These PPAs include the most recent, , and packages as well. See Installing on Linux for more information on setting up the repositories.

If a PPA is already added to your system, install the packages as follows

The freecad-community PPA also provides, , and packages for testing. If they are stable enough, they may be added to the daily or stable repositories. The binaries for ccx 2.14 work on Debian Stretch, but not on Debian Buster due to dependency problems.

the thread Ubuntu Repository discusses the creation of the Ubuntu PPA packages. At the time it was written, CalculiX was not included in the Debian repositories, so there were several personal packages in Launchpad. Only one package should be installed.

Arch Linux
Get the CalculiX package from the AUR repository.

Debian

 * Debian 9 Buster: the packages in the repository are outdated, but you can use the packages from the Ubuntu PPA . See Gmsh 4 package available for testing in Community Extras PPA (forum post).
 * Debian 8 Stretch: the packages in the repository are outdated, but you can use the packages from the Ubuntu PPA . See Gmsh 4 package available for testing in Community Extras PPA (forum post).
 * Debian 7 Jessie: install the packages from Debian 8 Stretch using . See Debian source package for Calculix (forum post).

openSUSE

 * openSUSE:Science Math
 * netgen Automatic 3D tetrahedral mesh generator
 * gmsh A three-dimensional finite element mesh generator
 * ccx An open source finite element package

Additional packages are typically installed with YAST (abbr. Yet another Setup Tool) the Linux operating system setup and configuration tool, or in any terminal/console (root rights required) with:



CalculiX binary
The CalculiX authors provide a pre-compiled Linux binary of the solver; it can be downloaded from the authors' website. However, since different Linux distributions have different library paths, most likely this binary will not work without making some adjustments.

To use the binary with Fedora 21, see the thread Making FEM run on linux fedora 21. For newer Fedora versions, you should compile CalculiX yourself.

If you use this binary, check that the binary is executable, that it is in the executable of your system, and that you have the necessary version of the libraries (,, , etc.) against which it was compiled. This is mentioned in the forum post FEM WB.

Use the command to see the libraries that are linked by the binary. Install any missing dependency.

Compile CalculiX
Since CalculiX is a standalone application, you can either install a binary packaged for your distribution, or compile it yourself. Any CalculiX version from 2.7.x onwards should work with FreeCAD, and since the code hasn't changed much in years, lower versions than 2.7.x may work as well.

Compiling CalculiX is a task for experienced users, requiring editing the Makefiles and build options in different platforms. See the following information:
 * Debian: Debian source package for Calculix, Gmsh 4 package available for testing in Community Extras PPA, Compiling CalculiX ccx on fedora, ubuntu and debian.
 * Fedora 27, 28, 29: Compiling CalculiX ccx on fedora, ubuntu and debian.
 * There is a CMake version of the source package in a github repository, but at the FreeCAD forums no one has reported if this package works.

Compile Netgen
Netgen was originally linked by FreeCAD when FreeCAD used OCE, the community fork of OpenCascade (OCCT). As OCE lagged in development behind OCCT, FreeCAD switched back to OCCT. This broke the linking of Netgen, which could only link against OCCT 6.9 or OCE 0.18 and below. As OCCT 7.x versions improved the core funcitonality of FreeCAD, it was decided to drop Netgen support in favor of Gmsh.

Since then some success has been achieved patching and linking newer versions of Netgen against OCCT 7.x. Nevertheless, the inclusion of Netgen with FreeCAD is still problematic.

Installing on MacOSX
The OSX development packages of FreeCAD may include Netgen but may not include CalculiX.

See this forum post FEM on Mac OSX for information on installing CalculiX, and an updated post for more recent information.

CalculiX: The following posts may be outdated:
 * install CalculiX with brew
 * FEM on Mac OSX, post 1
 * MacPorts users: CalculiX port test request

Further information
The FEM Workbench is under constant development. The most recent information is found in the FreeCAD forum.

If you have problems installing Netgen, Gmsh, or CalculiX, or another external tool, please search the forum first:
 * netgen site:forum.freecadweb.org
 * gmsh site:forum.freecadweb.org
 * calculix site:forum.freecadweb.org