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

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.9.5-cp312-cp312-manylinux_2_27_x86_64.whl (60.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.9.5-cp311-cp311-manylinux_2_27_x86_64.whl (60.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.9.5-cp310-cp310-manylinux_2_27_x86_64.whl (59.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.9.5-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.9.5-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.9.5-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 9784a0974ae6501225cf07801ba4000a163b68022a01d1b3d807fa7bdc2e903b
MD5 7d5452c1379cdbec2247e1dea07e0615
BLAKE2b-256 2bdb441730dad06f6b4f9d0611a39e1ea2fc284adb4b020b38641a6c5540e8e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 802e1c022069a9927a27c896d27eb57c9175bbd2b7986f67317b971e838105de
MD5 d540cc815d1a22bd09e777e3654da1c5
BLAKE2b-256 7d0a0f45ced51de0d47cc68101b28fd687eea0371fa86ba0be6a04aacf782a0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 93586d0baa0379026ea8a1477126ac899579cc85a3a09a357fa280e25b170c52
MD5 5a3c86246252ee61031b93b983b7da51
BLAKE2b-256 4cce13bed09fe5113c9f43aa91fe49d3842f2096eff38e2cf1a07373d4c79789

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 96748061e1c0044a0a5577d8d4583a4dd176e4ee884eb05b8694a68087da9405
MD5 907fa3300793a88e0215022c56fe1a4f
BLAKE2b-256 1cfe775d460aedbff7fd60862c2a66dc34e0a91377396d9418d0f745460c0add

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 4c6696fefad95621bac02f66a24c785979dbaa30bd6e7ff974999a8925c4761a
MD5 c8dbebdb441f3462faa79d212c28765c
BLAKE2b-256 c84c5da3dd4b96107133b13c2e81ec61ed59d25eee3cf64cbe35792c9401b5d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7b34517ad2417e6e210ea69421b6a6126adba2b8767b10725c8bd69551bea72b
MD5 486e1dc3058503eeb2c3a8fbb03a54ba
BLAKE2b-256 e5ca928a1befb5ecc35fcf3926d609b76ab7cc68a11023840cc498275f28611c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 3ce399b46a2082676527021c6b4f95b8edcb8685d740ab33014d9a6962b0cf0a
MD5 2b0023b45002d4bf1a04965043830cb3
BLAKE2b-256 8bf4ae8f4fc9ceb40d21374c017359d6cb814e08fbdbd0f1fff51268aa2a668f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.9.5-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e0543d334ad724691093f430ac2d5945101004caf907dd60b52a3077bc3c0a25
MD5 d24f2425e408efa1ac9f9919c5679e28
BLAKE2b-256 927af3c11b39a3001e6284a23fb239be4a09720f10800c8d998fa929a096fb18

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