A simulation of wake behind cylinder. dimensionality reduction by variational auto encoder
This is a simple simulation of wake behind a cylinder.
The simulation is done using Lattice Boltzmann Method. ( see cylinder.cpp
)
The simulation is done for five different Reynolds numbers(
The simulation data is then used to train an variational auto encoder to reduce the dimensionality of the data to 32-sized latent space (vae.py
).
This took about 10 minutes on single RTX 3090 GPU.
We then defined a neural network to predict time integral step()
function on the latent space.
Neural network takes 32-sized latent vector z and Reynolds number stepper.py
)
We will see that the neural network is able to predict the next latent vector with untrained Reynolds number.
- Test LSTM for latent stepper - ( first 10 steps must be calculated by real numeric simulation )
- [] Test Transformer for latent stepper
$ mkdir build
cmake ..
make
./CylinderLBM
This will create re5.dat
, re40.dat
, re60.dat
, re100.dat
and re200.dat
in current directory.
python ../vae.py
This will train VAE and save the model vae.pt
in current directory.
python ../stepper.py
This will train LatentStepper and save the model stepper.pt
in current directory.
python ../plotter.py ReynoldsNumber
This performs the simulation on latent space and saves the result in plots$Re/
directory.
sh ../png2gif.sh ReynoldsNumber
sh ../png2mp4.sh ReynoldsNumber
Snapshot of compressed result of
For each iteration, the
$ \sum_{x=0}^{512} \sum_{y=0}^{256} |predicted(x,y) - simulated(x,y)|^2 / (256*512) $
and the
$ \max_{pixel\in image} |predicted(pixel) - simulated(pixel)| $
result/out20.gif
result/out150.gif