pdPINN

# Files

The code for the individual experiments is provided in the following directories:

- `FokkerPlacnk`
- `HeatEquation`
- `MassConservation`

Each experiment uses a different conda environment, which is provided in form of '.yml' files in the respective directories.

## Mass Conservation Experiments

### Setup

The environment information is given in `env.yml`. We propose to the package manager mamba for creating the environment with: `mamba env create -f env.yml`

Alternatively, conda should also work (by simply replacing `mamba` with `conda`), but it was only tested using mamba.

### Experiments

- `experiment_2d.py` Includes the code for the 2D mass conservation experiment, i.e. the projection to the xy-plane.
- `experiment_3d.py` Includes the code for the 3D mass conservation experiment.

Via command-line arguments the settings of the training procedure can be set for each experiment. E.g.: `python experiment_3d.py --n-samples 2048 --sampling-method mh_pdpinn --pde-weight 400`

Note, that `--sampling-method mh_pdpinn` refers to the proposed pdPINN, `--sampling-method uniform` to the uniform sampler. Adaptive Refinement can be included via the flags `--rar` and `--ot-rar`.

### Data

- `create_data.py` simulates the particles and creates the necessary data for all the experiments. Note that this may require a lot of RAM. This is NOT required to run, as the used data is already made available within the `data/` folder.
- `pdPINN/util/data_gen.py` and `pdPINN/util/vecfield_util.py` contain the details of the data generation.

### Implementation

- `pdPINN/model/` contains the implementations of the PINN, including the architecture.
- The specific models for the 2d and 3d experiment are in
  - `pdPINN/model/siren_2d.py`
  - `pdPINN/model/siren_3d.py`.
- The Metropolis Hastings implementation is in `lib/model/sampler.py`
- The SIREN specific implementations (i.e. intializations and custom layers) can be found in `lib/model/modules`

### Videos

Here we can see a comparison between MH-pdPINN and OT-RAR for 2000 collocation points in the 3D experiment. The noteworthy difference is the vanishing and reappearing of density, which is more pronounced in the first two columns.

More videos can be found in the `Videos/` directory.

Experiment 3D Baseline | Experiment 3D, OT-RAR, ~2000 samples | Experiment 3D, MH-pdPINN, ~2000 samples | Groundtruth
--- | --- | --- | ---