Solving the Navier-Stokes equations in Python | CFD in Python | Lid-Driven Cavity
Have you ever wanted to start coding Computational Fluid Dynamics (CFD) to simulate fluids? Here is the first example for you. We solve the incompressible NS equations using Chorin's Projection to enforce incompressibility. Here is the code: https://github.com/Ceyron/machine-lea... We will discretize the incompressible Navier Stokes equations, consisting of a momentum equation and an incompressibility constraint, by Finite Differences. Partial Derivatives are resolved using a central difference scheme, the Laplace operator via the five-point stencil, and we use an explicit Euler in time. We account for incompressibility by using Chorin's Projection, which consists of the three steps: 1. Solve for a tentative velocity by forward stepping the momentum equations without the pressure gradient 2. Solve the Pressure-Poisson equation for a corrective pressure 3. Correct the Velocity to enforce incompressibility. The second step is done approximately by 50 Jacobi iterations to reduce complexity. Step (1) and (3) involve Dirichlet Boundary Conditions for the Velocity, which are homogeneous everywhere except for the horizontal velocity at the top that is prescribed. The Pressure Boundary Conditions are homogeneous Neumann (zero gradient over the boundary) everywhere except for the top, where it is a homogeneous Dirichlet BC. That is of course because we do not have an outflow over our solid walls. If this simulation runs for at least 0.1 seconds, swirly motion takes place that can be beautifully seen by the streamlines we plot in the end. Finally, we implement a stability constraint that is based on the von Neumann stability analysis of the Forward in time Central in Space (FTCS) scheme of the heat equation (also known as the CFL condition). This video is inspired by the work of @lorenabarba. Check out her awesome course on CFD in Python https://lorenabarba.com/blog/cfd-pyth... which also helped me a lot in my understanding of the topics. ------- 📝 : Check out the GitHub Repository of the channel, where I upload all the handwritten notes and source-code files (contributions are very welcome): https://github.com/Ceyron/machine-lea... 📢 : Follow me on LinkedIn or Twitter for updates on the channel and other cool Machine Learning & Simulation stuff: / felix-koehler and / felix_m_koehler 💸 : If you want to support my work on the channel, you can become a Patreon here: / mlsim ------- Timestamps: 00:00 Introduction 00:25 Problem Description 00:54 Boundary Conditions 01:30 Chorin's Projection (a splitting method) 02:00 Expected Outcome: Swirls 02:12 Strategy in Index Notation 02:37 Imports 02:56 Defining Constants (Parameters of the Simulation) 04:05 Main Switch (Boilerplate) 04:27 Define Mesh: Spatial Discretizations 05:11 Prescribe Initial Condition 05:48 Central Differences in x 07:13 Central Differences in y 08:11 Five-Point Stencil for Laplace Operator 09:33 Time stepping Boilerplate 09:49 Solving Momentum for Tentative Velocity 12:48 Enforce Velocity Boundary Conditions 14:30 Solving Pressure Poisson for Pressure Correction 20:29 Velocity Correction 21:54 Again Enforce Velocity Boundary Conditions 22:14 Advance in Time 22:37 Plot Solution (+ Bug Fix) 23:42 Discussing the Solution 24:32 Streamline Plot 25:13 Check for Numerical Stability 28:33 Outro

Stable Fluids implemented in Python/NumPy

Coding Adventure: Simulating Smoke

FEniCS Tutorial: Navier-Stokes Equation for Lid-Driven Cavity

Navier-Stokes Equations - Numberphile

Simulating Pipe Flow on a Staggered Grid in Python | with Inflow & Outflow
![Yann LeCun's $1B Bet Against LLMs [Part 1]](https://i.ytimg.com/vi/kYkIdXwW2AE/hqdefault.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLDbV4izF3i-wxevCVIn7FJjoy1vlA)
Yann LeCun's $1B Bet Against LLMs [Part 1]

Navier Stokes Equation | A Million-Dollar Question in Fluid Mechanics

Turbulence Closure Models: Reynolds Averaged Navier Stokes (RANS) & Large Eddy Simulations (LES)

The meme hiding surprisingly advanced math

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones

The million dollar equation (Navier-Stokes equations)

Understanding Navier-Stokes solvers | FEniCS CFD

Derivation of the Navier-Stokes Equations

The most beautiful formula not enough people understand

Turbulence: Reynolds Averaged Navier-Stokes (Part 1, Mass Continuity Equation)

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

We're 99.9% sure this pattern is true, but no one can prove it

Turing Award Winner: Disagreeing with Google, Postgres, Future Problems | Mike Stonebraker

LBM Fluid Simulation in Python with JAX | van Karman Vortex Street

