Code Monkey home page Code Monkey logo

gpu-fluid's Introduction

Fluid

OpenGL GPU Fluid Solver

This project implements a 2D fluid solver completely on the GPU using OpenGL 4.3.

The solver features a marker-and-cell grid, vorticity confinement, fluid implicit particle, 3rd order Runge-Kutta advection, a conjugate gradient solver with incomplete Poisson preconditioner, and a heat diffusion/buoyancy model.

Videos rendered with this code:

Compilation

Compilation requires freeglut and a recent version of GLEW. The makefile in the repository should work on Windows (tested with MinGW) and Linux.

Usage

A recent GPU with fresh drivers is necessary to run this application. Support for OpenGL 4.3 core profile is required. Tested on a GTX480.

When run, the program will open a graphics window and display a preview of the current simulation progress. If the macro RECORD_FRAMES in Main.cpp is set, the program will save out the individual frames as pngs using lodepng.

Note that the window resolution is independent of the fluid resolution; they are controlled individually using the constants GWidth/GHeight for the graphics window and FWidth/FHeight for the fluid grid resolution in Main.cpp. This is to allow for fluid resolutions much larger than the screen resolution. Frames will always be saved at the fluid resolution.

Code

Main.cpp controls the application setup and invokes the fluid solver. Fluid.cpp, along with all the shader files, performs all of the fluid related work. All the remaining files are utilities to deal with OpenGL.

Scene setup and inflows are controlled in Fluid::initScene and at the end of Fluid::update. These can be modified to get more interesting looking simulations.

gpu-fluid's People

Contributors

tunabrain avatar agrif avatar

Watchers

 avatar James Cloos avatar  avatar

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.