An End-to-End PyTorch Interface for Differentiable PDE Solvers: A RANS Model-Correction Study
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.
Tom: Today's paper: "An End-to-End PyTorch Interface for Differentiable PDE Solvers".
Jane: The gist The work presents an end-to-end strategy for solving inverse problems constrained by Partial Differential Equations within a fully differentiable Machine Learning framework.
Tom: First, who's behind it and why it matters.
Title and authors: Tom: So we're looking at this paper, "An End-to-End PyTorch Interface for Differentiable PDE Solvers: A RANS Model-Correction Study." It sounds like they built a way to link solving partial differential equations directly into a machine learning framework.
Jane: That's right, Tom. They’re looking at how you can use machine learning to solve inverse problems where the constraints are actually those tough PDE systems, like the Navier-Stokes equations.
Lu: What’s interesting here is that they aren't just tacking on a simple correction term; they are building an entire differentiable pipeline from the baseline solver all the way to how you train it.
Meng: So, instead of running a simulation and then manually tweaking parameters, this approach lets you optimize the whole thing in one go using gradient descent.
Lalam: It means we can move beyond just predicting something; we can actively learn how to satisfy the physics constraints while fitting some data or model requirements.
The paper's summary: Tom: The core idea they present is combining a baseline solver that solves the nonlinear system R(w) equals zero with a trainable, differentiable correction term, which they call f(w), parameterized by some parameters p.
Jane: They formulate this so that the PDE itself becomes an implicit layer in the learning process, which is really clever because it lets you integrate it into any objective function you have.
Lu: The paper tackles two main problems: first, for fixed parameters p, finding the state w that solves R(w) plus f(w) equals zero by minimizing the residual of that combined system.
Meng: And second, for a given cost functional J involving both w and p, they use a Lagrangian approach to find the optimal parameters p that make the PDE hold.
Lalam: It suggests a modular structure with three main components: enforcing boundary conditions, evaluating the discrete residual of the governing equations, and applying those external or model-derived forcing terms.
The paper's improvements: Tom: They show how they can use this interface to tackle real engineering problems, specifically looking at data assimilation and turbulence modeling using compressible RANS equations.
Jane: They do this by treating the turbulence model closure, for instance, as something that needs to be learned or parameterized based on the state variables.
Lu: In one approach, they treat a term like eddy viscosity as a spatially varying tunable parameter α, and then they show how to reconstruct that field using explicit residual minimization.
Meng: And in another case, they propose using a Convolutional Neural Network to learn this turbulence model directly from data, which is pretty interesting because it’s strongly local.
Lalam: They also show how the framework can handle the backpropagation through these custom layers by solving an associated adjoint system to compute those exact gradients with respect to the trainable parameters.
Conclusion: Tom: So, to wrap up, this paper shows a way to create a fully differentiable workflow that connects physics-based solvers like RANS equations with machine learning components.
Jane: It essentially gives us an end-to-end method for solving inverse problems constrained by these PDEs, which opens doors for data assimilation and model correction.
Lu: The implication is that we can treat turbulence modeling not just as a fixed assumption, but as something that the model learns based on the flow state.
Meng: Practically speaking, this means we can build better surrogate models for turbulence closures using CNNs trained on design of experiments data to predict those eddy viscosity fields accurately.
Lalam: And the framework is general enough to extend to any PDE-constrained system with embedded closure models, establishing a consistent way to integrate trainable components into physics-based solvers.
Digital Sciences & Technologies Department, Safran Tech · DAAA, ONERA, Institut Polytechnique de Paris (Meudon) · MONHADE, équipe INRIA-ONERA
cs.CE, cs.LG, math-ph, math.MP
Submitted: 2026-05-19
Updated: 2026-05-19
License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
Importance score: 79/100
The gist: The gist The work presents an end-to-end strategy for solving inverse problems constrained by Partial Differential Equations within a fully differentiable Machine Learning framework.
Key concepts
- Differentiable PDE Solver
- This is a core component that solves the governing equations of fluid dynamics (like RANS) and allows its numerical routines to be differentiated. This enables the system to calculate gradients necessary for machine learning optimization, treating the PDE solution as a differentiable layer in a neural network.
- Model-Correction Strategy
- The approach splits the problem into two parts: solving the main PDE with fixed parameters and then using a trainable correction function to account for residuals or unknown physics. This allows the model to learn how to adjust the baseline solution to match observed data or constraints.
- Implicit Layer Formulation
- The PDE is reformulated as an implicit layer within the overall objective function. This mathematical trick allows the PDE constraint to be integrated seamlessly into standard optimization algorithms, enabling gradient flow through both the physical solver and the learning components.
Terminology
Summary
The gist The work presents an end-to-end strategy for solving inverse problems constrained by Partial Differential Equations within a fully differentiable Machine Learning framework.
How it works
-
The approach combines a baseline differentiable PDE solver, which predicts the state w from the nonlinear system R(w) = 0, with a generic additive, parametrized and differentiable correction f(w), with trainable parameters p.
-
The PDE is reformulated as an implicit layer, enabling its integration into arbitrary objective functions by treating it as an implicit layer.
-
Two algorithmic problems are addressed: first, for given parameters p, seeking the state w that solves R(w) + fp(w) = 0 by minimizing the norm of the residual J(w) = R(w) + fp(w)2. Second, for a given cost functional J (w, p), seeking parameters p such that R(w) + fp(w) = 0 by minimizing J (2.4).
-
For solving for the state with fixed parameters, residual minimization is used by minimizing the norm of the residual Q = [R(w) + fp(w)]2. This involves computing the differential of J (w) using an explicit operation and back-propagation through the PDE solver and closure term.
-
For solving for parameters, a Lagrangian L (w, n, p) is introduced, leading to Karush-Kuhn-Tucker optimality conditions that allow for gradient descent strategy where the gradients are computed as D M-1 (∂Jp)T - (∂fp(w))T (∂wR + ∂wfp(w)) - T (∂wJ)T.
-
The end-to-end differentiable learning pipeline is organized around a modular structure composed of three fundamental components: enforcing boundary conditions, evaluating the discrete residual of the governing equations, and applying external or model-derived forcing terms.
Data assimilation and closure with compressible RANS equations
-
The steady compressible RANS equations are written as a system (3.1). To close the system, models relating PR and QT to the state variables are required, most commonly relying on the Boussinesq eddy viscosity assumption (Boussinesq 1877).
-
One approach defines the baseline model with state vector w = [ρ, ρU, ρV, ρE] and the discrete version of (∗) in (3.3) for R(w). The correction term f (w, α) in (2.11) then represents the left-over part of the equation, the discretization of term (∗∗), with α = μt.
-
In the data assimilation setting, μt is treated as a spatially varying tunable parameter, μt(x). In contrast, the closure problem (2.12) consists of identifying a functional relationship between the eddy viscosity and the state, μt,p(w).
-
An alternative approach incorporates a turbulence model directly into R, considering the SA model where the eddy viscosity μt depends analytically on an additional variable ν˜ (i.e., μt(ν˜)) governed by (Spalart and Allmaras 1992). The state vector is augmented as w = [ρ, ρU, ρV, ρE, ρν˜], and the baseline operator R now includes the full (∗) + (∗∗) equation (3.3), and the turbulence variable equation (3.5).
The end-to-end differentiable learning pipeline applied to BROADCAST
-
The BROADCAST solver was chosen as core CFD solver because of the possibility of automatically differentiating its Fortran routines thanks to the software Tapenade (Hascoët 2004). Every routine can be linearized to obtain the Jacobian-vector product (JVP) and the vector-Jacobian product (VJP).
-
The discrete equations are written as M w n+1 − w n Δt = R(w n+1) + P fp(w n+1), where M is a diagonal matrix representing the volume of each cell.
-
The computational flow follows the sketch introduced in Section 2.3, structured around a main module delivering R(w), RANS, composed of three internal layers: BC, NS and FORCE. Each layer serves as an interface to underlying Fortran routines from the BROADCAST solver (Poulain et al 2023).
-
The custom layers (BC, NS, and FORCE) can be composed into a PyTorch nn.Module: RANS, which automatically handles the chaining of gradients and the definition of the backward pass.
Results
-
The routines are first validated on NASA’s 2D Wall-Mounted Hump for data assimilation of the β parameter (using both explicit and implicit strategies).
-
In § 4.3, we demonstrate that, given the SA solution for the VKI LS-59 case, wSA = [ρ, ρU, ρE], we are able to satisfactorily reconstruct the SA eddy viscosity field μSA t using the explicit residual minimization strategy by tuning α = μt.
-
In § 4.4.2, a CNN-based algebraic turbulence model μt,p(w) is constructed that reproduces the SA eddy viscosity μSA t over a custom dataset. The optimization is carried out using the explicit strategy by minimizing the residual of a corrected model on the custom dataset.
-
The CNN-based algebraic eddy viscosity model can be regarded as strongly local, since its kernel width is limited to that of the spatial scheme, i.e., a few grid cells in each spatial direction.
Discussions and conclusions
-
The first two test cases show that both optimization strategies are fully operational, correctly propagating gradients through the entire computational chain in a truly end-to-end fashion.
-
The results further confirm the effectiveness of the proposed approach in predicting the eddy viscosity directly from the conservative flow variables.
-
The framework is general and extends naturally to PDE-constrained systems with embedded closure models, establishing a consistent and scalable paradigm for integrating trainable components within physics-based solvers via differentiable formulations and adjoint-based optimization.
A. PyTorch routines
All routines described in this work are implemented in Python, while the underlying CFD solver, including its numerical schemes, is implemented in Fortran and compiled (e.g., using Intel or gfortran compilers) as Python-callable libraries. These are interfaced with PyTorch via ctypes and wrapped using torch.autograd.Function.
B. Completeness and sensitivity of the dataset
1500 distinct parameter sets were generated, resulting in 840 successfully converged cases, having defined a tolerance for the value of the RANS residual.
A univariate statistical analysis was performed, constructing a histogram for each parameter to illustrate the distribution of the converged cases within the original design space.
A variance-based global sensitivity analysis was conducted using Sobol indices to assess the influence of each input parameter on the variance of the output.
C. Computing the gradients for the backward operation in PyTorch
The change of variable is performed by introducing a new variable θtilde = Np at the definition of the problem, and then directly computing partial derivative of the Lagrangian with respect to θtilde as D Np-1 (∂Jp)T + (∂fp(w))T M-1 ∂Jp = D Np-1 (∂J)T + (∂fp(w))T M-1 ∂J, since M is a symmetric matrix. This is precisely as computed in (2.25), but with respect to the new variable θtilde.
D. Architecture of the developed Convolutional Neural Network
The NN employed in this work is designed to approximate the relationship between the mean-flow conservative variables and the turbulent eddy viscosity field, μt (w). The architecture combines one-dimensional convolutional layers with fully connected (linear) layers and nonlinear activation functions. The choice of one-dimensional convolutions is guided by the structured nature of the mesh and ensures invariance with respect to rotations aligned with the grid directions. A key aspect of the design concerns the spatial support of the convolutional kernels, which is kept smaller than the stencil width of the underlying numerical scheme.
E. Layer Type Specification
The implementation uses a class BC(torch.autograd.Function) where @staticmethod def forward(u): return bc.f90(u). This shows how individual computational blocks are defined and wrapped as differentiable layers.
**F.
Improvements for AI systems
-
A fully differentiable framework for solving inverse problems constrained by PDEs allows for
the optimization of parameters within a fully differentiable Python workflow by reformulating the PDE as an implicit layer,
enabling end-to-end optimization thatunifies simulation and learning within a single workflow.
-
The system can perform data assimilation by optimizing spatially varying parameters, such as eddy viscosity, where the framework is applied to
reconstruct the full state of a nonlinear multiscale system from partial observations by solving an inverse problem.
-
The improved AI system can generate high-fidelity surrogate models for turbulence closures using Convolutional Neural Networks (CNNs) trained on datasets generated via Design of Experiments (DOE), such as the
VKI LS-59 turbine blade,
to predict eddy viscosity fields thataccurately reconstruct the eddy viscosity in the wake of profiles.
-
The system can perform algebraic turbulence modeling by training a CNN to model closure relations, enabling the creation of models like
a CNN-based algebraic eddy viscosity model
that are capable of reproducing results from one-equation RANS models, even in regions where classical modelsperform poorly.
-
The architecture allows for the integration of traditional solvers with ML components by implementing custom layers that
override PyTorch’s default backward behavior by solving an associated adjoint system to compute exact gradients with respect to the trainable parameters.
Sources
- A Robust Multi-Batch L-BFGS Method for Machine Learning
- Volume-Preserving Transformers for Learning Time Series Data with Structure
- PLAID: A Unified Data Model for Machine Learning on Heterogeneous Physics Simulations
- MMGP: a Mesh Morphing Gaussian Process-based machine learning method for regression of physical problems under non-parameterized geometrical variability
- Towards scalable surrogate models based on Neural Fields for large scale aerodynamic simulations
- Physics Constrained Deep Learning For Turbulence Model Uncertainty Quantification
- Turbulence closure modeling with machine learning approaches: A perspective
- Universal Approximation Theorem for Neural Networks
- An Introduction to Convolutional Neural Networks
- Active learning of data-assimilation closures using Graph Neural Networks
- Mean flow data assimilation using physics-constrained Graph Neural Networks
- Data-Driven Adaptive Gradient Recovery for Unstructured Finite Volume Computations
- A data-driven learned discretization approach in finite volume schemes for hyperbolic conservation laws and varying boundary conditions
- An overview of gradient descent optimization algorithms
- Machine Learning for RANS Turbulence Modelling of Variable Property Flows
- A Regularized Limited Memory BFGS method for Large-Scale Unconstrained Optimization and its Efficient Implementations
Related papers
- Constrained Sensing and Reliable State Estimation with Shallow Recurrent Decoders on a TRIGA Mark II Reactor
- A finite-element-inspired bipartite graph learned simulator for manufacturability assessment in large-deformation sheet forming
- Non-linear mechanical field reconstruction coupling recurrent neural networks with physics-informed graph neural networks
- Neural-Parameterized Cellular Automata for Wildfire Spread
- A mesh-based neural energy method for the simulation of heterogeneous composites
- Evidence-Unit Fairness and the Limits of Query-Adaptive Sparse-Dense Fusion in Financial Document Retrieval