ML-Enhanced Turbulence Modeling in OpenFOAM

Train a neural network to correct RANS turbulence model errors using LES reference data

Advanced Aerodynamics 8–12 weeks
Last reviewed: March 2026

Overview

RANS (Reynolds-Averaged Navier-Stokes) turbulence models — k-ε, k-ω SST, Spalart-Allmaras — are the workhorses of industrial CFD. They're fast enough for engineering design but introduce systematic errors by modeling the effects of all turbulent scales with simple algebraic closures. These errors are largest in flows with separation, adverse pressure gradients, and strong curvature — exactly the conditions most relevant to aircraft wings, turbine blades, and engine inlets.

In this project, you'll implement data-driven turbulence model correction: use high-fidelity LES (Large Eddy Simulation) data to train a neural network that learns the systematic discrepancy between RANS predictions and the true turbulence statistics. The trained network applies corrections to the RANS stress tensor during simulation, improving accuracy without the enormous computational cost of LES.

This field — machine learning for turbulence modeling — has produced hundreds of papers since 2016 and is attracting major investment from NASA, the DoD, and aerospace OEMs. Key contributions have come from groups at Stanford, MIT, Cambridge, and ETH Zurich. This project gives you hands-on experience with the methodology that underlies those publications.

What You'll Learn

  • Set up and run OpenFOAM RANS (k-ω SST) and LES simulations for canonical flows (channel flow, backward-facing step)
  • Extract turbulence statistics from LES data and compute the RANS-LES discrepancy in the Reynolds stress tensor
  • Engineer input features for the ML model based on local flow quantities (strain rate, vorticity, pressure gradient)
  • Train a neural network to predict Reynolds stress anisotropy tensor corrections
  • Embed the trained network correction into an OpenFOAM RANS solver via Python or C++ runtime interface

Step-by-Step Guide

1

Understand the RANS Closure Problem

Study the Reynolds-Averaged Navier-Stokes equations and understand the closure problem: the Reynolds stress tensor τ_ij = -ρ⟨u_i'u_j'⟩ contains 6 unknowns that must be modeled. RANS models (k-ω SST, etc.) use the Boussinesq hypothesis: τ_ij ≈ 2μ_t S_ij - (2/3)kδ_ij, where S_ij is the strain rate tensor and μ_t is the eddy viscosity.

The Boussinesq hypothesis is exact only for simple shear flows. Read Pope (2000) "Turbulent Flows" Chapter 11 for the theoretical limitations, and Weatheritt & Sandberg (2016) for the data-driven correction approach you'll implement.

2

Run LES and RANS for Channel Flow

Start with fully developed turbulent channel flow at Re_τ = 395 — the most studied turbulent flow, with high-quality DNS reference data from Moser et al. (1999). Run OpenFOAM k-ω SST RANS and a wall-resolved LES with the Smagorinsky subgrid model on the same geometry.

Compare the mean velocity profile, Reynolds shear stress, and turbulent kinetic energy profiles between RANS, LES, and DNS reference data. Quantify the RANS errors — this is what the ML model must learn to correct. Use the built-in OpenFOAM postprocessing utilities (turbulenceFields, fieldAverage) to extract time-averaged statistics from the LES.

3

Extract the Discrepancy Field

The target for the ML model is the discrepancy: Δτ_ij = τ_ij^LES - τ_ij^RANS, computed field by field at every grid point. Post-process both simulations in Python using the fluidfoam library to load OpenFOAM field data into NumPy arrays. Compute the full Reynolds stress tensor from LES data and compare against RANS.

Decompose the discrepancy into: eddy viscosity correction (scalar) and Reynolds stress anisotropy correction (traceless symmetric tensor). The anisotropy tensor is a better ML target because it separates the magnitude correction (easy) from the directional correction (hard and physically meaningful).

4

Engineer Input Features

The ML model must predict the stress correction from local flow quantities that are available during RANS simulation. Standard feature choices (following Ling & Templeton 2015): the 10 invariants of the strain rate tensor S_ij, vorticity tensor Ω_ij, and their products; dimensionless pressure gradient; dimensionless wall distance; turbulence intensity k/||U||².

These inputs are invariant to rotation and reflection — an important physical constraint called Galilean invariance. Using frame-invariant features ensures the model works regardless of how the coordinate system is oriented relative to the flow.

5

Train the Correction Network

Train a neural network mapping [local flow features] → [Reynolds stress anisotropy correction]. Use the LES-derived correction field as training labels. Architecture: 4–6 fully connected layers with 50–100 neurons, tanh activation. Train on channel flow data and validate on a different channel flow at a different Reynolds number (Re_τ = 550).

Alternatively, implement the Tensor Basis Neural Network (TBNN) of Ling et al. (2016) — a physics-constrained architecture that guarantees the output satisfies the symmetry and trace conditions of the Reynolds stress tensor by construction, significantly improving generalization.

6

Embed in OpenFOAM and Evaluate

Integrate the trained correction into OpenFOAM using the Python runtime interface or by compiling a custom turbulence model in C++ that calls the neural network at each iteration. Run the corrected RANS solver on the backward-facing step (a harder flow not in the training data) and compare against LES reference data.

Quantify the improvement: does the ML-corrected RANS capture the reattachment length better than standard k-ω SST? Does it improve velocity profiles in the separated region? Create a comparison figure showing DNS/LES reference, standard RANS, and ML-corrected RANS — this is the standard figure in data-driven turbulence modeling papers.

Go Further

Push this toward publication-quality research:

  • Field inversion — instead of training directly on LES data, use field inversion optimization to find the correction field that makes RANS match LES, then train the ML model to predict this field
  • 3D complex geometry — apply the trained model to a 3D wing-body junction or a turbine cascade — geometries where RANS errors are large and LES is prohibitively expensive
  • Uncertainty quantification — train a Bayesian neural network or ensemble of networks to provide uncertainty bounds on the corrections, flagging regions where the model is extrapolating
  • Publish — data-driven turbulence modeling results are actively published in Physics of Fluids, Journal of Fluid Mechanics, and AIAA Journal