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

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.10.0-cp312-cp312-manylinux_2_27_x86_64.whl (60.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.10.0-cp311-cp311-manylinux_2_27_x86_64.whl (60.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.10.0-cp310-cp310-manylinux_2_27_x86_64.whl (60.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.10.0-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.0-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.0-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 c82d6889bde5511ea12f8107c4784ec389a59e9f55494f90d2bc29218a672a13
MD5 dd639942f3fdb165231629942417b25e
BLAKE2b-256 441912bd3a48481ccc0fb2fe66820f78e80838edf9f309d08017c94cf43315dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 68f46001ba1481cbc260e89af17f31ff54ca923eb75978691abbad71b4f68a82
MD5 f596f2a72c770d9125c9be573d82b983
BLAKE2b-256 47de99779763aae817a2f2f0af179067d4ce42a8c42511222152f644a57a232f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 8409835b919e822ce523f05c30be55c24ee7d418fb43bcbad82e3afffe715bbc
MD5 a5bbe3581fbf0cbd6a022af34eee6f4e
BLAKE2b-256 4669dac11756e603eece2e93bd416db11df2b1afe529d23ce3974ee873925215

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ca779b14b056837f350ce84b231a3db39421fe5ffb7d28cd331894bc07a224aa
MD5 93ecb7748cf93e2a8284b84ba13c1702
BLAKE2b-256 d8485e0c4e2005b41bbe1d821d67f54ccbb1599ecc7fa8ad586a5d86a8332952

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 db0074521268398f228bde047401c07be4db3bbaa3a145c9fd0ba2d318c7ca73
MD5 aaf999c68ac2f04e2c3f42dda6e5d8c4
BLAKE2b-256 4150e268ab334cea36b2045f104e9d83dc2e6a228026044e60de8a1a802de66e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 580aa9662d2303faa1403db3f150b4ed4e289cb021eaf0fc837c08967bca7306
MD5 d135c24aec7e6d135acbc75111189c89
BLAKE2b-256 486a5e1297eaad1a809a352d6fa2961d77b6895e6cd94ff12e0c98203259a560

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 046098e14661e27b3a85b58be917a01826806b3d645d7724604f32ff490f0f73
MD5 8642324d37152acda7bbd33cff3d7f71
BLAKE2b-256 c594e236b503143b4343dad0318570fc7dd6f6fb8e0c997d8b194c282729bc9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3fd2e93de6a3798e78e816cfdb8107730b078771d833c208101c470371463e59
MD5 80d66a585b0c70fd31d0de851f046778
BLAKE2b-256 00148e728f7158cba01dd0cb1e03b5122de2f7f33dce7407722abc16fe203939

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