Skip to content

Commit

Permalink
Docs DLWP and RNN Models (#80)
Browse files Browse the repository at this point in the history
* remove old scripts and add sample new ones

* Create README.md

* Update README.md

* Update README.md

* Create README.md for 2D RNN example

* Create README.md for 3D rnn example

* Add files via upload

* move the file

* lint

* update CHANGELOG
  • Loading branch information
ktangsali authored Aug 7, 2023
1 parent ae625dd commit 34e320c
Show file tree
Hide file tree
Showing 14 changed files with 325 additions and 657 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a CHANGELOG.md
- Ahmed body recipe
- Documentation for SFNO, GraphCast, vortex shedding, and Ahmed body
- Documentation for DLWP, and RNN examples

### Changed

- Updated the SFNO example
- Changed the default SFNO configs
- Header test to ignore .gitignore items
- Sample download scripts in the DLWP example

### Deprecated

Expand Down
Binary file added docs/img/gray_scott_predictions_blog_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions examples/cfd/gray_scott_rnn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# RNN for transient 3D Gray Scott system

This example uses recurrent neural networks for spatio-temporal prediction of the
Gray-Scott reaction diffusion system. The example uses architecture that is inspired from
[Physics Informed RNN-DCT Networks for Time-Dependent Partial Differential Equations](https://arxiv.org/pdf/2202.12358.pdf)
paper.

## Problem overview

Time-series prediction is a key task in many domains.
The application of deep learning architectures—particularly RNNs, long short-term memory
networks (LSTMs), and similar networks has significantly enhanced the predictive capabilities.
These models are unique in their ability to capture temporal dependencies and learn complex
patterns over time, making them well suited for forecasting time varying relationships.
In physics-ML, these models are critical in predicting dynamic physical systems’ evolution,
enabling better simulations, understanding of complex natural phenomena, and aiding
in discoveries.

This problem involves predicting the next timesteps of a 3D Gray Scott system given the
initial condition.

## Dataset

This example relies on the Dataset used in [Transformers for modeling physical systems](https://www.sciencedirect.com/science/article/abs/pii/S0893608021004500)
paper which solves the Reaction-Diffusion system governed by Gray-Scott model on a 3D grid.
The different samples are generated by using different initial conditions for the simulation.

## Model overview and architecture

The model uses Convolutional GRU layers for the RNN propagation and use a ResNet type
architecture for spatial encoding. This example uses the one-to-many variant of the RNN
model in Modulus.

![Comparison between the 3D RNN model prediction and the
ground truth](../../../docs/img/gray_scott_predictions_blog_2.gif)

## Getting Started

The example script contains code to download and do any pre-processing for the dataset.

To get started, simply run

```bash
python gray_scott_rnn.py
```

## References

- [Physics Informed RNN-DCT Networks for Time-Dependent Partial Differential Equations](https://arxiv.org/pdf/2202.12358.pdf)
- [Transformers for modeling physical systems](https://www.sciencedirect.com/science/article/abs/pii/S0893608021004500)
62 changes: 62 additions & 0 deletions examples/cfd/navier_stokes_rnn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# RNN for transient 2D Navier Stokes flow

This example uses recurrent neural networks for spatio-temporal prediction of
the Navier Stokes flow. The example uses architecture that is inspired from
[Physics Informed RNN-DCT Networks for Time-Dependent Partial Differential Equations](https://arxiv.org/pdf/2202.12358.pdf)
paper.

## Problem overview

Time-series prediction is a key task in many domains.
The application of deep learning architectures—particularly RNNs, long short-term memory
networks (LSTMs), and similar networks has significantly enhanced the predictive
capabilities.
These models are unique in their ability to capture temporal dependencies and learn complex
patterns over time, making them well suited for forecasting time varying relationships.
In physics-ML, these models are critical in predicting dynamic physical systems’ evolution,
enabling better simulations, understanding of complex natural phenomena, and aiding
in discoveries.

This problem involves predicting the next timesteps of a 2D Navier Stokes flow given input
of the initial condition or multiple input timesteps.

## Dataset

This example relies on the Dataset used in [Fourier Neural Operator paper](https://arxiv.org/pdf/2010.08895.pdf)
which solves the Navier Stokes equations in the vorticity form on a unit torus.
The different samples are generated by using different initial conditions for the simulation
The example uses 1000 training samples and 10 test samples.

## Model overview and architecture

The model uses Convolutional GRU layers for the RNN propagation and use a ResNet type
architecture for spatial encoding. The model has two variants- one in which the
subsequent predictions can be generated using only a single input time step (one-to-many)
and other where multiple input time-steps are used to produce multiple output time-steps
(many-to-many/seq-to-seq).

## Getting Started

The example script contains code to download and do any pre-processing for the dataset.
To download the dataset, `gdown` package is required, which can be installed using

```bash
pip install gdown
```

To get started, simply run

```bash
python navier_stokes_rnn.py
```

To run the seq2seq variant of the example, simply run

```bash
python navier_stokes_rnn.py model_type=seq2seq
```

## References

- [Physics Informed RNN-DCT Networks for Time-Dependent Partial Differential Equations](https://arxiv.org/pdf/2202.12358.pdf)
- [Fourier Neural Operator for Parametric Partial Differential Equations](https://arxiv.org/pdf/2010.08895.pdf)
60 changes: 60 additions & 0 deletions examples/weather/dlwp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Deep Learning Weather Prediction (DLWP) model for weather forecasting

This example is an implementation of the
[DLWP Cubed-sphere](https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2021MS002502)
model. The DLWP model can be used to predict the state of the atmosphere given a previous
atmospheric state. You can infer a 320-member ensemble set of six-week forecasts at 1.4°
resolution within a couple of minutes, demonstrating the potential of AI in developing
near real-time digital twins for weather prediction

## Problem overview

The goal is to train an AI model that can emulate the state of the atmosphere and predict
global weather over a certain time span. The Deep Learning Weather Prediction (DLWP) model
uses deep CNNs for globally gridded weather prediction. DLWP CNNs directly map u(t) to
its future state u(t+Δt) by learning from historical observations of the weather,
with Δt set to 6 hr

## Dataset

The model is trained on 7-channel subset of ERA5 Data that is mapped onto a cubed sphere
grid with a resolution of 64x64 grid cells.
The model uses years 1980-2015 for training, 2016-2017 for validation
and 2018 for out of sample testing. Some sample scripts for downloading the data and processing
it are provided in the `data_curation` directory. A larger subset of dataset is hosted
at the National Energy Research Scientific Computing Center (NERSC). For convenience
[it is available to all via Globus](https://app.globus.org/file-manager?origin_id=945b3c9e-0f8c-11ed-8daf-9f359c660fbd&origin_path=%2F~%2Fdata%2F).
You will need a Globus account and will need to be logged in to your account in order
to access the data. You may also need the [Globus Connect](https://www.globus.org/globus-connect)
to transfer data.

## Model overview and architecture

DLWP uses convolutional neural networks (CNNs) on a cubed sphere grid to produce global forecasts.
The latest DLWP model leverages a U-Net architecture with skip connections to capture multi-scale
processes.The model architecture is described in the following papers

[Sub-Seasonal Forecasting With a Large Ensemble of Deep-Learning Weather Prediction Models](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2021MS002502)

[Improving Data-Driven Global Weather Prediction Using Deep Convolutional Neural Networks on a Cubed Sphere](https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2020MS002109)

## Getting Started

To train the model, run

```bash
python train_dlwp.py
```

Progress can be monitored using MLFlow. Open a new terminal and navigate to the training
directory, then run:

```bash
mlflow ui -p 2458
```

View progress in a browser at <http://127.0.0.1:2458>

## References

[Sub-Seasonal Forecasting With a Large Ensemble of Deep-Learning Weather Prediction Models](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2021MS002502)
8 changes: 2 additions & 6 deletions examples/weather/dlwp/data_curation/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<!-- markdownlint-disable MD043 -->
# Order of running the scripts

1. Run `data_download_pbss.py`.
2. Run `remapping.py`.
3. Run `concat.py`.
4. Run `netcdf_to_h5py.py`.
5. Run `get_mean_std.py`
1. Run `data_download_simple.py`.
2. Run `post_processing.py`.
60 changes: 0 additions & 60 deletions examples/weather/dlwp/data_curation/concat.py

This file was deleted.

Loading

0 comments on commit 34e320c

Please sign in to comment.