API Reference¤
PICT is used through three Python-facing layers:
| Module | Kind | Use it for |
|---|---|---|
PISOtorch |
compiled C++/CUDA extension (extensions/) |
data structures (Domain, Block, boundaries), the individual PISO operators, the sparse linear solvers, grid and resampling utilities |
PISOtorch_simulation |
Python (repository root) | the Simulation class that runs complete PISO time steps, plus boundary helpers |
PISOtorch_diff |
Python (repository root) | autograd-enabled versions of the PISO operators; used automatically by Simulation(differentiable=True) |
lib |
Python package (repository root) | mesh generation, I/O, output and plotting, multi-block CNN layers, turbulence statistics, logging |
PISOtorch is a compiled CUDA extension without generated API documentation. These pages are written from the binding definitions in extensions/PISOtorch.cpp and from the Python sources, and the listed names were checked against a compiled build. The docstrings in the bindings and the comments in the sample scripts are the authoritative low-level references.
Conventions¤
- Tensors are PyTorch tensors in channels-first layout (
NCDHW,NCHW,NCW) with batch size 1. Spatial dimensions are inzyxorder and vector components inxyzorder (see Core Concepts). - Devices: field data must be on the CUDA device of the domain and contiguous. The global viscosity and the time step are small CPU tensors of shape
[1]. - Faces are named
"-x","+x","-y","+y","-z","+z", or given as indices 0–5 in that order. Axes are"x","y","z"or 0–2. PISOtorch.Int4holds integer sizes inxyzworder, e.g.block.getSizes()returns the cell counts asInt4.- Functions and attributes marked (grad) belong to the backward pass. They are compiled in by default (
WITH_GRADis defined inextensions/domain_structs_gpu.h), andPISOtorch_diffuses them.