2D fluid simulation implementation of Jos Stam paper on real-time fuild dynamics, including some suggested extensions.

Overview

Fluid Simulation

image

Usage

  1. Download this repo and store it in your computer.
  2. Open a terminal and go to the root directory of this folder.
  3. Make sure you have installed the needed dependencies by typing:
$ pip install numpy
$ pip install matplotlib
$ pip install ffmpeg

Note: Go to Install FFmpeg on Windows section if you haven't installed FFmpeg software locally before. It must be added to PATH so that videos can be saved.

  1. Type to run:
$ python fluid.py -i config.json

Where the config.json file is the input file inside the same folder as main.py file.

The Development Log file is also located in the root directory of this repository, where all the logic and structure of the programming done is explained.

Input

The config.json file is the input file you must provide as a command parameter. The structure of the file must be the following:

  1. color: string that contains any of the available options in colors.py.

  2. frames: integer that determines the frame duration of the video.

  3. sources: an array of dictionaries. Each dictionary in the array represents an emitter, which is a source of density and velocity. There cannot be emitters of just velocity or just density, because it would not make sense. Emitters must contain:

    • position: x and y integers, which are the top left position.
    • size: integer that defines an NxN square emitter.
    • density: integer that represents the amount of density of the emitter.
    • velocity:
      • x and y float/integer numbers that represent the velocity direction of the emitter.
      • behaviour: string that contains any of the available options in behaviours.py.
      • factor: float integer/float number that will act as a parameter depending on the behaviour chosen.
  4. objects: an array of dictionaries. Each dictionary in the array represents an object, where each of the objects must contain:

    • position: x and y integers, which are the top left position.
    • size: height and width integers, which will be the shape of a height x width rectangular object.
    • density: integer that represents the amount of density of the object. An object is indeed having a constant amount of density that will not be modified by the liquid, since it's a solid, but you need to determine the density or 'color' the object will have visually.

The folder evidences contains a series of example JSON files and their output videos, with both simple and complex examples of the output.

Features

  • Color Scheme

Inside the config.json file, change the color property and write the color scheme you want from the list below.

image

For example, by having 'hot' as the color property in the json file, you get the following:

image

  • Sources Placement

Inside the config.json file, you can specify the characteristics of an emitter you want to place. An emitter is a source of density and certain velocity.

image

  • Objects Placement

Inside the config.json file, you can specify the position and shape of a solid object inside the fluid.

image

  • Velocity Behaviours

Inside the config.json file, change the behaviour property inside velocity and write the behaviour of the velocity of said emitter you wish for. Supported options are:

  1. zigzag vertical,

image

  1. zigzag horizontal, that works the same as the above but horizontally.

  2. vortex,

image

  1. noise,

image

  1. fourier (left), which is a bit like a zigzag (right) but noisier.

image

  1. motor

image

Install FFmpeg on Windows

Apart from the pip installation of ffmpeg, you need to install ffmpeg for your machine OS (in my case, Windows 10) by going to either of the following links:

  • ffmpeg.org

    • Click on the Windows icon.
    • Click on gyan dev option.
  • gyan.dev

    • Go to the Git section and click on the first link.
    • Extract the folder from the zip.
    • Cut and paste the folder in your C: disk.
    • Add C:\FFmpeg\bin to PATH by typing in a terminal with admin rights:
     $ setx /m PATH "C:\FFmpeg\bin;%PATH%"
    
    • Open another terminal and test the installation by typing:
     $ ffmpeg -version
    

Handy Links

Owner
Mariana Ávalos Arce
I like code and math. I like football too. [Software & Computer Graphics]
Mariana Ávalos Arce
The unified machine learning framework, enabling framework-agnostic functions, layers and libraries.

The unified machine learning framework, enabling framework-agnostic functions, layers and libraries. Contents Overview In a Nutshell Where Next? Overv

Ivy 8.2k Dec 31, 2022
A Python library for detecting patterns and anomalies in massive datasets using the Matrix Profile

matrixprofile-ts matrixprofile-ts is a Python 2 and 3 library for evaluating time series data using the Matrix Profile algorithms developed by the Keo

Target 696 Dec 26, 2022
A high performance and generic framework for distributed DNN training

BytePS BytePS is a high performance and general distributed training framework. It supports TensorFlow, Keras, PyTorch, and MXNet, and can run on eith

Bytedance Inc. 3.3k Dec 28, 2022
We have a dataset of user performances. The project is to develop a machine learning model that will predict the salaries of baseball players.

Salary-Prediction-with-Machine-Learning 1. Business Problem Can a machine learning project be implemented to estimate the salaries of baseball players

Ayşe Nur Türkaslan 9 Oct 14, 2022
ml4ir: Machine Learning for Information Retrieval

ml4ir: Machine Learning for Information Retrieval | changelog Quickstart → ml4ir Read the Docs | ml4ir pypi | python ReadMe ml4ir is an open source li

Salesforce 77 Jan 06, 2023
[DEPRECATED] Tensorflow wrapper for DataFrames on Apache Spark

TensorFrames (Deprecated) Note: TensorFrames is deprecated. You can use pandas UDF instead. Experimental TensorFlow binding for Scala and Apache Spark

Databricks 757 Dec 31, 2022
The Simpsons and Machine Learning: What makes an Episode Great?

The Simpsons and Machine Learning: What makes an Episode Great? Check out my Medium article on this! PROBLEM: The Simpsons has had a decline in qualit

1 Nov 02, 2021
Python module for data science and machine learning users.

dsnk-distributions package dsnk distribution is a Python module for data science and machine learning that was created with the goal of reducing calcu

Emmanuel ASIFIWE 1 Nov 23, 2021
MICOM is a Python package for metabolic modeling of microbial communities

Welcome MICOM is a Python package for metabolic modeling of microbial communities currently developed in the Gibbons Lab at the Institute for Systems

57 Dec 21, 2022
A Streamlit demo to interactively visualize Uber pickups in New York City

Streamlit Demo: Uber Pickups in New York City A Streamlit demo written in pure Python to interactively visualize Uber pickups in New York City. View t

Streamlit 230 Dec 28, 2022
Fast Fourier Transform-accelerated Interpolation-based t-SNE (FIt-SNE)

FFT-accelerated Interpolation-based t-SNE (FIt-SNE) Introduction t-Stochastic Neighborhood Embedding (t-SNE) is a highly successful method for dimensi

Kluger Lab 547 Dec 21, 2022
🤖 ⚡ scikit-learn tips

🤖 ⚡ scikit-learn tips New tips are posted on LinkedIn, Twitter, and Facebook. 👉 Sign up to receive 2 video tips by email every week! 👈 List of all

Kevin Markham 1.6k Jan 03, 2023
Backprop makes it simple to use, finetune, and deploy state-of-the-art ML models.

Backprop makes it simple to use, finetune, and deploy state-of-the-art ML models. Solve a variety of tasks with pre-trained models or finetune them in

Backprop 227 Dec 10, 2022
Distributed scikit-learn meta-estimators in PySpark

sk-dist: Distributed scikit-learn meta-estimators in PySpark What is it? sk-dist is a Python package for machine learning built on top of scikit-learn

Ibotta 282 Dec 09, 2022
A collection of interactive machine-learning experiments: 🏋️models training + 🎨models demo

🤖 Interactive Machine Learning experiments: 🏋️models training + 🎨models demo

Oleksii Trekhleb 1.4k Jan 06, 2023
Graphsignal is a machine learning model monitoring platform.

Graphsignal is a machine learning model monitoring platform. It helps ML engineers, MLOps teams and data scientists to quickly address issues with data and models as well as proactively analyze model

Graphsignal 143 Dec 05, 2022
Turning images into '9-pan' palettes using KMeans clustering from sklearn.

img2palette Turning images into '9-pan' palettes using KMeans clustering from sklearn. Requirements We require: Pillow, for opening and processing ima

Samuel Vidovich 2 Jan 01, 2022
Probabilistic time series modeling in Python

GluonTS - Probabilistic Time Series Modeling in Python GluonTS is a Python toolkit for probabilistic time series modeling, built around Apache MXNet (

Amazon Web Services - Labs 3.3k Jan 03, 2023
This repo implements a Topological SLAM: Deep Visual Odometry with Long Term Place Recognition (Loop Closure Detection)

This repo implements a topological SLAM system. Deep Visual Odometry (DF-VO) and Visual Place Recognition are combined to form the topological SLAM system.

Best of Australian Centre for Robotic Vision (ACRV) 32 Jun 23, 2022
A game theoretic approach to explain the output of any machine learning model.

SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of any machine learning model. It connects optimal credit allo

Scott Lundberg 18.2k Jan 02, 2023