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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

snapy-1.3.3-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.3-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.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for snapy-1.3.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f59229dd4fd3cb2fc73f1f56a75162c2fcc2c03a1e6c2dc02777f253b871be8
MD5 b4891a78eca9cbad5f57fa8ffed6b50c
BLAKE2b-256 54fd4e1908e2f47f13ad114f9ad18384464f2f66ae2fd55f27f30efcfeba8640

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 cca400ea70046b3238eaf726282ece016571380d0c7daf1e2197e480f1a58d1a
MD5 a4b5d7020ed000189d29860a6da8d51a
BLAKE2b-256 3bc3bfcca002b0b4032cd5696b4d26e7771ebf89a4ee4e7002aa792e75712475

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 348195c9f4025618678e8478b521554652f08678f6b6ca60ee4f403cfba18d03
MD5 41fb0b4cb10f1d89dc51434b009329f9
BLAKE2b-256 6203d470ab211ee15cab2bd78504810ba25d96f2e37d6e6c40337c718f83da99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3af3d2019fa418bc46920b11abfb0fa8a08dd72cdf3503dcbda96da399e6c7d7
MD5 0fab98ce90665e490f4cea9c55ac439f
BLAKE2b-256 a215a258ebb442b8c83003bef057e23d80f4bbf387c99172d45034d1ddd0eb8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9692b3e63bc9d63ae61dc3d9b205856f946127ccf23320ffc730b5d199b87991
MD5 d5b65cb76d2bc74f16cdd220ecd6682c
BLAKE2b-256 e404dfb2aab1ddec03cb06acb350c79ebe0b725750ec8f2ddf2e6280e6197d80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 945c34e49232512ab08ad779fd00e5703db275b12e8e21989dd88d3db793d0d2
MD5 672c76130a2b85fe2ff570781498be8f
BLAKE2b-256 b53a650a7f2cd383f27384670fea57d474246f63302703e5bc33bafbc21c3b74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd5661f75274a0cac2602d44166332b2320ccdeebc699f3c19e98efcb4c58d0b
MD5 9bdc76763367686521d1a528815e541a
BLAKE2b-256 f759622d58db7626be0b2d2ef0c75cbaeabf47bca0c356e2114ba02af7d42b32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f3ae4c293cf967922abc11b8c78645ceb13f973a86f6d2fb6ee429fcefba0d03
MD5 6eb190f63d6152a837912e3344562c0d
BLAKE2b-256 f3ec5c1537ce1ea1b7dbe6648cc9a84dec0ab83ea7cfbbbc223600ac089e574e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 92e869dd505fdae29c40a39a0038fd1d4071087644a65714e649cd67e4f355be
MD5 362d6eac663358bb12eb7a727905771d
BLAKE2b-256 49a9c342a163a7604b8eb8bafacd2e24d0cab43dd31d24e8b26c04dd66826e70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-1.3.3-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ab0fb9c1fb851d1adcc9fea0362343496c8daf6b77e1a47c536221bd6ce2436f
MD5 8cbe78be24faedb394d3da92a913ca83
BLAKE2b-256 04d7c180de573f530238d7d0da2cf483fe716cc642cb961f7dea414e9b1b6bad

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