Skip to main content

Compressible Finite Volume Solver for Atmospheric Dynamics, Chemistry and Thermodynamics

Project description

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

Project details


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.9.0-cp313-cp313-manylinux_2_27_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

snapy-2.9.0-cp313-cp313-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.9.0-cp312-cp312-manylinux_2_27_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

snapy-2.9.0-cp312-cp312-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.9.0-cp311-cp311-manylinux_2_27_x86_64.whl (66.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

snapy-2.9.0-cp311-cp311-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.9.0-cp310-cp310-manylinux_2_27_x86_64.whl (65.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.9.0-cp310-cp310-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 17dfa2065d042fd10d4d46585f9d61cdc73b7869b12183f81c398295734d4f26
MD5 0bae0da7473a51b5426658cad3c4923a
BLAKE2b-256 cda125aa29464d195f8a9767cead38bbae0c7636173120e044968506b795c53f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 100ccba830f63d8495eb87d9e66cc5a74d403cb39f5f0808ac402b8e28d0fa4f
MD5 32c3c7105ad7bf7e7eee6a5cb59b4ccf
BLAKE2b-256 e5d72beeb716bb1e284aeb123275d3a40c99d5e2a161c4dc880586f9a70966c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 f4f9798ef659d4c0a7858fec5f69e6e80259729b254ad697ac4d07caf50717a0
MD5 3d17ef2b4f3a1aab3b132485e3fa6e5c
BLAKE2b-256 a333d9b5a00c3d312a02c9a3ff02b7e34c0107988623608b74eec9824cfc3f31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b61b97015678e23817514430b8cea20968e1ca1f25f61e15e7fe013a60261ac3
MD5 4105919e8187eec8cb3d33e0445aa200
BLAKE2b-256 77c2a9df02a8baf916f4f6da9b8cb628b160cc110dc89ffb71c8895d4b8169e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 e67246211267e40b862b371856c47ddb98e5690a388a1c2477674d0aaa0e1c10
MD5 1d77a88d63995d9a5a4056855da44088
BLAKE2b-256 b14fb55f2620d39b58d7d6c1aae1f2176e4cdd566443d517084a2c6a868d4afb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f46e49126a53f5c189bac5ff1b53e2d3f79bea0f636b16a49bae1896d53fde96
MD5 3be260f8a670aa537bc5b392e76fc322
BLAKE2b-256 46cde540ea3606764eae9fbefe1642d67800dfb1080cb8d4fadfa3c7917ed7a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 b956023ef7d29369d1aa5c5bf6fb0748b1932875aba7c3b2b3d6c15af595336e
MD5 7925465435ad14f3e9bbf7191a571b12
BLAKE2b-256 194e7ec864765db3e939a6d7ef53c122176652f22568d6f68abff49e078aa9cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ee7cf5708003443aaecd6c2750af603c84c27b1127dbc5d7114071f091780330
MD5 bff986e3a37c15dcf66b1577f22dfdbf
BLAKE2b-256 4a4d6f18df5a2a31430e97ae0ec748898eb33e4e6a8220f9098347c29e3002b9

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