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

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-1.3.1-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.1-cp312-cp312-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

snapy-1.3.1-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.1-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.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77b4cfab180c119a5f4a9edd3e3dbe48fb1c15eb6bd386b95fd34bc5ddc76d58
MD5 8780798093849e2b224b630b85467481
BLAKE2b-256 5ad5f51a4655f3b8d44bf2164d547005a15dae28a1e0c1569d03dc8c6df7b89c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f11e6cf57177f55f3c2d0d6522eb5d33585c3e7a2044e7947e08bae8ea7b375b
MD5 3836675cba661444ebe02762734c8b20
BLAKE2b-256 d253f96dc80eca40b9db91c0f5e45670d260a53337468ba64b6d9647065aec6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17c0712f89a81b8743b0395e7b8b2438b4b5dfe32744b9313473763af02623e6
MD5 74c3918adc1ca54a9186f1c7b1e61029
BLAKE2b-256 ff374b4d9cd2576274ed379aa51d0cd606a973eb8ac8b941b8673fd9463c37a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 43ea9bf773c61411e0abc7110819b1af24d25c171cec9cd09c667ef021f219e2
MD5 58d9d350c13d92eeb40afdb20697482a
BLAKE2b-256 a0ed2ea29ba977a03231c59cfc5e9151125b5591da8701c3e73a6ed912d5cb56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 467700b6d4e2dbc38a29ba083934f865d851a435837166a54e5b8413be5147af
MD5 cb5d32807a0fa251af04253557d331a6
BLAKE2b-256 6721bb151e65c12de9415393a073edfe41f891006e4d2b0709e36af6bcfe5fad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 83bddd1634adb4b68078bd6b1ac6c0b11f51f6222406e160f8331237c820a57a
MD5 35545a0f80c41c274ae1003af0d6b898
BLAKE2b-256 f5469b0d422c273c5ca4e806db06537c5ae3125f440fab53b345b183b0781d2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d7e251a616560404b0d08d19c303ef9f7f2abb4d36d33b9e5932e7237370f31
MD5 c7516176dbe06080970af8b7faa5962f
BLAKE2b-256 19aedabfad1e8b6f9400aa7ae5399483600e9893bc8cf168aa7af15266216101

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4be980ed71683f1e0c2e2cce41edbde34d84ad3a29f010e74a6e7cda48b6df29
MD5 94137fd4d0b0a929ad3f3b913a71f1d1
BLAKE2b-256 1313f76a4b9ef6699976ae1d606b47dec60c273f38f533ddfbcefe2f97768504

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f150366b443877eb5924568347c7db50509f5960496129265603f7416168f3c
MD5 02fe45c0e5ddbd9e9f69e7428684b2bd
BLAKE2b-256 7fcac10e55cd216f1cc4c841b830d70aaf54b7fedd240d70908426051aeee9c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.1-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 43f2cac790edd8c0878a665a533530d4d19d726db462a62cef7362a64a1d29a5
MD5 631bfb83d6ee0267c943096dcb6bb847
BLAKE2b-256 cc81994b185f2168538fa2fe165fcfe766bca44c5910936dff7bddcf8a056d1a

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