Git Product home page Git Product logo

fluidsim's Introduction

FluidSim

Fluid simulator based on Robert Bridson's Siggraph notes, which can be found at:

http://www.cs.ubc.ca/~rbridson/fluidsimulation/fluids_notes.pdf

This project goes about as far as Chapter Five, which is to say it simulates a single-phase, incompressible fluid with no free surface, being entirely confined to a box.

This is achieved by numerically solving the incompressible Navier-Stokes equations for fluid flow. The solution is split into an Advection step followed by a Projection step:

  • The advection step is the semi-Lagrangian method (Jos Stam)
  • the projection step solves a system of linear equations using the pre-conditioned conjugate gradients (PCG) method.

The result at each step is written out to an openVDB container, which can be imported into e.g. Houdini to view and render.

The solver can be run from the commandline (type 'fluidsim --help' for available options), which allows some limited control of the volume size and time step. Test solids can be added by modifying main.cpp directly using the setSolid method on the FluidGrid class.

To view some sample renders, go to my vimeo page at https://vimeo.com/johnakelly/videos/

screenshot

UPDATE 21/8/23: I made this nine years ago as a toy project to help me learn some concepts in CFD. My original implementation used custom code for the linear algebra operations and the PCG solver, but recently I've been learning OpenVDB so I started using that library's grid representation and PCG solver instead. Further work would likely delegate the buffering and advection to OpenVDB. Be warned, I suspect there are some serious bugs, particularly relating to the handling of solid boundary conditions. Testing would help to fix these, but this would require a good understanding of the expected state of the grid at each stage of the solve, and I'm still trying to achieve that :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.