- Lean 53.9%
- C 39.8%
- Racket 6.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| implementations | ||
| proofs | ||
| screencaps | ||
| specifications | ||
| .gitattributes | ||
| LICENSE | ||
| README.md | ||
| two-cylinders.png | ||
Compressible Hydrodynamics with Lanyon
Highlights
- End-to-end formally verified solvers for the isothermal Euler and full compressible Euler equations (assuming an ideal gas equation of state), in 1D, 2D, and 3D.
- Took ~179 seconds for Lanyon to generate everything.
- ~13 seconds for isothermal Euler in 1D, ~20 seconds for isothermal Euler in 2D, ~35 seconds for isothermal Euler in 3D, ~54 seconds for full compressible Euler in 1D, ~23 seconds for full compressible Euler in 2D, ~34 seconds for full compressible Euler in 3D.
- Real-time screen captures are shown in
/screencaps.
- 10,750 lines of Lean 4 code to prove end-to-end correctness properties.
- 619 for isothermal Euler in 1D, 1,378 for isothermal Euler in 2D, 2,469 for isothermal Euler in 3D, 872 for full compressible Euler in 1D, 1,954 for full compressible Euler in 2D, 3,458 for full compressible Euler in 3D.
- 270 total definitions and 156 total theorems.
- 6,876 lines of formally verified C code.
- 504 for isothermal Euler in 1D, 976 for isothermal Euler in 2D, 1,582 for isothermal Euler in 3D, 601 for full compressible Euler in 1D, 1,206 for full compressible Euler in 2D, 2,007 for full compressible Euler in 3D.
Further Details
The most general form of the compressible Euler equations consists of a conservation law for mass:
\frac{\partial \rho}{\partial t} + \nabla \cdot \left( \rho \mathbf{u} \right) = 0
a conservation law for momentum:
\frac{\partial}{\partial t} \left( \rho \mathbf{u} \right) + \nabla \cdot \left( \rho \mathbf{u} \otimes \mathbf{u} + p \mathbf{I} \right) = 0
and a conservation law for total energy:
\frac{\partial \varepsilon}{\partial t} + \nabla \cdot \left( \mathbf{u} \left( \varepsilon + p \right) \right) = 0
for fluid mass density {\rho}, fluid velocity {\mathbf{u}}, fluid pressure p, rank-2 identity tensor {\mathbf{I}}, and total fluid energy {\varepsilon}. The total energy {\varepsilon} contains contributions from both the fluid's kinetic energy {\frac{1}{2} \rho \mathbf{u} \cdot \mathbf{u}} and the fluid's specific internal energy; for an ideal gas equation of state, this takes the specific form:
\varepsilon = \frac{1}{2} \rho \mathbf{u} \cdot \mathbf{u} + \frac{p}{\gamma - 1}
for adiabatic index {\gamma}.
In the isothermal limit, the mass conservation law is left unchanged:
\frac{\partial \rho}{\partial t} + \nabla \cdot \left( \rho \mathbf{u} \right) = 0
and the momentum conservation law reduces to:
\frac{\partial}{\partial t} \left( \rho \mathbf{u} \right) + \nabla \cdot \left( \rho \mathbf{u} \otimes \mathbf{u} + \rho v_{t}^{2} \mathbf{I} \right) = 0
for (constant) fluid thermal velocity {v_t}, with the pressure term p and the equation for the total fluid energy {\varepsilon} dropping out entirely. For full details of the equations, the numerical methods used for solving them, and the specific prompts used within Lanyon for running simulations, see our technical deep dive on the Euler equations.
