Coder Social home page Coder Social logo

fluid-solver's Introduction

Staggered-Grid Fluid Solver in Rust

screenshot

Building source

  1. Dependencies

    • Rust nightly ( tested with Rust 1.8.0-nightly )
    • clang or gcc
    • OpenCL runtime
  2. Building

    • make build to build the project
  3. Examples

    • make example to build the examples
  4. Benchmarks

    • make bench to run benchmarks

Crates

  • glium for realtime visualisation
  • lodepng-rust for generating density images
  • scoped-threadpool for scoped threading
  • rust-opencl for OpenCL bindings

Project Overview

This Eulerian solver uses the Chorin projection method on a staggered grid.

Chorin projection decouples velocity and pressure in the momentum equation allowing them to be calculated separately. The advection step can be performed using the upwind scheme or the semi-lagrangian scheme. Multiple integrators and interpolators have been implemented with varying degrees of accuracy. The pressure solve step uses the simple jacobi relaxation linear solver. It has been implemented in Rust, C and OpenCL with varying degrees of optimisation.

A staggered grid is used to prevent checkerboarding when calculating the pressure gradient.

Density, pressure and marker-particle visualisation methods have been implemented using the glium and lodepng crates.

Project layout

fluid_solver.rs

  • Ties together all the algorithms required
  • Contains the various fields associated with a fluid and the functions that manage the solver

advection.rs

  • Upwind advection implementation
  • Semi-Lagrangian advection implementation

interpolation.rs

  • Linear interpolation
  • Cubic interpolation
  • Catmull-Rom interpolation
  • Hermite interpolation

integrators.rs

  • Euler integrator
  • Bogacki-Shampine integrator
  • Runge-Kutta 4 integrator

linear_solvers.rs

  • Rust, C, OpenCL implementations of Jacobi relaxation

visualiser.rs

  • Density visualisation
  • Inverse density visualisation
  • Density visualisation with jet colourmap
  • Pressure visualisation with jet colourmap
  • Marker-particle visualisation

fluid-solver's People

Contributors

seanlth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fluid-solver's Issues

opencl no found

Why are there:

[dependencies.opencl]
path = "/Users/Seanlth/Projects/Rust/rust-opencl"


[dependencies.lodepng]
path = "/Users/Seanlth/Projects/Rust/lodepng-rust"

Can't build project.

Integrators

Higher order integrators not working correctly.

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.