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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

snapy-1.3.5-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.5-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.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 86eca56314042b54dc4d84aa9f39ab9aab98b22177c38175ee3108a8cc3ac2b1
MD5 88e27046f3573c6bddc12bdceda931c1
BLAKE2b-256 f78324623996ce70581c715bad324e445bae4be3786627998a4c34811d5f1b54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ac4dbdd91ba5941d78c3fe5b727bfb450ea3738467e89479592d9352f2910e08
MD5 911bdad061a9e908fd809e2d4236da95
BLAKE2b-256 d934059f5feb8f57382948568624f9ac5e11c50404315d244cea054795f673dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8314b16c7fa5c8c123f329cd25ddbc47fff6d216304f932650a67353119d918b
MD5 20c8bfbef365916caab05aaeada1cd08
BLAKE2b-256 5682153dae8158c8721b9cf1a573f2e617f8b0a725de0b9546e121ca8210882e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b54c853224488f435071ceb255aa3a88c01a94b9fc116776e04e3a7723d57cd5
MD5 286d4dbdfdedd3be2b184a4e505adcf3
BLAKE2b-256 928311203fd02b0cdf8040a1f52df1f5aef9d9c6757877dcfb9f7023930d4b66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4209ade4e389e5ed730948dbf5baf1de52c8d8d9fa597753e931821f3e57d132
MD5 1bda76e08ca56cd54cf7ad21cd38d6b9
BLAKE2b-256 db8c05d4659344fed3ff3686687937c02d68fc7a253507efb3ae360e2b0e1372

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ea3a7193bde77eac8f7523ee3c1aefc17b0f7111b3f9400708c3722e37712430
MD5 dae2ac9df34b09a090bcfdec7f3fc467
BLAKE2b-256 b09476fc9ea846575db883a0529e14fd8484214680549a2eae422069b5b4105b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0813122e8193ba842d95c0e7b7048e6b9da3b09c24d09f5df5452f7732a9002a
MD5 1763f6c90f59b7a3ee1466455eb3f2fb
BLAKE2b-256 0e51e15d6ca3ecfef32263f01c74535ff175483089b4e039d94abadc206777e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3efeef02fb1621bdd19432691adb7794230010059188d52f95cb56ea6b48a78e
MD5 8e674194396722282f9c8d3d9ec3da59
BLAKE2b-256 fe1a08517bd4aee3c87909fac87b9ab154831752882394a97d7cb4d773c6ddda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 141e39bd9e7a3910c7de620d3c20199efd30171cdd0ced9b47d4127ee8720c90
MD5 a739c4153247ee60178f8a712c39c9df
BLAKE2b-256 b82c81e19d636a15355f649f07f0fb0f858475c1d94b2cf80678048c14edda2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.5-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 26fe350b40abbfe39bfa921fa3881b7ed4dc57f2b6bee0f4772453533da957ee
MD5 32a3e35f90577046386b0e91d1af443d
BLAKE2b-256 c2c7dedb71347998646cb19b4d560a17568bbd3f0bb669a9d565c179b592c28f

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