Skip to main content

peclet.flow — Kokkos cut-cell IBM incompressible Navier-Stokes solver (+ pnm pore extraction)

Project description

flow

PyPI version Python License: MIT CI DOI

GPU-accelerated incompressible Navier–Stokes solver for flow in complex geometry, built around a staggered MAC grid, a signed-distance-field (SDF) description of the solid, a cut-cell Immersed Boundary Method, and a pressure-projection step with a geometric multigrid Poisson solve. The code is written in Kokkos C++ (one source runs on the CUDA, HIP/AMD, and OpenMP backends, selected at build time) and exposed to Python through nanobind (zero-copy, on core's View↔ndarray bridge); simulations are driven from Python.

The repository is also known as pnm_from_sdf (its GitLab origin) — it computes pore-network–scale flow directly from segmented SDF geometry.

Modules

Module Role
flow The CFD solver — a distributed (MPI-optional) GPU cut-cell IBM Navier–Stokes solver in physical units, built on the shared core block-decomposition + async halo layer. One code / one API / MPI-optional, with native domain boundary conditions. Exposes peclet.flow.Solver (staggered MAC, default) and peclet.flow.SolverColocated (collocated/cell-centered velocities, ABC approximate projection) — identical API via a GridLayout policy. Validated against analytics and Zick & Homsy sphere-array drag (scripts/validate_zick_homsy_sdflow.py).
pnm Pore-network extraction — SDF VTI reading + pore/segmentation/topology extraction (SDFReader, extract_pores, segment_volume, extract_topology_gpu). The repo's namesake "pnm_from_sdf" feature.

The original CUDA implementation has been retired (Kokkos became canonical, 2026-06); flow was validated bit-identical to the CUDA solver — to machine precision, and against Zick & Homsy sphere-array drag — before the CUDA sources were deleted (restore point: git tag pre-cuda-retirement). The shared cut-cell IBM primitives now live in src/cut_cell_ibm.hpp; the operator headers are src/mac_*.hpp + src/flow_ibm.hpp.

Capabilities

  • Geometry: SDF solids (negative inside); the cut-cell IBM applies a Robust-Scaled no-slip / moving-wall condition and a matching cut-cell pressure operator (face openness from the SDF).
  • Native domain boundary conditions (flow): per-face periodic / no-slip wall / Dirichlet velocity (inflow) / outflow, plus per-position inlet velocity profiles. Validated on the lid-driven cavity (Ghia et al.), the developing plane channel (Poiseuille), and the backward-facing step (Armaly/Gartling).
  • Pressure multigrid: rediscretized geometric V-cycle, grid-independent, with MG-PCG and Chebyshev outer accelerators. Works on periodic, IBM, and non-periodic (BC) domains, including semi-coarsening for thin (quasi-2D) grids.
  • Time integration: pressure projection with optional incremental pressure, explicit (Koren) or implicit-deferred-correction advection, and Picard outer iteration.

Build

# Canonical: build + install both modules via scikit-build-core
CMAKE_PREFIX_PATH="$PWD/../extern/install/<backend>" pip install .   # -> flow + pnm
# Or a dev cmake build (nanobind found via the active interpreter, no cmakedir needed):
cmake -S . -B build -DCMAKE_PREFIX_PATH="$PWD/../extern/install/<backend>" && cmake --build build -j
# distributed flow build (opt-in MPI):
cmake -S . -B build_mpi -DCFD_BUILD_MPI=ON -DCMAKE_PREFIX_PATH="$PWD/../extern/install/<backend>" \
  && cmake --build build_mpi -j

<backend> is one of nvidia-cuda / host-openmp / lumi-hip under ../extern/install/, produced once by ../tools/bootstrap_deps.sh (a hard build dependency). Requirements: a Kokkos backend (CUDA/HIP/OpenMP — CUDA is just one option, not required), a C++20 host compiler, nanobind + scikit-build-core, and — for distributed flow — MPI. Python dependencies live in a virtual environment (.venv).

Run / verify

Simulations are scripts, not C++ mains. The scripts/verify_*_sdflow.py files are the canonical verification entry points:

source .venv/bin/activate
python scripts/verify_lid_cavity_sdflow.py     # lid-driven cavity vs Ghia, Ghia & Shin (1982)
python scripts/verify_channel_sdflow.py        # developing plane channel -> Poiseuille
python scripts/verify_bfs_sdflow.py            # backward-facing step (reattachment length)
ctest --test-dir build_mpi --output-on-failure # the multi-rank C++ test suite

Documentation

API documentation (C++ classes/kernels and Python scripts) is generated with Doxygen and published to GitHub Pages by the Documentation CI workflow. Build it locally with:

doxygen docs/Doxyfile      # output in docs/html/index.html

The architecture, conventions, and design rationale are described in CLAUDE.md and the design notes under doc/ in the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peclet_flow-0.2.1.tar.gz (433.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

peclet_flow-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

peclet_flow-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

peclet_flow-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

peclet_flow-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file peclet_flow-0.2.1.tar.gz.

File metadata

  • Download URL: peclet_flow-0.2.1.tar.gz
  • Upload date:
  • Size: 433.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for peclet_flow-0.2.1.tar.gz
Algorithm Hash digest
SHA256 aef534ff6adb9f1e2a00432dcc67d906f53d831474ede6f56eba05818a433b17
MD5 665e2c6851a87b5005737f0a0518a3f2
BLAKE2b-256 a67c8e38f43201889676ecb6baaa3bfbae0c12960fca9093f6e969988c2fa985

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_flow-0.2.1.tar.gz:

Publisher: release.yml on computational-chemical-engineering/peclet-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peclet_flow-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_flow-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 103a085deb278a4979813bf8297af291dff74edeaa9938e8b66f7ae94008254d
MD5 2111a46c0d74d579f71f3a7f12778f3c
BLAKE2b-256 1114f738787e5b469218b6dbeb41ab375d2829ecd70d8416764c84313f129a01

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_flow-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peclet_flow-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_flow-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4abe190da44a5ed4572a70f739c320a6304e768a2d0b65a7de2b6d697cd00ed2
MD5 041b920e65c1b7eb4504bc0f4a9315b2
BLAKE2b-256 1f7b94046f72ad37c28be5ff43b0702a7c93206ad9ec445433fd068661fc71bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_flow-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peclet_flow-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_flow-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c922989f9c440bab951b02e061d94e5450e1695fa4a70b0d81cb5c0e527b1c1
MD5 9cfd0c150940a3736a9328558e03bfb5
BLAKE2b-256 c5ec5bba6896feafa7481d7dcc66c32d45eb0d163973d783ffb791a81e24a1f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_flow-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peclet_flow-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_flow-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06e3d5961b830b2e75d2b5a7e7bb612468d8b5152a881407a23112a4aef8de48
MD5 e82dbd018087df7638f29d4a279ae52f
BLAKE2b-256 afd4d0008758353719e686214a407adfb0b9d3d609687e56385ed2ace631f143

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_flow-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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