Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

2D MAC Grid CFD

Validation-first Python/NumPy implementation of a 2D incompressible MAC grid fluid simulator.

Scope

Included in v1:

  • Row-major [j, i] MAC grid arrays.
  • Closed-wall normal velocity boundaries.
  • Bilinear sampling for cell and face fields.
  • Divergence, Jacobi pressure solve, and pressure projection.
  • Semi-Lagrangian dye and velocity advection.
  • Deterministic mouse force and dye injection APIs.
  • Headless dye renderer.

Excluded from v1: viscosity, vorticity confinement, obstacles, free surfaces, FLIP/PIC, buoyancy, turbulence, adaptive meshes, advanced UI, and real-time performance targets.

Commands

python -m pytest
python -m macfluid.render --steps 10 --out smoke.png
python -m macfluid.interactive

The renderer writes a PNG file without requiring a display server.

Interactive Viewer

python -m macfluid.interactive
  • Drag with the left mouse button to inject velocity and dye.
  • Press space to clear the simulation.
  • Press s to save the current dye image to artifacts/interactive-screenshot.png.
  • Press q or esc to quit.

Useful options:

python -m macfluid.interactive --nx 96 --ny 96 --scale 6 --pressure-iterations 220

The interactive viewer uses Python's standard tkinter window toolkit, so it does not add a runtime dependency beyond NumPy.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages