Skip to main content

Snapy

Compressible Finite Volume Solver for Atmospheric Dynamics, Chemistry and Thermodynamics

Snapy is the dynamic core for simulating atmospheric and planetary dynamics using PyTorch tensors and GPU acceleration.

PyPI version License: MIT

Features

  • GPU-Accelerated: Built on PyTorch for efficient GPU computation
  • Flexible Interfaces: Both Python and C++ APIs available
  • Compressible Flow: Finite volume solver for atmospheric dynamics
  • Multi-platform: Support for Linux and macOS
  • NetCDF Output: Standard output format for scientific data

Installation

Quick Install (Python Interface)

The easiest way to get started is to install via pip:

pip install snapy

This will install the Python interface with pre-built binaries for Python 3.9-3.13 on Linux (x86_64) and macOS (ARM64).

Parallel run

pd-run 6 ./test_exchange.release

list listening port

lsof -i:29500

kill listening port

pkill -9 XXXXX

Requirements:

  • Python 3.9 or higher
  • PyTorch 2.7.x
  • NumPy
  • kintera >= 1.1.5

Build from Source (Advanced)

Building from source is recommended only for advanced users who need to:

  • Modify the C++ core
  • Use custom PyTorch versions
  • Access the C++ interface directly
  • Develop new features

Prerequisites:

  • CMake 3.20+
  • C++17 compatible compiler
  • Autoconf, Automake, Libtool, and pkg-config on Linux (for fetched UCX)
  • PyTorch 2.7.x with C++ libraries
  • NetCDF C library
  • kintera >= 1.1.5

Build steps:

  1. Clone the repository:
git clone https://github.com/chengcli/snapy.git
cd snapy
  1. Install dependencies:
pip install numpy kintera torch==2.7.1
  1. Install NetCDF:
    • Linux (Ubuntu/Debian):
      sudo apt-get install libnetcdf-dev
      
    • macOS:
      brew install netcdf
      

UCX support is provided by the Python package commux. Install snapy's Python dependencies in the active environment before configuring; use -DUCX=OFF only when building a Gloo-only configuration.

  1. Configure and build:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNETCDF=ON
cmake --build build --parallel 3
  1. Install the Python package:
pip install .

Examples

The examples/ directory contains several working examples:

Python Examples:

  • shock.py - Sod shock tube with internal boundary
  • straka.py - Straka cold bubble convection test
  • robert.py - Robert warm bubble convection test

C++ Examples:

  • shock.cpp - Sod shock tube (C++)
  • straka.cpp - Straka cold bubble (C++)

Run a Python example:

cd examples
python shock.py

Run a C++ example (after building):

cd build/examples
./shock

See examples/README for detailed documentation on the code structure and available examples.

Configuration

Simulations are configured using YAML files that specify:

  • Grid dimensions and domain size
  • Time integration settings (RK stages, CFL number)
  • Boundary conditions
  • Output settings (frequency, variables, format)
  • Equation of state and thermodynamics

Example configuration files (.yaml) are provided alongside the examples.

Development

Testing

Run tests after building:

cd build/tests
ctest --output-on-failure

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

snapy-2.10.5-cp313-cp313-manylinux_2_27_x86_64.whl (60.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

snapy-2.10.5-cp313-cp313-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.10.5-cp312-cp312-manylinux_2_27_x86_64.whl (60.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

snapy-2.10.5-cp312-cp312-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.10.5-cp311-cp311-manylinux_2_27_x86_64.whl (60.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

snapy-2.10.5-cp311-cp311-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.10.5-cp310-cp310-manylinux_2_27_x86_64.whl (60.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.10.5-cp310-cp310-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file snapy-2.10.5-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 484c99743005d18eb3fb2bfb547ada6c092eec9344be3d042820901d49bb57c2
MD5 3fdbebc2f78afefe512f93d1952caf5a
BLAKE2b-256 0c68b61b2c6886b8e35f1dc3c98a8f1d4f56ad2e986d378d312aa9c335e9d794

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8f3ed1274d66e80bc2c4cc8bfb244bb6648af45af6d4b5aa7bfcc60beebc857e
MD5 c08255ff71fd26cf872b512fa72955fe
BLAKE2b-256 01e0aec632d92a7df731f3d186b65b43a7a23dc751074ec2937a36bf420099be

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp312-cp312-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 8a41c7c24246a747fade0ce2fdfca9892c43a480214dce6082dc6411b68c90f0
MD5 2386b7bfeb081b725f141f0d06c700f1
BLAKE2b-256 0ffda1bff23d02219633b5937868a9b12af93a7c2af59400b2b745a1fc1fcafb

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 85d5a5cb7377271aae07961d793130542d80ad310a17e02b6bde49c7878dd0ec
MD5 e4acf50c903602779978ada60df33aac
BLAKE2b-256 6e8f9ca7df9c155149d5491d9a714a95dd0f5bedc99cd020879e3de1727ffae4

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp311-cp311-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 40066f7c9e3402869c90aef7ebdc616535c48707cc1a9e7d1bd348aa88a40eb7
MD5 e9dc681c3a22bf41c07f36b4a8f3294c
BLAKE2b-256 28088c9a2f0b2a5dc2a3c929260711b58fb0a2531fad02f2416501d0edf06c51

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f959922d83786ee9fc0f825577897d2940a2cc54c07d692f9502db4f0895333a
MD5 1bac2ec05b48fddef76e4a9d65341eb6
BLAKE2b-256 369bffddfd80359c9206da621aadfbc491f33037d249243cdd1c1e19d8cbb5ab

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp310-cp310-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 3a5532372891375ad43eeeaf36d76c6b8e3d199ce1fb2eab8ba3f939fe1d6fe2
MD5 f28197cf300621e726a0556884cde4e2
BLAKE2b-256 746d3a90c5c27289c8d61c0e7925df7ccf2d8736dcf4e31ea3bad498a0c57bb4

See more details on using hashes here.

File details

Details for the file snapy-2.10.5-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.5-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0ddf83ec7488dfb410f4284ffe3ba6d26800e2fb65399d7caa80732c1975a2e8
MD5 2f5ad66868a55f5a11025d6b18c0323a
BLAKE2b-256 887b931c52ba428f9fe6af102b006bf7b9438fdd1cdb3423df93e30721cb3b3e

See more details on using hashes here.

Supported by

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