2D Fluid Simulator
August 22, 2025 · View on GitHub

Features
- Finite Difference Method (MAC Method)
- Advection Scheme
- Upwind Differencing
- Kawamura-Kuwahara
- CIP (Constrained Interpolation Profile)
- Flow Visualization
- Norm (Velocity) and Pressure
- Pressure
- Vorticity
- Dye
- Vorticity Confinement
Setup
Run the following command in an environment with the uv project management tool installed:
uv sync
GeForce GTX 1080 or higher recommended.
Usage
- Boundary Condition 1, ReynoldsNumber = 1000, dt = 0.0005, VorticityConfinement is Disable
Pressuv run main.py -re 1000 -dt 0.0005 -vc 0.0Vkey switches the flow visualization method.dtis automatically determined even if not specified, but should be small for divergence. - Boundary Condition 2, resolution = 800
Boundary conditions can be specified from 1 to 6uv run main.py -bc 2 -res 800 - Boundary Condition 3, ReynoldsNumber = , resolution = 800, VorticityConfinement = 10
uv run main.py -bc 3 -re 100000000 -res 800 -vc 10 - Help
uv run main.py -h - for CPU
uv run main.py -dt 0.0005 -cpu
Screenshots
Flow Visualization
- Norm and Pressure

- Pressure

- Vorticity

- Dye

Vorticity Confinement
- Disable

- Enable
