Python API Reference

High-level API

The recommended interface for most users. These functions accept NumPy arrays and return Python dataclasses.

Result types

Session management

class openimpala.Session[source]

Ensures AMReX initialize() / finalize() are called exactly once and in the correct order, even when mpi4py is also in use.

Usage:

import openimpala as oi

with oi.Session():
    vf = oi.volume_fraction(data, phase=0)

The session is re-entrant: nested with Session() blocks share the same underlying AMReX state; only the outermost block triggers init/finalize.

When the compiled C++ backend (_core) is not available, the session activates the pure-Python solver backend (SciPy / CuPy) automatically.

Exceptions

class openimpala.OpenImpalaError[source]

Base exception for all OpenImpala errors.

class openimpala.ConvergenceError[source]

Raised when a linear solver fails to converge.

class openimpala.PercolationError[source]

Raised when the target phase does not percolate across the domain.