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
Python 3.6+ toolbox for submitting jobs to Slurm

Submit it! What is submitit? Submitit is a lightweight tool for submitting Python functions for computation within a Slurm cluster. It basically wraps

Facebook Incubator 768 Jan 03, 2023
Conducted ANOVA and Logistic regression analysis using matplot library to visualize the result.

Intro-to-Data-Science Conducted ANOVA and Logistic regression analysis. Project ANOVA The main aim of this project is to perform One-Way ANOVA analysi

Chris Yuan 1 Feb 06, 2022
Create large-scale ML-driven multiscale simulation ensembles to study the interactions

MuMMI RAS v0.1 Released: Nov 16, 2021 MuMMI RAS is the application component of the MuMMI framework developed to create large-scale ML-driven multisca

4 Feb 16, 2022
A Multipurpose Library for Synthetic Time Series Generation in Python

TimeSynth Multipurpose Library for Synthetic Time Series Please cite as: J. R. Maat, A. Malali, and P. Protopapas, “TimeSynth: A Multipurpose Library

278 Dec 26, 2022
Python package for concise, transparent, and accurate predictive modeling

Python package for concise, transparent, and accurate predictive modeling. All sklearn-compatible and easy to use. 📚 docs • 📖 demo notebooks Modern

Chandan Singh 983 Jan 01, 2023
Scikit-Garden or skgarden is a garden for Scikit-Learn compatible decision trees and forests.

Scikit-Garden or skgarden (pronounced as skarden) is a garden for Scikit-Learn compatible decision trees and forests.

260 Dec 21, 2022
Kubeflow is a machine learning (ML) toolkit that is dedicated to making deployments of ML workflows on Kubernetes simple, portable, and scalable.

SDK: Overview of the Kubeflow pipelines service Kubeflow is a machine learning (ML) toolkit that is dedicated to making deployments of ML workflows on

Kubeflow 3.1k Jan 06, 2023
A library of sklearn compatible categorical variable encoders

Categorical Encoding Methods A set of scikit-learn-style transformers for encoding categorical variables into numeric by means of different techniques

2.1k Jan 07, 2023
pure-predict: Machine learning prediction in pure Python

pure-predict speeds up and slims down machine learning prediction applications. It is a foundational tool for serverless inference or small batch prediction with popular machine learning frameworks l

Ibotta 84 Dec 29, 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
Python/Sage Tool for deriving Scattering Matrices for WDF R-Adaptors

R-Solver A Python tools for deriving R-Type adaptors for Wave Digital Filters. This code is not quite production-ready. If you are interested in contr

8 Sep 19, 2022
Arquivos do curso online sobre a estatística voltada para ciência de dados e aprendizado de máquina.

Estatistica para Ciência de Dados e Machine Learning Arquivos do curso online sobre a estatística voltada para ciência de dados e aprendizado de máqui

Renan Barbosa 1 Jan 10, 2022
Machine Learning Algorithms

Machine-Learning-Algorithms In this project, the dataset was created through a survey opened on Google forms. The purpose of the form is to find the p

Göktuğ Ayar 3 Aug 10, 2022
Open source time series library for Python

PyFlux PyFlux is an open source time series library for Python. The library has a good array of modern time series models, as well as a flexible array

Ross Taylor 2k Jan 02, 2023
Practical Time-Series Analysis, published by Packt

Practical Time-Series Analysis This is the code repository for Practical Time-Series Analysis, published by Packt. It contains all the supporting proj

Packt 325 Dec 23, 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
AI and Machine Learning with Kubeflow, Amazon EKS, and SageMaker

Data Science on AWS - O'Reilly Book Get the book on Amazon.com Book Outline Quick Start Workshop (4-hours) In this quick start hands-on workshop, you

Data Science on AWS 2.8k Jan 03, 2023
GRaNDPapA: Generator of Rad Names from Decent Paper Acronyms

Generator of Rad Names from Decent Paper Acronyms

264 Nov 08, 2022
🌊 River is a Python library for online machine learning.

River is a Python library for online machine learning. It is the result of a merger between creme and scikit-multiflow. River's ambition is to be the go-to library for doing machine learning on strea

OnlineML 4k Jan 03, 2023
MLBox is a powerful Automated Machine Learning python library.

MLBox is a powerful Automated Machine Learning python library. It provides the following features: Fast reading and distributed data preprocessing/cle

Axel 1.4k Jan 06, 2023