Giter Club home page Giter Club logo

eulerian-fluid-sim's Introduction

Semi-Eulerian Fluid Simulation

This program is my attempt at a fluid simulation based on the works of Matthias Müller, as explained in this video and this PDF. It visualises a circle in a wind tunnel where the wind flows from left to right. Shapes other than a circle can be defined, but tend not to work as well due to the grid based simulation. Such a fluid simulation is rather imperative by nature so implementing it in a functional language was a challenge. meme about monads

Usage

To run, cabal run -O2 is recommended as the program is quite CPU intensive.

The circle can be moved by dragging the mouse.

There are several variables at the top of the file Main.hs which control the parameters of the simulation.

Variable Description
width and height Control window size
cellWidth and cellHeight Control the resolution of the simulation
cellSpacing The physical size of a single cell (m)
numIters Number of divergence iterations. Higher is more accurate, but takes longer.
drawingMode How to visualise the simulation
dt The time step used in the simulation
fluidDensity Density of the fluid

Visualisation modes

There are four ways of visualising the simulation:

  • Smoke : inject some smoke at the left hand side and draw the smoke density at each point.
  • Pressure : Visualise the pressure at each point.
  • Velocity : Slightly unorthadox method of visualising the horizontal and vertical velocities at each point.
  • SmokePressure : View the pressure field multiplied by the smoke field - that has the effect of showing a kind of coloured smoke based on the pressure.

Examples

Pressure field - smoke field

Smoke

Strange velocity visualisation

Pressure field

eulerian-fluid-sim's People

Contributors

jachdich avatar

Watchers

 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.