All Projects → loliverhennigh → Phy Net

loliverhennigh / Phy Net

Licence: apache-2.0
compressing physics with neural networks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Phy Net

Splishsplash
SPlisHSPlasH is an open-source library for the physically-based simulation of fluids.
Stars: ✭ 735 (+452.63%)
Mutual labels:  fluid-simulation, simulation
Gridfluidsim3d
A PIC/FLIP fluid simulation based on the methods found in Robert Bridson's "Fluid Simulation for Computer Graphics"
Stars: ✭ 653 (+390.98%)
Mutual labels:  fluid-simulation, simulation
Gl Water2d
2D liquid simulation in WebGL
Stars: ✭ 260 (+95.49%)
Mutual labels:  fluid-simulation, simulation
Blender Flip Fluids
FLIP Fluids is a powerful liquid simulation plugin that gives you the ability to create high quality fluid effects all within Blender, the free and open source 3D creation suite.
Stars: ✭ 983 (+639.1%)
Mutual labels:  fluid-simulation, simulation
Cellularforms
An implementation of Andy Lomas' Cellular Forms.
Stars: ✭ 124 (-6.77%)
Mutual labels:  simulation
Aws Robomaker Sample Application Deepracer
Use AWS RoboMaker and demonstrate running a simulation which trains a reinforcement learning (RL) model to drive a car around a track
Stars: ✭ 105 (-21.05%)
Mutual labels:  simulation
Particles
A particle simulation engine based on a port of d3-force
Stars: ✭ 104 (-21.8%)
Mutual labels:  simulation
Fnss
Fast creation and configuration of topologies, traffic matrices and event schedules for network experiments
Stars: ✭ 102 (-23.31%)
Mutual labels:  simulation
Cam2bev
TensorFlow Implementation for Computing a Semantically Segmented Bird's Eye View (BEV) Image Given the Images of Multiple Vehicle-Mounted Cameras.
Stars: ✭ 129 (-3.01%)
Mutual labels:  simulation
Splatter
Simple simulation of single-cell RNA sequencing data
Stars: ✭ 128 (-3.76%)
Mutual labels:  simulation
Molecular Design Toolkit
Notebook-integrated tools for molecular simulation and visualization
Stars: ✭ 123 (-7.52%)
Mutual labels:  simulation
Xut.js
批量生成应用平台 http://t.cn/RazBbL0
Stars: ✭ 105 (-21.05%)
Mutual labels:  simulation
Dls Schematics
Schematics for DLS - The Digital Logic Simulator game http://makingartstudios.itch.io/dls
Stars: ✭ 124 (-6.77%)
Mutual labels:  simulation
Barnes Hut Rs
Implementation of the Barnes Hut Algorithm in rust with visualization and web-deployment using WASM
Stars: ✭ 105 (-21.05%)
Mutual labels:  simulation
Df Style Worldgen
Fantasy Worlds Procedurally Generated
Stars: ✭ 130 (-2.26%)
Mutual labels:  simulation
Msprime
Simulate genealogical trees and genomic sequence data using population genetic models
Stars: ✭ 103 (-22.56%)
Mutual labels:  simulation
Covasim
COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
Stars: ✭ 122 (-8.27%)
Mutual labels:  simulation
Hive
Ethereum end-to-end test harness
Stars: ✭ 127 (-4.51%)
Mutual labels:  simulation
Financial life
A framework for analysing financial products in personalized contexts
Stars: ✭ 116 (-12.78%)
Mutual labels:  simulation
Livehd
Live Hardware Development (LiveHD), a productive infrastructure for Synthesis and Simulation
Stars: ✭ 110 (-17.29%)
Mutual labels:  simulation

Lat-Net: Compressing Lattice Boltzmann Flow Simulations using Deep Neural Networks

Introduction

This repository contains the code to reproduce results seen in Lat-Net: Compressing Lattice Boltzmann Flow Simulations using Deep Neural Networks. The premise is to compress Lattice Boltzmann Fluid Flow simulations onto small computationally efficient neural networks that can be evaluated.

Related Work

Similar works can be found in "Accelerating Eulerian Fluid Simulation With Convolutional Networks" and "Convolutional Neural Networks for steady Flow Approximation".

Network Details

alt tag

The network learns a encoding, compression, and decoding piece. The encoding piece learns to compress the state of the physics simulation. The compression piece learns the dynamics of the simulation on this compressed piece. The decoding piece learns to decode the compressed representation. The network is kept all convolutional allowing it to be trained and evaluated on any size simulation. This means that once the model is trained on a small simulation (say 256 by 256 grid) it can then attempt to simulate the dynamics of a larger simulation (say 1024 by 1024 grid). We show that the model can still produce accurate results even with larger simulations then seen during training.

Lattice Boltzmann Fluid Flow

Using the Mechsys library we generated 2D and 3D fluid simulations to train our model. For the 2D case we simulate a variety of random objects interacting with a steady flow and periodic boundary conditions. The simulation is a 256 by 256 grid. Using the trained model we evaluate on grid size 256 by 256, 512 by 512, and 1024 by 1024. Here are examples of generated simulations.

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

We can look at various properties of the true versus generated simulations such as mean squared error, divergence of the velocity vector field, drag, and flux. Averaging over several test simulations we see the that the generated simulation produces realistic values. The following graphs show this for 256, 512, and 1024 sized simulations.

alt tag alt tag alt tag

A few more snap shots of simulations

alt tag alt tag alt tag

Now we can apply it to other datasets. Here is a simulation around a car cross section. This demonstrates that our method generalizes to vastly different geometries.

alt tag IMAGE ALT TEXT HERE

Here are some 3D simulations.

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

Here are the plots for the 3D simulations.

alt tag alt tag alt tag alt tag

Lattice Boltzmann Electromagnetic Waves

Well the Lattice Boltzmann method is actually a general partial differential equation solver (of a particular form) so why stop at fluid flow! Here are some fun electromagnetic simulations that the model learns. These simulations are of a wave hitting randomly placed objects with different dielectric constants. You can see fun effects such as reflection and refraction when the wave interacts with the surface.

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

Here are the plots for EM simulations

alt tag alt tag alt tag alt tag

How to run

Running the 2d simulations requires around 100 Gb of hard drive memory, a good gpu (currently using GTX 1080s), and 1 and a half days. The 3d simulations can take substantially longer.

Generating Data

The test and train sets are generated using the Mechsys library. Follow the installation guild found here. Once the directory is unpacked run ccmake . followed by c. Then scroll to the flag that says A_USE_OCL and hit enter to raise the flag. Press c again to configure followed by g to generate (I found ccmake to be confusing at first). Quit the prompt and run make. Now copy the contents of Phy-Net/systems/mechsys_fluid_flow to the directory mechsys/tflbm as well as replace mechsys/lib/flbm/Domain.h with the one found in this directory. Now enter mechsys/tflbm and run make followed by

./generate_data.

This will generate the required train and test set for the 2D simulations and save them to /data/ (this can be changed in the run_bunch_2d script. 3D simulation is commented out for now. Generating the 2D simulation data will require about 12 hours.

Generating the data to train on is by far the most complicated piece of this work. It requires several external packages and considerable memory. I recently wrote a library to generate Lattice Boltzmann simulations entirely in Tensorflow here. In the future I would like to integrate this library with the train code allowing the data generation to be streamlined.

Train Model

To train the model enter the Phy-Net/train directory and run

python compress_train.py

This will first generate tfrecords for the generated training data and then begin training. Multi GPU training is supported with the flag --nr_gpu=n for n gpus. The important flags for training and model configurations are

  • --nr_residual=2 Number of residual blocks in each downsample chunk of the encoder and decoder
  • --nr_downsamples=4 Number of downsamples in the encoder and decoder
  • --filter_size=8 Number of filters for the first encoder layer. The filters double after each downsample.
  • --nr_residual_compression=3 Number of residual blocks in compression piece.
  • --filter_size_compression=64 filter size of residual blocks in compression piece.
  • --unroll_length=5 Number of steps in the future the network is unrolled.

All flags and their uses can be found in Phy-Net/model/ring_net.py.

Test Model

There are several different tests that can be run in the test directory. For the 2D simulations, running these scripts will generate the figures and videos above.

  • 2d_error_test.txt Generates the error plots seen above
  • 2d_image_test.txt Generates the images seen above
  • 2d_video_test.txt Generates the videos seen above

Contact

For any questions regarding the project please email me at [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].