FluidSimulator

A CUDA-accelerated SPH Fluid Simulator

View the Project on GitHub CTKnight/FluidSimulator

Fluid Simulator

CS284A Final Project

Summary

Our project is to simulate the movement of fluid in a given time. We plan to use a position-based method to achieve scalability for our particles. We will also apply several physical constraints to make our fluid rendering more real. After we finish our fluid simulator, we will consider to accelerate the rendering time of fluid and try to reduce the processing time to make a real-time simulator as our aspirational plan.

Team Member

Problem Description

Our ideas come from watching the final projects in previous years and we are inspired by the recent lecture of animation. We are trying to solve is to calculate the locations and movements of fluid particles. With solving this problem, we are able to extensively implement animations involves with fluid. The challenging part of this project is how to calculate the movement and positions of the particles as well as ensuring the calculation can be established within reasonable amount of time. We are trying to use the parallel computing to solve the speed issue.

We plan to use the position-based simulation method from [2] rather than the mpm method. Because mpm method involves solving equations that are not easily scalable. Position-based method is not only easier to implement but also compatible to distribute work among processors. The iteration method in [2] is Jacobi, which is “trivially parallelizable”[1].

For the program architecture, the assignment 4 will be a major reference since it’s also a simulator. It will also provide a debugging window mode and an off-screen simulation mode that only output files like assignment 3.

The workflow for the program will be :

  1. Take in a scene file containing particle initial properties(position/velocity) and other global attributes like density and gravity.

  2. Simulate the fluid with given duration.

  3. Output results in debug format(contains particle positions in time order only) or render format(adapt to renderer’s file format)

Platform/Framework:

Development will be mostly on Windows 10 OS. Programming Language: C++.

Goals and Deliverables

Deliverables

  1. A particle based fluid simulator that outputs particle positions.

    The simulator can take in some demo scenes, simulate the position of fluid particles at each timestamp and output a file for further rendering(could be .vtk format[3] or file formats that mitsuba/blender can render). An OpenGL preview window will also be provided to assist debugging at runtime.

  2. A set of fluid videos generated by 3rd party renderers with the simulation results.

    By using mitsuba/blender, the simulation results can be rendered into videos. We aim to produce some demo video in scenes with fluid only. If we have enough time budget, we can support scenes with fluid and static rigid body (For aspirational plan).

    It may looks like this:

Breaking dam

Double dam

​ (Picture reference: https://www.researchgate.net/publication/309127716_Projective_fluids)

  1. A GPU accelerated version simulator. (For aspirational plan)

    This algorithm can be parallelized in the velocity/position update phase and the Jacobi iteration phase. Some GPGPU techniques like CUDA[4] can be deployed to massively accelerate the computing progress in a million processor scale. Hopefully, this can give us a real-time simulator.

Performance metrics:

  1. Scalability

    This includes weak scaling(performance as particles per processors goes up) and strong scaling(performance as the total number of particles goes up).

  2. Visual effect

    Although this is a Computer Graphics project rather than a Physics project, where we are not aiming to simulate all physical properties of fluid, at least we should consider some physical constraints that greatly influence the visual effects to make the rendered results look like real.

  3. Latency (for aspirational plan)

    If the CUDA acceleration works really well, we can make a real-time/interactive fluid simulator and use simplified rendering technique to preview the results on the fly. Latency can be define as durations between the time when user input data and the time when the corresponding frame is rendered.

Schedule

Here is our plan with scheduling the following four weeks for our final project:

Resources/Reference (see also: BUILDING.md)

  1. Slides explaining Position Based Fluid @ http://www.cse.chalmers.se/edu/year/2018/course/TDA361/Advanced%20Computer%20Graphics/Position%20Based%20Fluids.pdf
  2. Paper @ http://mmacklin.com/pbf_sig_preprint.pdf
  3. VTK file format @ https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf
  4. CUDA @ https://docs.nvidia.com/cuda/
  5. https://github.com/bwiberg/position-based-fluids by Benjamin Wiberg
  6. https://github.com/InteractiveComputerGraphics/SPlisHSPlasH by InteractiveComputerGraphics
  7. Eurographics Tutorial 2019 by InteractiveComputerGraphics @ https://interactivecomputergraphics.github.io/SPH-Tutorial/
  8. Stanford CS 348C assignment page (section Tuning parameters is super helpful!) @ http://graphics.stanford.edu/courses/cs348c/PA1_PBF2016/index.html