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.4-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.4-cp313-cp313-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-1.3.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (41.1 MB view details)

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

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

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-1.3.4-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.4-cp311-cp311-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-1.3.4-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.4-cp310-cp310-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

snapy-1.3.4-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.4-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.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c877e6cdd89fcca0d604625bbcbe7e39085a8e65e7cb910dba00cee9abcbd68
MD5 e3047ff3f1f66802855c943568a4ec98
BLAKE2b-256 991d3d24c6d22bb455726f0793263b20936eb1ede15a7d71383cdc68b575f305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0dd4f1f3ae25ea3d8ae64021a92b50951e44dbc001efe7c064b5daafeccb40fc
MD5 39a12274c37418fcc16602fb7cd50e0c
BLAKE2b-256 d0e9881fa5ee226a6c7826972e22cf18a0e080572b57b60123c564f7b246802b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68f07b0f7d821c42ad5b640af094c22920245995809c4045cdb6227aed2a0207
MD5 99e0dc6381cf428c6970d05784ab98bd
BLAKE2b-256 3a095d8d2703d21ca8d78cb903f47a0f36ea07b7d832e97ff99612635e1c5e63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3dfd908e9a2c6fac2e223e21a958502c980e65b32d4c74bdc1033add2286244a
MD5 3d5e7e0dde7cd3f949969c8450c95d33
BLAKE2b-256 a0856e15b1140ee27cb828c0141eca01b935ec5874f7e375928318784aac5b9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb24f9ab57e785a3dd5ad7e8c8e298d6ee5c64531b3422e23bd3ae7ade96be21
MD5 e3736365acdb7cbd3364ed55c26d99bf
BLAKE2b-256 4033005d08c1110e18f8d53417a729fb886052f52a161e32e45d9997a204c887

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 86177b9a89a30075221e9ab4da6fd2e7f0941c686afce0c15c9aad28ff983bd0
MD5 ec250dcaef8f7d1504d04b51aad648ce
BLAKE2b-256 a4d7665fdac3eb7e00582c5da6746a976d2e7a75ab583cd793b14c6a80efdb19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 514ff8000d74565a46e01822d4ec70d325122d4c3b358adce69a8815d85faed4
MD5 11bdb4c16853f49f2d63510d8777d84e
BLAKE2b-256 4e29afa74aa4d8c3835928c686059621bcd3a269b2ecbaa623bbfc87e42d9385

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c36e1f2e3cd62a508b11f1e93cf0c9795c32eb3e1c5af3799069c88d67f0b8b5
MD5 2df144d4db4f037f66df3f9ffbb65ea2
BLAKE2b-256 5cb2707993aebda0bcb535db71b4bd18297041405831018d2e9b27ac3e37470d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 830afacecf7c7bc4de4f4079cebc5646351a38d53b2a2638a15b2b161a789305
MD5 cfb0f375caa9e30e50fb8c811b5eee91
BLAKE2b-256 167974200efaebe9fe6ab3566b5f3a51f9026d39aa003d7f3664b2f90d6af393

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.4-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 045aabe13587686b988368f037d15d422a9bda6c87370e0981815dc50a2bab0e
MD5 d0265a92fd2f1e777b3a6ea77458aad6
BLAKE2b-256 5bc82246039986bb476b80e40e1f027dff0febadb2b05ad3fa3ef75a509d4baf

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