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
  • 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
      
  2. Install NCCL (if enables GPU)

  • Linux (Ubuntu/Debian):
    sudo apt-get install libnccl2 libnccl-dev
    
  • Linux (CentOS/RHEL):
    sudo yum install libnccl libnccl-devel libnccl-static
    
  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-1.3.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (41.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-1.3.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (41.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-1.3.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (40.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-1.3.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (40.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

snapy-1.3.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (40.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

snapy-1.3.6-cp39-cp39-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

File details

Details for the file snapy-1.3.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53bd83d8fb1a7e653b2f2628cdf7ca39cf41b0610802d028b0023fe8269bdbc8
MD5 faabd1ddd90a898349c2f7b58e438e09
BLAKE2b-256 ca1c32177e25358c8c20d78cdb1e514c03dbd8cd58046cae59453199a1450aec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.6-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ca195e26d8e0f6c03b2a8abb4520750336659db757d76778a11d301298fc4aae
MD5 28956ad41e4d899d8c5f9b5cae332470
BLAKE2b-256 1a2e8c040505c8c25c6294e2dc8362ac15a3b88bb7c281f45c2bf9c415398df6

See more details on using hashes here.

File details

Details for the file snapy-1.3.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd62c25bf42740bd39aa48ecbca8efad551e26fc89bf30895947e8f5db7f8b5c
MD5 e2bffcf6046c7310b631efde6bd45e13
BLAKE2b-256 4d19e63967156a258bfdb5eda34ff6eacaba6b40e25cd488d671ebd53884226a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.6-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7eb41903b3ea6be0c9ca66d421ce1ec15205150e4ad4617f26fb109264b438a3
MD5 0eb497fe97a0e0bb553e74a186c35789
BLAKE2b-256 bd32b90f07741405b8dd8214491810cd99091dff73e2c9883f9841a61b6b8a21

See more details on using hashes here.

File details

Details for the file snapy-1.3.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ec2ad416fb498f0b51dc13521d67f322e8495f17ef6c89a91593c990c839882
MD5 aa68a73f8bb06010f9d483e5011146fc
BLAKE2b-256 7f5dccafab5d4859dbfabcb2b02d6e5646d89729d538c9e003e1b221063c7a67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.6-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 088c5fdb0c15ed4183796c07cd6fe874d6b78c5474f333352294f684c36e1f74
MD5 3ac2042fa25bd9688d47180a0d196f0c
BLAKE2b-256 54372c88dd7b62d708319a9a41bbeb44e8bc945ed9623662c41d69e912779bd7

See more details on using hashes here.

File details

Details for the file snapy-1.3.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43f60055ffbb707681d1156daeb56743fc791294b11740120836e096110ad237
MD5 5a445a478bc9d48c38870722479771a2
BLAKE2b-256 2ba5e6bd5de6329f9b7dfbea70b2700afe3f2d9aed00e2b6bc2f7e3d4e99750e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.6-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1186087018441360aaaa4b1155ed607c45b8bfec980561d5664917fd41e99c6d
MD5 93bd11780a0f003e7cc498f69836e245
BLAKE2b-256 edc708cc0175b4d39b0b6033e7d99f6bdf4c4422c77beb7fd322d315e071d233

See more details on using hashes here.

File details

Details for the file snapy-1.3.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 835ed57d547bcb7214687ea22edf77c1d2d1fac6815c0f86bc55560ece19baa9
MD5 0b1555b2b7495fb8a92691b32a929842
BLAKE2b-256 d0072c785ee55677db76d1e9048417a3cd4cd58f2de62d9722d8d08de4ce5fde

See more details on using hashes here.

File details

Details for the file snapy-1.3.6-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-1.3.6-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c42592c0e862596e4ddbda6cc078d6963d1f9c2d6d756bd9ae3dfc4cab90691c
MD5 90e31f5b1e1ec7170691786a8bc1f0d6
BLAKE2b-256 8d140306b4c986bb9e39f9fad3adcd34d1917dea08c50400fc0573ad8e000fbf

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