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.10.x
  • NumPy
  • kintera >= 2.6.3

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.10.x with C++ libraries
  • NetCDF C library
  • kintera >= 2.6.3

Build steps:

  1. Clone the repository:
git clone https://github.com/chengcli/snapy.git
cd snapy
  1. Install dependencies:
pip install numpy "kintera>=2.6.3" torch==2.10.0
  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.

Run-wide scheme switches are read once from the environment. The x2/x3 face-flux covariance correction (SNAP_FLUX_COVARIANCE, #289; docs/derivations/289-covariance-x3-curved.md) is on by default; set SNAP_FLUX_COVARIANCE=0 (or false, off, no) to turn it off.

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

Metadata

Release files for snapy 2.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for snapy 2.13.0
File Actions
snapy-2.13.0-cp313-cp313-manylinux_2_27_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64 Details for snapy-2.13.0-cp313-cp313-manylinux_2_27_x86_64.whl
snapy-2.13.0-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for snapy-2.13.0-cp313-cp313-macosx_15_0_arm64.whl
snapy-2.13.0-cp312-cp312-manylinux_2_27_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64 Details for snapy-2.13.0-cp312-cp312-manylinux_2_27_x86_64.whl
snapy-2.13.0-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details for snapy-2.13.0-cp312-cp312-macosx_15_0_arm64.whl
snapy-2.13.0-cp311-cp311-manylinux_2_27_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64 Details for snapy-2.13.0-cp311-cp311-manylinux_2_27_x86_64.whl
snapy-2.13.0-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details for snapy-2.13.0-cp311-cp311-macosx_15_0_arm64.whl
snapy-2.13.0-cp310-cp310-manylinux_2_27_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64 Details for snapy-2.13.0-cp310-cp310-manylinux_2_27_x86_64.whl
snapy-2.13.0-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details for snapy-2.13.0-cp310-cp310-macosx_15_0_arm64.whl

Total release size: 281.2 MB

Release files / snapy-2.13.0-cp313-cp313-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.0-cp313-cp313-manylinux_2_27_x86_64.whl
Size 65.4 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
ee6337a45f1dc548840871f8ff5c2e4f623ee32482dfca22ebcc4b65784c6e3b
BLAKE2b-256 checksum
How to use checksums
11752358b4c37ab720dd1d26090e5f40ef64eaed2153e3eb8d1e8e30634276c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.13.0-cp313-cp313-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
edd22efd9516ae43d37e9b30202308308af29906f55d13cf463208cde5ee072c
BLAKE2b-256 checksum
How to use checksums
74e4c1f543200379c984384ad9f23dfa0a22ebac841667e02c5631acd6b66e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.0-cp312-cp312-manylinux_2_27_x86_64.whl
Size 65.4 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
e37207329218dee5cd7e7649ebcce5bfa38f92bdfc4676a32b7ee1dd257adc39
BLAKE2b-256 checksum
How to use checksums
bfdf30eb26c243d1b52cf4abae4c923dddace6603666abce02afa1fbd8b29b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.13.0-cp312-cp312-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
a05a81ccaa492dabed4ee74fcf4761bc1292a82d4b6322c6d62d9a2cd1b108d4
BLAKE2b-256 checksum
How to use checksums
83f430af2e418b882a69c474b88f68bf3df7cc463474b4e1667cfaa053a9e9b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.0-cp311-cp311-manylinux_2_27_x86_64.whl
Size 65.1 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
3b2a5c06b4bd3abe5b7a8a087277097eac8555324485a6801545f018e9f32fe8
BLAKE2b-256 checksum
How to use checksums
bf0f0d7482090d61d92fb24ad51f0b2f3e36de3e8d6936ba4637fa9cf1545c53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.13.0-cp311-cp311-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
438add58b66cb40a13f72c4c4b6ff13e81824ce2fbb77a276a3ca7079a570d56
BLAKE2b-256 checksum
How to use checksums
adaf7e1c38760df39464090594052bd8eed0950eab9e9a1b43a841234bf7422e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.0-cp310-cp310-manylinux_2_27_x86_64.whl
Size 65.0 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
074c6bd974ff8d818eaf2a1392d8f0d2c8b37335195c82b9b85cbbb193daff8f
BLAKE2b-256 checksum
How to use checksums
c1f1fde994c459e87f27408ed62d3b91ec0f1b661207de2349ce9724e7f4b605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.13.0-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.13.0-cp310-cp310-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
0130ab2d6b96daef5ef0eb9fb06750df08ca75088772920fa72d68b2eb8f8883
BLAKE2b-256 checksum
How to use checksums
ca7401838b2034977853a019e92213c79ded646f29ade6ae0a4677b1e8920729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for snapy 2.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.13.0 This release

8 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page