CFD · Numerical methods · HPC
MatteoBarbieri
MSc Aeronautical Engineering @ Politecnico di Milano. I build and optimise simulation pipelines, from OpenFOAM internals to neural operators.
Explore the work ↓smoke visualisation · potential flow + turbulent wake · move the pointer
Index
Projects, newest first.
Amdahl's Law, Measured: Why Twice the Cores Is Not Half the Time
Amdahl's law predicts the speedup of a program with a serial part, and on compute-bound work it is accurate to a few percent. A memory-bound kernel with no serial part at all stops at about 1.2x, and a CFD halo-exchange code shows 55% strong-scaling efficiency on four. Measuring what limits parallel speedup on a real machine.
Checkerboards, Rhie-Chow and Spurious Currents
Storing velocity and pressure in the same place makes a solver simple, and lets a zig-zag pressure field pass completely unnoticed. A small collocated solver shows the checkerboard, how Rhie-Chow interpolation removes it, and why interFoam needs one more trick to avoid spurious currents.
Moving Data Between Cores
A parallel CFD run is as fast as its slowest core and as cheap as the data it exchanges. Measuring MPI messages, halo exchange and domain decomposition on a 4-core laptop.
Data Locality in CFD
Same equations, same compiler, same machine, up to 20× difference in runtime. A small 2D Navier-Stokes solver shows why scientific codes must be designed around how data sits in memory.
Mesh Expansion Ratio: When Cell-Size Jumps Matter
A 2:1 jump in cell size wrecks the local truncation error, and the solution of a diffusion problem does not care. A wave crossing the same jump is partly reflected as grid-scale noise, a hundred times more than across a gradual transition. Two 1D experiments on what the expansion-ratio rules of thumb are really about.
Gauss linear or leastSquares? Gradient Schemes on Imperfect Meshes
Two lines in every fvSchemes file decide how cell gradients are computed. On a regular mesh the choice does not matter. On a skewed or irregular one, the Gauss gradient keeps a 12-42% error at any resolution while least squares converges. Measured on five kinds of mesh, plus what a limiter costs.
Is My Mesh Fine Enough? Richardson Extrapolation and the GCI
Three meshes and a formula tell you the order your solver really achieves, an estimate of the mesh-independent answer and an error band. Applied to a lid-driven cavity on five meshes from 16² to 256², including what happens when the meshes are too coarse for the method to work.
Hyperviscosity in DNS: More Reynolds Number for Free?
Replacing the viscous term with a higher power of the Laplacian pushes all the dissipation to the smallest resolved scales: on the same 64³ grid, the equivalent Reynolds number goes from 47 to 123. A pseudo-spectral 3D turbulence code shows what is gained, and the price: a bottleneck that piles energy up near the cutoff, and equations that are no longer Navier-Stokes.
Why Multigrid Always Wins: Solving the Pressure Equation
Gauss-Seidel, conjugate gradient and multigrid on the same pressure equation, from 225 to a million unknowns. The first two get slower and slower as the mesh grows; multigrid needs 8 cycles every time. This is why GAMG is the default for pressure in OpenFOAM.
Mesh Non-Orthogonality: What checkMesh Is Warning You About
On a non-orthogonal mesh, an uncorrected Laplacian does not just lose accuracy: it converges to the wrong answer, and refining the mesh does not help. Measured on a sheared mesh with an exact solution, with OpenFOAM's orthogonal, uncorrected and corrected schemes.
What Numerical Diffusion Really Is
Numerical diffusion is not a vague error: it is a real viscosity that the scheme adds to your equations, and it can be predicted and measured to three digits. A few lines of C show how big it is and where it comes from.
Segregated vs Coupled: Solving Pressure and Velocity Together
SIMPLE solves velocity and pressure one after the other; a coupled solver solves them at once. Same equations, same mesh, same answer: measured on a lid-driven cavity, the difference is 12 outer iterations against thousands, paid with memory and a harder linear system.
Compiler Flags, Precision and Cache: What Really Speeds Up a CFD Solver
Native compilation, -ffast-math, single and mixed precision, big caches: which of them actually make a CFD solver faster? A small C model of OpenFOAM's linear solver answers with numbers, and explains why -march=native gave me 2% and mixed precision 27%.
Pressure-Based vs Density-Based at Low Mach
Why a density-based solver cannot simply be used for incompressible flow: stiffness, dissipation that scales with the speed of sound and round-off, measured on the 1D Euler equations, and what the all-speed (preconditioning) treatment changes.
How Accurately Should You Solve Each Linear System? relTol, Measured
Every outer iteration of a CFD solver solves linear systems that the next iteration will throw away. Solving them too accurately wastes time, too loosely breaks convergence. A sweep of the tolerances of SIMPLE and a coupled solver shows where the sweet spot is: solving the pressure to 1e-6 was 10 times slower and converged in exactly the same number of iterations.
Same Case, More Cores, Different Answer
Run the same turbulent simulation on 1, 2, 4 and 8 processes and you get four different flows. Nothing is wrong: the last bit of a parallel sum changes, and chaos does the rest. A small 2D turbulence solver shows how fast, why it only happens in turbulent flows, and what can and cannot be compared.
Mesh Skewness: The Interpolation Error That Refinement Does Not Fix
When a face centre is not where the line between two cell centres crosses the face, linear interpolation evaluates the field at the wrong point. On a skewed mesh the Gauss gradient keeps an error of 14% at skewness 0.1 whatever the resolution; the skew correction brings it back to second order.
When the Scheme Becomes the Viscosity: the Taylor-Green Vortex
The Taylor-Green vortex at Re = 1600 solved with central, linearUpwind and upwind convection. Upwind gets the peak dissipation almost right, and 89% of it comes from the scheme, not from the viscosity. Measuring how much of a turbulent flow's dissipation is physics and how much is numerics.
Stable Is Not Accurate: Time Steps and Crank-Nicolson
Implicit schemes let you take huge time steps without blowing up. But a stable answer can still lose 80% of a wave in one period, and Crank-Nicolson can turn a step upside down. Euler, backward, Crank-Nicolson and RK4 measured with the spatial error removed.
Turbulence in Two Dimensions: Vortices That Grow Instead of Breaking Up
In 3D turbulence large eddies break into smaller ones and energy is dissipated at the smallest scales. In 2D the opposite happens: vortices merge and grow, energy is almost conserved and only enstrophy cascades to small scales. A pseudo-spectral DNS of decaying 2D turbulence shows the difference, and why the textbook spectrum is not what you get.
Fourier Neural Operators for CFD
Exploring the theoretical foundations and application of Fourier Neural Operators (FNO) and Geo-FNO for modeling complex fluid dynamics.
Deep Parametric PINN: Von Kármán Wake
Parametric neural solver for Von Kármán vortex shedding using SIREN activations and RAR refinement ().
Nothing matches. Try another term.