PNAS, 2023, Vol. 120, e2206994120
Authors: R. Supekar, B. Song, A. Hastewell, G. P. T. Choi, A. Mietke, J. Dunkel
The three major steps in the learning framework are:
- Coarse-graining
- Spectral projection and smoothing
- PDE learning
The codes provided need to be run sequentially to execute the above steps. The details are provided below. The starting point is the particle data provided in data/quinke_particle_data_S2.mat
, which corresponds to the results presented in Fig. 4 of the manuscript.
-
Run
coarse_grain_data.m
through MATLAB. This takes in the particle data fromdata/quinke_particle_data_S2.mat
and saves the coarse-grained data atdata/coarse_grained_field(y,x,t).mat
. The generated imagedata/coarse_grained_frame.png
shows the coarse-graining result at a particular frame. -
With
Nx=100, Ny=50
(specified insidecoarse_grain_data.m
), the code should run for ~10 mins.
-
If you do not have Julia versions from 1.3 - 1.7, download it from: https://julialang.org/downloads/. Make sure the command
julia
works from the command line. -
Navigate to the project folder through the command line.
-
Saving spectral coefficients of the coarse-grained data:
- Run
julia save_representation.jl
. This should run for a few mins. - This will save the representations (spectral coefficients) in the files
data_representation_cheb_cheb_cheb_*.mat
for each field.
- Run
-
Saving smooth data and time-derivative after imposing cut-offs on the coefficients:
- Run
julia save_smooth_data.jl
. This should run for ~ 5 mins. - This will save the smooth fields as the file
data/_reconstruction_cheb_cheb_cheb_space*_time*.mat
.
- Run
We use Python >=3.6.
-
Navigate to the project folder through the command line.
-
Installing required packages:
Conda[Recommended]:
-
If you do not have anaconda, download it from here: https://www.anaconda.com/products/individual. After the installation, make sure the command works from your command line.
-
Create a new conda environment from the provided .yml file: run
conda env create --name pdel --file=environment.yml
-
Activate the environment with
conda activate pdel
.
OR
PIP:
- If you already have a Python3 installation that you would like to use, do
pip3 install -r requirements.txt
.
- Run
python3 learn_density_equation.py
. This should run for a few mins. - After the script runs, the folder
data/PDElearn/density_equation/
will have the learning results. - The file
pde_stability.txt
lists all the learned PDEs and the filespde_stability_*.txt
will have the individual PDEs.
- Do
python3 learn_velocity_equation.py
. This should run for a few mins. - After the script runs, the folder
data/PDElearn/velocity_equation/
would have the learning results. - The file
pde_stability.txt
lists all the learned PDEs and the filespde_stability_*.txt
will have the individual PDEs.