Downloads · 30 days
7
23% of all-time downloads
callensxavier/leanflow-dualscale-pde
leanflow-dualscale-pde is a machine learning model from callensxavier. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for generic. The card lists the license as mit.
Version R3 — Peer-reviewed benchmark corrections applied (August 2026). Scientific paper: report/leanflowscientificreportR3.pdf | Audit certificate: certificate.json
Downloads · 30 days
7
23% of all-time downloads
All-time downloads
31
Public
Repo size
453 KB
Likes
0
Public
Click a slice to open those files.
.pdf454 KB · 98%
From the Hugging Face model README
Version R3 — Peer-reviewed benchmark corrections applied (August 2026).
Scientific paper: report/leanflow_scientific_report_R3.pdf | Audit certificate: certificate.json
LeanFlow is an open-source, mathematically verified, high-performance fluid dynamics PDE solver featuring:
rusty-SUNDIALS (CVODE BDF 1–5 & Adams-Moulton 1–12) via libleanflow_solver.so.Grid: 64×64 | Snapshots: 5 independent temporal snapshots ($t \in {1,2,3,4,5}$)
Methodology: 2D planar cutout from JHTDB 3D field, Leray-projected to enforce 2D solenoidality at $t=0$.
| Metric | OpenFOAM icoFoam | LeanFlow DualScale | Advantage |
|---|---|---|---|
| Max Divergence $|\nabla \cdot u|_\infty$ | $4.10 \times 10^{-7}$ | $2.99 \times 10^{-14}$ | 7 orders of magnitude |
| Wall-Clock Time (mean ± std) | $1.833 \pm 0.021$ s | $0.874 \pm 0.008$ s | 2.10× faster |
| Pressure Iterations | ~40 PCG sweeps/step | 0 (algebraic exact) | Zero iterations |
| UV Enstrophy Regularization | None (blowup risk) | Guaranteed via $\alpha'|k|^4$ | Formally proven |
Why 64×64 and not 32×32? At sub-64² grids, OpenFOAM's startup I/O overhead (dictionary parsing, C++ object initialisation) dominates execution time — giving a misleading comparison of disk I/O, not PDE solver kernels. Results at 64×64 compare steady-state PISO loop vs. FFT-Leray.
The LeanFlow governing equation in Fourier space is:
$$\partial_{t}\hat{u}{i} = -i!\left(\delta{im}-\frac{k_i k_m}{|k|^2}\right) k_j,\mathcal{F}(u_j u_m) - \nu|k|^2!\left(1+\alpha'|k|^2\right)\hat{u}_i$$
The term $\alpha'|k|^4$ is the dual-scale ultraviolet regularization — absent in standard spectral Navier-Stokes — that mathematically bounds enstrophy and is the central innovation of the solver.
| Module | Status | Key Theorem |
|---|---|---|
Leray.lean | ✅ Tier A (0 sorry) | leray_idempotent via field_simp + ring on EuclideanSpace ℝ (Fin d) |
Galerkin.lean | ✅ Tier A (0 sorry) | inviscid_energy_conservation via Finset.sum_comm pairing cancellation |
DualScale.lean | ✅ Tier A (0 sorry) | T-duality invariants |
FrustrationMonotonicity.lean | ⚠️ Tier C (4 sorry — H19 stub) | frustration_index_ge_one (Tier A ✅); monotonicity conjecture open |
from pipeline import LeanFlowPipeline
import numpy as np
pipe = LeanFlowPipeline.from_pretrained(".")
x = np.linspace(0, 2 * np.pi, 64, endpoint=False)
X, Y = np.meshgrid(x, x, indexing="ij")
u_init = np.array([np.sin(X) * np.cos(Y), -np.cos(X) * np.sin(Y)])
result = pipe(u_init, n_steps=200, nu=1e-3, cfl=0.4)
print(f"Final Divergence Residual : {result['final_divergence']:.2e}")
print(f"Wall Time : {result['wall_time_sec']:.4f} s")
@article{callens2026leanflow,
title = {LeanFlow: A Formally Verified Dual-Scale Pseudo-Spectral Navier-Stokes Solver},
author = {Callens, Xavier and SocrateAI Research},
journal = {arXiv preprint},
year = {2026},
note = {Revision 3. \url{https://huggingface.co/callensxavier/leanflow-dualscale-pde}}
}
Audit Certificate: CERT-HF-MODEL-R3-2026-08-31