FEA with Gridap.jl
The Finite Element Method part writes every loop by hand, which is how the method is learned, but a model with a few hundred thousand degrees of freedom in three dimensions needs a faster code. Gridap is a finite element library written in Julia by Santiago Badia and Francesc Verdugo [1]. A model is written as its weak form, nearly as it appears on paper, and Julia’s just-in-time compiler turns that description into machine code [2]. The same language serves for the readable model and the fast assembly, so the two-language problem of Python with a compiled core does not arise.
Each chapter in this part solves one problem with three tools. Gmsh [3] builds the geometry and the mesh, Gridap solves the weak form, and ParaView shows the result. Wherever a hand solution exists, we compare it with the finite element result before trusting the model.
Installing the tools
Julia is installed with juliaup, which also keeps it up to date. On Linux and macOS
curl -fsSL https://install.julialang.org | shand on Windows
winget install --id Julialang.Juliaup -eThe finite element packages are installed from Julia’s package manager. GridapGmsh reads gmsh meshes into Gridap, and Gmsh gives Julia the gmsh library itself, so no separate gmsh installation is needed to build a mesh:
using Pkg
Pkg.add(["Gridap", "GridapGmsh", "Gmsh"])The gmsh program with its graphical interface, for looking at a mesh, is downloaded from gmsh.info, and ParaView from paraview.org. On Linux the gmsh binary needs the system’s GLU library (sudo apt install libglu1-mesa on Ubuntu). ParaView ships pvpython and pvbatch, which run ParaView scripts without opening a window, and the images in this part are made that way.