Metadata-Version: 2.4
Name: osmodi-solver
Version: 0.1.1
Summary: GPU-accelerated Poisson solver for pressure from PIV
Home-page: https://github.com/3dfernando/pressure-osmosis
Author: Sohail Mulla
Author-email: suskytoplab@gmail.com
Keywords: pressure-from-piv particle-image-velocimetry PIV poisson poisson-solver gpu fluid-dynamics solver
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C++
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.20.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

**OSMODI** is a GPU-accelerated Poisson solver for pressure reconstruction from
Particle Image Velocimetry (PIV) data. It provides a CUDA implementation for NVIDIA GPUs
with a reliable CPU fallback.

## Github Repository

[Link](https://github.com/3dfernando/pressure-osmosis)
---

## Features

- CUDA GPU solver (NVIDIA GPUs)
- CPU-only fallback (always available)
- 2D and 3D structured grids
- Float32 and Float64 support
- Designed for pressure-from-PIV workflows

---

## Installation

```bash
pip install osmodi-solver
```

---

## Quick Start
```python 
import osmodi
import numpy as np

print("GPU available:", osmodi.GPU_AVAILABLE)
print("CPU available:", osmodi.CPU_AVAILABLE)

# Create sample velocity gradients
Sx = np.random.randn(64, 64, 64).astype(np.float32)
Sy = np.random.randn(64, 64, 64).astype(np.float32)
Sz = np.random.randn(64, 64, 64).astype(np.float32)

delta = np.array([1.0])

if osmodi.GPU_AVAILABLE:
    P, progress = osmodi.solve_gpu(Sx, Sy, Sz, delta)
else:
    P, progress = osmodi.solve_cpu(Sx, Sy, Sz, delta)

print("Output shape:", P.shape)
```

---

## API Overview

solve_cpu(Sx, Sy, Sz, delta, options=None)
Runs the CPU-based Poisson solver.

solve_gpu(Sx, Sy, Sz, delta, options=None)
Runs the CUDA GPU-based Poisson solver.

### Parameters
Sx, Sy, Sz: NumPy arrays (2D or 3D) of velocity gradients

delta: grid spacing NumPy array

options: optional dictionary for solver configuration

### Returns
P: pressure field (same shape as input)

progress: convergence history (NumPy array)

### Solver Options
```python
options = {
    "Verbose": True,               # Print solver progress
    "SolverToleranceRel": 1e-4,   # Relative tolerance
    "SolverToleranceAbs": 1e-6,   # Absolute tolerance
    "Kernel": "face-crossing",     # or 'cell-centered'
}
```

---

## Supported Hardware
CPU: x86-64, any modern processor

GPU (optional): NVIDIA Pascal or newer 

RAM: 4 GB minimum, 16+ GB recommended for large grids

---

## Citation
If you use this solver in your work, please cite:

Zigunov, F., & Charonko, J. J. (2024). One-shot omnidirectional pressure integration through matrix-free multiscale methods. Measurement Science and Technology.

---

## License
GNU General Public License v3.0 (GPL-3.0) 
