Skip to main content

A differentiable neural-network solver for data assimilation of ice shelves written in JAX

Project description

DIFFICE_jax

A user-friendly DIFFerentiable neural-network solver for data assimilation of ICE shelves written in JAX.

Introduction

DIFFICE_jax is a Python package that solves the depth-integrated Stokes equation for ice shelves, and can be adopted for ice sheets by modifying the partial differential equations (PDE) in the neural network loss function. It uses PDEs to interpolate descretized remote-sensing data into meshless and differentible functions, and infer ice shelves' viscosity structure via PDE-constrained optimization and automatic differentiation (AD). The algorithm is based on physics-informed neural networks (PINNs) [@Raissi2019] and implemented in JAX [@jax2018github]. The DIFFICE_jax package involves several advanced features in addition to vanilla PINNs algorithms, including collocation points resampling, non-dimensionalization of the data adnd equations, extended PINN (see figure below and XPINN documentation), viscosity exponential scaling function, which are essential for accurate inversion. The package is designed to be user-friendly and accessible for beginners. The Github respository also provides tutorial examples for users at different levels to help master the method.

results

Installation

Instructions are for installation into a virtual Python Environment. Please ensure that Python 3.x has been installed in your local machine or the remote compute machine, such as HPC cluster or Google Cloud Platform (GCP). We recommend the Python of version later than 3.9.0.

  1. Create a virtual environment named DIFFICE_jax
python -m venv DIFFICE_jax
  1. Activate the Virtual Environment (for MacOS/linux)
source DIFFICE_jax/bin/activate
  1. Install JAX. The package only works for JAX version 0.4.23 or later.
# Install JAX on CPU (not recommended, too slow)
pip install jax[cpu]==0.4.23 -f https://storage.googleapis.com/jax-releases/jax_releases.html

# Install JAX on GPU (recommended if GPUs are available)
pip install jax==0.4.23 jaxlib==0.4.23+cuda12.cudnn89 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
  1. Install other Python Dependencies required for the package
# required for Adam optimizer
pip install optax

# required for L-BFGS optimizer
pip install tfp-nightly

# for output ploting
pip install matplotlib
  1. Clone the DIFFICE_jax package locally from GitHub
git clone https://github.com/YaoGroup/DIFFICE_jax.git
  1. Run the example codes
# tutorial example using synthetic data
python3 DIFFICE_jax/tutorial/train_syndata.py

# example using real data of ice shelves
python3 DIFFICE_jax/examples/train_pinns_iso.py

Google Colab

Apart from the Python scripts to run locally, we also provide Colab Notebooks for both the tutorial example and real ice-shelf examples. They are provided in the tutorial and examples folders for a synthetic ice shelf and real ice shelves, respectively.

Getting start with a Tutorial

We highly recommend the user who has no previous experience in either PINNs or inverse problems in Glaciology to get familar with the software by reading the document and playing with the synthetic example prepared in the tutorial folder. The tutorial example allow users to generate the synthetic data of velocity and thickness of an ice-shelf flow in a rectangular domain with any given viscosity profile. Users can then use the PINNs code prepared in the folder to infer the given viscosity from the synthetic code. We provide a Colab Notebook that allows users to compare the given viscosity with the PINN inferred viscosity to validate the accuracy of PINNs on inverse problem.

Contributors

This package is written by Yongji Wang and maintained by Yongji Wang (yongjiw@stanford.edu) and Ching-Yao Lai (cyaolai@stanford.edu). If you have questions about this code and documentation, or are interested in contributing the development of the DIFFICE_jax package, feel free to get in touch.

License

DIFFICE_jax is an open-source software. All code within the project is licensed under the MIT License. For more details, please refer to the LICENSE file.

Citation

BibTex:

@article{wang2022discovering,
  title={Discovering the rheology of Antarctic Ice Shelves via physics-informed deep learning},
  author={Wang, Yongji and Lai, Ching-Yao and Cowen-Breen, Charlie},
  year={2022},
  doi = {https://doi.org/10.21203/rs.3.rs-2135795/v1},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffice_jax-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

DIFFICE_jax-0.0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file diffice_jax-0.0.2.tar.gz.

File metadata

  • Download URL: diffice_jax-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for diffice_jax-0.0.2.tar.gz
Algorithm Hash digest
SHA256 99feffc44fde7d3378bb1e387631b5f72538d0a60e2b7c0beda172ad159dd447
MD5 f97c5f5e7518b08c7914ded4cd870f42
BLAKE2b-256 00aaab579cd1e7b71d2227fab775cd7c8a63ee68399bf41fe363c77e85d66888

See more details on using hashes here.

File details

Details for the file DIFFICE_jax-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: DIFFICE_jax-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for DIFFICE_jax-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31b778cedbb8adb6fcbb609b50a2b8509856a4f3b6a09cdcbfccfa9dfd0035c6
MD5 eb4afdd63a2bc7c57e6b838ee5399509
BLAKE2b-256 49a0854c9d3f823021fc72e00d6ee398546bbf9df23e84bef2cb9159a9d48a3f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page