Skip to main content

Compressible Finite Volume Solver for Atmospheric Dynamics, Chemistry and Thermodynamics

Reason this release was yanked:

problem with pressure grad

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

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.8.9-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.8.9-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.8.9-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 6340b46e09be5ac3f9600bb006f1eeb0f327ca3fc405d3be2614f1fb28b8c2ba
MD5 c79aacf36847465624563a88ba225c87
BLAKE2b-256 212099dcb12cf155cfc76c3b8aa5380ff7c7a5d0b61a3365b4c17101d9f70ec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e1c261208d2a04f9849703122e46b8adce0024aaa1f8bd48e99bba0a7d38e60f
MD5 efce064acecd6eaa691a6f16822a1ed3
BLAKE2b-256 d17ed23b81770f742c0328df44cf97b71ccc426393ceaf9d53fc45b6466c6f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 cc8b888bb00bdd5c776f115434efa7cd0b209f82da4735d536d3d8075c91b08b
MD5 d63546949e531834cb1d281600cc5d46
BLAKE2b-256 74048b2289f8c674ecd315eadd63f2c503abd1ced19c0e82990c41d8cdba4cc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 12c7481edc3cdcb41c76f7cbda196d59bec4f0814de784fbe7e0dc0b2106f6ed
MD5 4a1bb72b51bb12a740eb7046b79e0983
BLAKE2b-256 19e8eb8897aa43ce856fa2b230501f7763d530133acdf4c848c7cd6d20c38bd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 cab6ed6147ef1535dc231efc1f6bd5b4e5ae82427026bb84e97565307cd769fe
MD5 d197db61b240c782b86b19ad4d7a11d1
BLAKE2b-256 d24f947ac4105fbfa0c663267d5dad391aa72398f080821b8f36a3dd80846af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ceca2ac6e48d727f650091118f1d613d208b384f8b315c252eea38b81e1f7d85
MD5 2049ced21a075f7bd19c03e9ffebb429
BLAKE2b-256 f52cf2705a06a40a677cfdee3933f373e281078327df3dc1db04482676867055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 ba97d3c2d2c009d046f1987996e87890cdcab21780b75b1f059c4c7e84892faf
MD5 7ea308f6b0cbdcc65a462eb46a819ed2
BLAKE2b-256 8303d012429cbf48fdff02c2bdb0735f9facdb966cea3b0ccdbcc9e20f103317

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.8.9-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9407e8820c97712cccdcc998fcae6ce44dd33b8adf6855ced10760d0c5d3f7de
MD5 a8696c4cd8055d521f386fb72d9dfd06
BLAKE2b-256 b93f3907d8a83f73546c44b93449860c0c1b5cf00747741c827046b722b65717

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