Skip to content

Controlling fluids in a reduced-dimensional simulation.

Notifications You must be signed in to change notification settings

bobarna/eigenfluid-control

Repository files navigation

Controlling Laplacian Eigenfluids

Scientific Students' Association Report 2022

Author: Barnabás Börcsök

Advisor: dr. László Szécsi

  • thesis.pdf
    • Automatically deployed from docs folder
  • For an informal overview of some basic concepts, see this blog post.

This repository contains the accompanying code for our Scientific Students' Assocation project on Controlling Laplacian Eigenfluids.

In our work, we investigate the use of Laplacian Eigenfunctions to model and control fluid flow. We make use of an explicit description of our simulation domain to derive gradients of the physical simulation, enabling neural network agents to learn to control the physical process to achieve desired outcomes.

Running the Code

Dependencies

All of these can be installed via pip on Python 3.6 and above:

pip install phiflow==2.2.2 dash torch torchvision tensorflow
pip install notebook

Running the Notebooks

Locally

jupyter notebook

In Google Colab

Code Layout

  • docs/: LaTeX source of the thesis
  • src/: Python/ΦFlow source code, imported in the notebooks
  • *.ipynb: interactive notebook files
  • original-code/: (see below)
  • taichi/: (see below)

Taichi Version

The taichi folder contains a minimal taichi implementation of visualizing the first 100 basis fields.

Install Taichi

pip install taichi==1.2.1

Run the Taichi Version

python taichi/main.py
  • Viscosity
    • Y: turn ON
    • T: turn OFF
  • Step basis fields
    • J: Next basis field (increment)
    • K: Previous basis field (decrement)
  • V: Visualize (plot) current velocity field with matplotlib
    • the title displays the current base coefficient vector (doesn't display properly if many basis fields are used)
  • R: Random basis coefficients

Hop into taichi/main.py, to change the number of basis fields. (Look for N=....)

Original Code by de Witt et al

The original-code folder contains the original implementation of Fluid Dynamics using Laplacian Eigenfunctions by Tyler de Witt, Christian Lessig, and Eugene Fiume, downloaded from the project's website: http://www.dgp.toronto.edu/~tyler/fluids/. In the early phases of the project, it was used to print values for checking the correctness of our implementation.

cd original-code
javac LE.java #compile 
java LE #run 
java LE > output #print to an output file
python visu.py #plot the velocity field with matplotlib for comparison

(For a (more involved) C++ implementation, check out the source code for the paper Scalable Laplacian Eigenfluids.)