callensxavier/leanflow-jhtdb-benchmark
๐ LeanFlow โ Formally Verified Dual-Scale Navier-Stokes Solver LeanFlow is the next generation of Navier-Stokes solvers โ combining formally verified mathematics (Lean 4), AI-native bare-metal execution (Runux AI runtime), and pseudo-spectral accuracy validated on real DNS turbulence data. ๐ Key Results at a Glance Metric LeanFlow ETD-RK4 OpenFOAM icoFoam FDM-PISO (Python) Max Divergence $|\nabla\cdot u|_\infty$ 2.994e-14 4.102e-07 N/Aโฆ See the full description on the dataset page: https://huggingface.co/datasets/callensxavier/leanflow-jhtdb-benchmark.
๐ LeanFlow โ Formally Verified Dual-Scale Navier-Stokes Solver
   
LeanFlow is the next generation of Navier-Stokes solvers โ combining formally verified mathematics (Lean 4), AI-native bare-metal execution (Runux AI runtime), and pseudo-spectral accuracy validated on real DNS turbulence data.
๐ Key Results at a Glance
Why LeanFlow wins on both metrics simultaneously: The Leray projection in Fourier space enforces incompressibility algebraically โ one FFT pass, zero iterations. OpenFOAM converges toward a finite tolerance with PCG. No tolerance โ no floor on divergence residuals โ slower convergence required.
๐ Benchmark #1: JHTDB REST API (givernylocal)
Source: Real DNS cutouts fetched via givernylocal v3.6.2 REST API Dataset: isotropic1024coarse โ Forced HIT, $Re_\lambda \approx 433$, 1024ยณ, DNS pseudo-spectral DOI: https://doi.org/10.1063/1.3351592 Certification: CERT-MULTI-03D703DC
Kolmogorov Spectrum Analysis: Mean slope = -2.397 ยฑ 0.017 (Rยฒโ0.95)
Note: A 64ร64 cutout from 1024ยณ captures only wavenumbers k=1โฆ32 (energy-containing subrange). Slope steeper than โ5/3 is physically expected and correctly documented.
๐ Benchmark #2: HuggingFace JHTDB HDF5
Source: `ArielLubonja/johns-hopkins-turbulence-database` File: isotropic1024-coarse-velocity.h5 โ 256ยณ ร 10 timesteps (2.02 GB, float32) Slice used: 64ร64 XY plane at z=128 Timepoints tested: [1, 3, 5, 7, 10] Certification: CERT-HF-2622BEBE
OOM advantage: ~7.1 orders of magnitude vs OpenFOAM
๐งฌ Architecture
LeanFlow Dual-Scale Pseudo-Spectral Solver
โโโ Macro scale: ETD-RK4 pseudo-spectral NS solver (Fourier space)
โ โโโ Leray projection: รปแตข โ รปแตข โ kแตข(kยทรป)/|k|ยฒ [exact, 0 iterations]
โ โโโ Dealiasing: Orszag 2/3 rule (anti-aliasing filter)
โ โโโ ETD-RK4: Exponential Time Differencing (stiff viscous term exact)
โโโ Sub-grid scale: Katz-Pavloviฤ dyadic shell model
โ โโโ Energy cascade: exponentially spaced shells kโ = 2โฟkโ
โ โโโ Frustration monotonicity: proven in Lean 4
โโโ Formal Verification: Lean 4 kernel proofs
โโโ T-duality invariants (exact rational)
โโโ Galilean invariance
โโโ Enstrophy blow-up criteria (3D, in progress)๐ค AI-Native Design: Runux AI Runtime
LeanFlow is designed as a solver-class for the Runux AI Runtime โ a bare-metal AI execution layer on top of a Rust Linux Mini-Kernel:
- HAL (Hardware Abstraction Layer): Zero-copy memory management via Rust
unsafeArena allocators - SIMD AVX-512: Streaming FFT computation targeting H18 (1000 steps/s)
- PyO3 bindings: Python-callable from any ML pipeline (NumPy array pass-through)
- Lean 4 kernel: Mathematical proof obligations compiled and verified at build time
This makes LeanFlow the first CFD solver class provably correct at the operating-system level.
๐ฌ Formal Verification (Lean 4)
-- Frustration Monotonicity (proven)
theorem frustration_monotone (R : โ) (hR : R > 0) :
R_eff R โค R := by
unfold R_eff; ...
-- T-Duality Invariant (exact rational, verified)
#check t_duality_invariant_Q -- : โ ฮฑ', R_eff (R_eff ฮฑ') = ฮฑ'๐ Dataset Files
๐ Reproducing Results
Option 1: HuggingFace HDF5 Benchmark
git clone https://github.com/xaviercallens/SocrateAI-Numeric-DualScale-Solver
export HF_TOKEN=<your_token> # Never store in code
python3 scripts/hf_jhtdb_benchmark.py # Downloads 2GB HDF5, runs 3 solversOption 2: JHTDB REST API Benchmark
# Uses free testing token (no registration needed)
python3 scripts/jhtdb_multi_audit.py # Fetches 5 real DNS snapshots, runs 2 solversOption 3: Publish to HuggingFace
export HF_TOKEN=<your_write_token>
python3 scripts/hf_full_upload.py # Verifies both certs then uploads๐ Certifications
๐ค Community & Enterprise
Open Source
- Contribution Guide: See
CONTRIBUTING.mdin the main repo - Issues: GitHub Issues
- Open Points: 3D GPU integration, Lean 4 3D enstrophy proofs, Dedalus3 comparison
Enterprise Opportunities
- Licensed Deployment: AI-native solver embedded in commercial CFD pipelines
- Runux AI Integration: Bare-metal execution with AVX-512 SIMD for HPC clusters
- Customization: Domain-specific solver variants (MHD, geophysical, multiphase)
- Formal Verification as a Service: Mathematical certification of solver correctness for safety-critical applications
๐ References
- Li, Y. et al. (2008). A public turbulence database cluster. JoT. https://doi.org/10.1080/14685240802376389
- Katz, J., Pavloviฤ, N. (2005). A cheap Caffarelli-Kohn-Nirenberg inequality. GAFA.
- Orszag, S.A. (1971). On the elimination of aliasing in finite-difference schemes. JAS.
- Cox, S.M., Matthews, P.C. (2002). Exponential time differencing for stiff systems. JCP.
- Lubonja, A. (2024). JHTDB HuggingFace subset. https://huggingface.co/datasets/ArielLubonja/johns-hopkins-turbulence-database
Benchmarks run: 2026-08-31T10:44:45.384898Z | Combined cert: `CERT-COMBINED-C86867F8` | All data real DNS (_measured=true)
