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
AutoTabular automates machine learning tasks enabling you to easily achieve strong predictive performance in your applications.

AutoTabular AutoTabular automates machine learning tasks enabling you to easily achieve strong predictive performance in your applications. With just

wenqi 2 Jun 26, 2022
Python bindings for MPI

MPI for Python Overview Welcome to MPI for Python. This package provides Python bindings for the Message Passing Interface (MPI) standard. It is imple

MPI for Python 604 Dec 29, 2022
CrayLabs and user contibuted examples of using SmartSim for various simulation and machine learning applications.

SmartSim Example Zoo This repository contains CrayLabs and user contibuted examples of using SmartSim for various simulation and machine learning appl

Cray Labs 14 Mar 30, 2022
pandas, scikit-learn, xgboost and seaborn integration

pandas, scikit-learn and xgboost integration.

299 Dec 30, 2022
Accelerating model creation and evaluation.

EmeraldML A machine learning library for streamlining the process of (1) cleaning and splitting data, (2) training, optimizing, and testing various mo

Yusuf 0 Dec 06, 2021
Reproducibility and Replicability of Web Measurement Studies

Reproducibility and Replicability of Web Measurement Studies This repository holds additional material to the paper "Reproducibility and Replicability

6 Dec 31, 2022
Forecasting prices using Facebook/Meta's Prophet model

CryptoForecasting using Machine and Deep learning (Part 1) CryptoForecasting using Machine Learning The main aspect of predicting the stock-related da

1 Nov 27, 2021
Production Grade Machine Learning Service

This project is made to help you scale from a basic Machine Learning project for research purposes to a production grade Machine Learning web service

Abdullah Zaiter 10 Apr 04, 2022
使用数学和计算机知识投机倒把

偷鸡不成项目集锦 坦率地讲,涉及金融市场的好策略如果公开,必然导致使用的人多,最后策略变差。所以这个仓库只收集我目前失败了的案例。 加密货币组合套利 中国体育彩票预测 我赚不上钱的项目,也许可以帮助更有能力的人去赚钱。

Roy 28 Dec 29, 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
ETNA – time series forecasting framework

ETNA Time Series Library Predict your time series the easiest way Homepage | Documentation | Tutorials | Contribution Guide | Release Notes ETNA is an

Tinkoff.AI 675 Jan 08, 2023
In this Repo a simple Sklearn Model will be trained and pushed to MLFlow

SKlearn_to_MLFLow In this Repo a simple Sklearn Model will be trained and pushed to MLFlow Install This Repo is based on poetry python3 -m venv .venv

1 Dec 13, 2021
Climin is a Python package for optimization, heavily biased to machine learning scenarios

climin climin is a Python package for optimization, heavily biased to machine learning scenarios distributed under the BSD 3-clause license. It works

Biomimetic Robotics and Machine Learning at Technische Universität München 177 Sep 02, 2022
Learning --> Numpy January 2022 - winter'22

Numerical-Python Numpy NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along

Shahzaneer Ahmed 0 Mar 12, 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
scikit-fem is a lightweight Python 3.7+ library for performing finite element assembly.

scikit-fem is a lightweight Python 3.7+ library for performing finite element assembly. Its main purpose is the transformation of bilinear forms into sparse matrices and linear forms into vectors.

Tom Gustafsson 297 Dec 13, 2022
2D fluid simulation implementation of Jos Stam paper on real-time fuild dynamics, including some suggested extensions.

Fluid Simulation Usage Download this repo and store it in your computer. Open a terminal and go to the root directory of this folder. Make sure you ha

Mariana Ávalos Arce 5 Dec 02, 2022
ELI5 is a Python package which helps to debug machine learning classifiers and explain their predictions

A library for debugging/inspecting machine learning classifiers and explaining their predictions

154 Dec 17, 2022
ETNA is an easy-to-use time series forecasting framework.

ETNA is an easy-to-use time series forecasting framework. It includes built in toolkits for time series preprocessing, feature generation, a variety of predictive models with unified interface - from

Tinkoff.AI 674 Jan 07, 2023