We present a compact MATLAB framework for finite element prototyping based on sparse vectorized assembly. The purpose of the code is not to compete with large-scale production finite element libraries, but to expose, in a transparent and reproducible way, the algebraic structure that connects a variational formulation with an efficient implementation in a high-level language. The framework covers piecewise linear and quadratic finite elements on triangular meshes, variable-coefficient diffusion–reaction problems with quadrature, a vectorized tetrahedral implementation for the three-dimensional Poisson equation, and a Mini-element discretization of the incompressible Navier–Stokes equations. Manufacturedsolution refinement studies recover the expected L2-error and H1-seminorm convergence rates for P1 triangles on both structured and deterministically perturbed meshes, P2 triangles, and P1 tetrahedra. Performance measurements were obtained with the official MATLAB R2026a Update 3 release. The DFG flow-around-a-cylinder benchmark provides a demanding, externally defined and non-manufactured assessment of the complete incompressible-flow module. A three-mesh, two-time-step 2D-3 study shows that maximum drag is robust to time-step reduction and improves with spatial refinement, whereas lift and pressure difference are more strongly space–time sensitive. At Δt = 5 · 10−3, the lift-amplitude error lies between 0.5% and 3.3% across the full mesh family, without a monotone mesh trend. These agreements are reported as sensitivity evidence rather than as asymptotic space–time convergence estimates.
A validated MATLAB framework for sparse vectorized finite element assembly
S. Micheletti
2026-01-01
Abstract
We present a compact MATLAB framework for finite element prototyping based on sparse vectorized assembly. The purpose of the code is not to compete with large-scale production finite element libraries, but to expose, in a transparent and reproducible way, the algebraic structure that connects a variational formulation with an efficient implementation in a high-level language. The framework covers piecewise linear and quadratic finite elements on triangular meshes, variable-coefficient diffusion–reaction problems with quadrature, a vectorized tetrahedral implementation for the three-dimensional Poisson equation, and a Mini-element discretization of the incompressible Navier–Stokes equations. Manufacturedsolution refinement studies recover the expected L2-error and H1-seminorm convergence rates for P1 triangles on both structured and deterministically perturbed meshes, P2 triangles, and P1 tetrahedra. Performance measurements were obtained with the official MATLAB R2026a Update 3 release. The DFG flow-around-a-cylinder benchmark provides a demanding, externally defined and non-manufactured assessment of the complete incompressible-flow module. A three-mesh, two-time-step 2D-3 study shows that maximum drag is robust to time-step reduction and improves with spatial refinement, whereas lift and pressure difference are more strongly space–time sensitive. At Δt = 5 · 10−3, the lift-amplitude error lies between 0.5% and 3.3% across the full mesh family, without a monotone mesh trend. These agreements are reported as sensitivity evidence rather than as asymptotic space–time convergence estimates.| File | Dimensione | Formato | |
|---|---|---|---|
|
JAS-03-02-2026-04.pdf
accesso aperto
Dimensione
354.3 kB
Formato
Adobe PDF
|
354.3 kB | Adobe PDF | Visualizza/Apri |
I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.



