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
Banpei is a Python package of the anomaly detection.

Banpei Banpei is a Python package of the anomaly detection. Anomaly detection is a technique used to identify unusual patterns that do not conform to

Hirofumi Tsuruta 282 Jan 03, 2023
scikit-learn: machine learning in Python

scikit-learn is a Python module for machine learning built on top of SciPy and is distributed under the 3-Clause BSD license. The project was started

neurodata 3 Dec 16, 2022
Examples and code for the Practical Machine Learning workshop series

Practical Machine Learning Workshop Series Practical Machine Learning for Quantitative Finance Post conference workshop at the WBS Spring Conference D

CompatibL 21 Jun 25, 2022
QuickAI is a Python library that makes it extremely easy to experiment with state-of-the-art Machine Learning models.

QuickAI is a Python library that makes it extremely easy to experiment with state-of-the-art Machine Learning models.

152 Jan 02, 2023
An AutoML survey focusing on practical systems.

This project is a community effort in constructing and maintaining an up-to-date beginner-friendly introduction to AutoML, focusing on practical systems. AutoML is a big field, and continues to grow

AutoGOAL 16 Aug 14, 2022
Predicting job salaries from ads - a Kaggle competition

Predicting job salaries from ads - a Kaggle competition

Zygmunt Zając 57 Oct 23, 2020
An implementation of Relaxed Linear Adversarial Concept Erasure (RLACE)

Background This repository contains an implementation of Relaxed Linear Adversarial Concept Erasure (RLACE). Given a dataset X of dense representation

Shauli Ravfogel 4 Apr 13, 2022
A repository of PyBullet utility functions for robotic motion planning, manipulation planning, and task and motion planning

pybullet-planning (previously ss-pybullet) A repository of PyBullet utility functions for robotic motion planning, manipulation planning, and task and

Caelan Garrett 260 Dec 27, 2022
Generate music from midi files using BPE and markov model

Generate music from midi files using BPE and markov model

Aditya Khadilkar 37 Oct 24, 2022
A repository to work on Machine Learning course. Select an algorithm to classify writer's gender, of Hebrew texts.

MachineLearning A repository to work on Machine Learning course. Select an algorithm to classify writer's gender, of Hebrew texts. Tested algorithms:

Haim Adrian 1 Feb 01, 2022
Open MLOps - A Production-focused Open-Source Machine Learning Framework

Open MLOps - A Production-focused Open-Source Machine Learning Framework Open MLOps is a set of open-source tools carefully chosen to ease user experi

Data Revenue 590 Dec 28, 2022
A toolbox to iNNvestigate neural networks' predictions!

iNNvestigate neural networks! Table of contents Introduction Installation Usage and Examples More documentation Contributing Releases Introduction In

Maximilian Alber 1.1k Jan 05, 2023
Predict the demand for electricity (R) - FRENCH

06.demand-electricity Predict the demand for electricity (R) - FRENCH Prédisez la demande en électricité Prérequis Pour effectuer ce projet, vous devr

1 Feb 13, 2022
Quantum Machine Learning

The Machine Learning package simply contains sample datasets at present. It has some classification algorithms such as QSVM and VQC (Variational Quantum Classifier), where this data can be used for e

Qiskit 364 Jan 08, 2023
All-in-one web-based development environment for machine learning

All-in-one web-based development environment for machine learning Getting Started • Features & Screenshots • Support • Report a Bug • FAQ • Known Issu

3 Feb 03, 2021
Simple, light-weight config handling through python data classes with to/from JSON serialization/deserialization.

Simple but maybe too simple config management through python data classes. We use it for machine learning.

Eren Gölge 67 Nov 29, 2022
Feature-engine is a Python library with multiple transformers to engineer and select features for use in machine learning models.

Feature-engine is a Python library with multiple transformers to engineer and select features for use in machine learning models. Feature-engine's transformers follow scikit-learn's functionality wit

Soledad Galli 33 Dec 27, 2022
Home repository for the Regularized Greedy Forest (RGF) library. It includes original implementation from the paper and multithreaded one written in C++, along with various language-specific wrappers.

Regularized Greedy Forest Regularized Greedy Forest (RGF) is a tree ensemble machine learning method described in this paper. RGF can deliver better r

RGF-team 363 Dec 14, 2022
A Python implementation of GRAIL, a generic framework to learn compact time series representations.

GRAIL A Python implementation of GRAIL, a generic framework to learn compact time series representations. Requirements Python 3.6+ numpy scipy tslearn

3 Nov 24, 2021
A visual dataflow programming language for sklearn

Persimmon What is it? Persimmon is a visual dataflow language for creating sklearn pipelines. It represents functions as blocks, inputs and outputs ar

Álvaro Bermejo 194 Jan 04, 2023