Skip to main content

Multiphysics integration engine for ODEs and PDEs using implicit-explicit operator splitting

Project description

op_engine

Operator-Partitioned Engine (OP Engine) is a lightweight multiphysics solver core for time-dependent systems. It supports explicit ODE solvers and IMEX/operator-based schemes for PDE-like models while staying framework-agnostic.

Why use it?

  • Shared solver surface for ODEs and operator-split PDEs.
  • Strong typing, minimal dependencies (NumPy + SciPy for implicit paths).
  • Separates state/time management (ModelCore) from stepping logic (CoreSolver).
  • Optional adapters (e.g., flepimop2) without affecting the core API.
  • IMEX paths accept externally supplied operator tuples; defaults remain explicit-only.

Core surface

  • ModelCore: state/time manager; configure axes, dtype, and optional history.
  • CoreSolver: explicit + IMEX methods (euler, heun, imex-euler, imex-heun-tr, imex-trbdf2); accepts RunConfig with AdaptiveConfig, DtControllerConfig, and OperatorSpecs.
  • matrix_ops: Laplacian/Crank–Nicolson/implicit Euler/trapezoidal builders, predictor–corrector, implicit solve cache, Kronecker helpers, grouped aggregations.
  • Extras: OperatorSpecs, RunConfig, AdaptiveConfig, DtControllerConfig, Operator, GridGeometry, DiffusionConfig.

Installation

pip install op_engine

With flepimop2 adapter:

pip install "op_engine[flepimop2]"

Quickstart

import numpy as np
from op_engine import ModelCore, CoreSolver


# Define RHS
def rhs(t, y):
    s, i, r = y
    beta, gamma = 0.3, 0.1
    return np.array([-beta * s * i, beta * s * i - gamma * i, gamma * i])


# Time grid and state
core = ModelCore(n_states=3, n_subgroups=1, time_grid=np.linspace(0, 10, 101))
core.set_initial_state(np.array([0.999, 0.001, 0.0])[..., None])

solver = CoreSolver(core)
solver.run(rhs)  # defaults to Heun/RK2

solution = core.state_array  # shape (n_timesteps, state, subgroup)

IMEX with operators (tuple form)

import numpy as np
from op_engine import CoreSolver, ModelCore, OperatorSpecs

n = 4
times = np.linspace(0.0, 1.0, 11)
core = ModelCore(n_states=n, n_subgroups=1, time_grid=times)
core.set_initial_state(np.ones((n, 1)))

# Identity implicit operator along state axis
L = np.eye(n)
R = np.eye(n)
ops = OperatorSpecs(default=(L, R))


def rhs(t, y):
    return -0.1 * y


solver = CoreSolver(core, operators=ops.default, operator_axis="state")
solver.run(rhs, config=None)  # defaults: method="heun" (explicit)

# For IMEX methods set method and operators via RunConfig:
# from op_engine.core_solver import RunConfig, AdaptiveConfig, DtControllerConfig

Public API

  • ModelCore: state tensor + time grid manager; supports extra axes and optional history.
  • CoreSolver: explicit and IMEX stepping; methods: euler, heun, imex-euler, imex-heun-tr, imex-trbdf2.
  • Operator utilities (matrix_ops): Laplacian builders, Crank–Nicolson/implicit Euler/trapezoidal operators, predictor-corrector builders, implicit solve cache, Kronecker helpers, grouped aggregation utilities.
  • Configuration helpers: RunConfig, OperatorSpecs, AdaptiveConfig, DtControllerConfig for method/IMEX/adaptive control.
  • Adapters: optional flepimop2 integration (extra dependency) via entrypoints in the adapter package. The adapter merges any mixing_kernels already computed by op_system (no automatic generation) and consumes config-supplied IMEX operator specs (dict or OperatorSpecs), forwarding the chosen operator_axis to CoreSolver.

Development

uv sync --dev
just ci

License

MIT License

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

op_engine-0.1.0.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

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

op_engine-0.1.0-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file op_engine-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for op_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c3d912bfae0227733d7c286e1e0276c3e6e0e0872ebd56be916dbdaae6b4a36
MD5 bae4436fb3b2f3f8b1c905ddb03a3a68
BLAKE2b-256 e2ace9b9bbd09d3062cd01ca845e3081e8f5c2b792def06d57fbbcbacdba2e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for op_engine-0.1.0.tar.gz:

Publisher: release.yaml on ACCIDDA/op_engine

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

File details

Details for the file op_engine-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: op_engine-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for op_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00a8f489255dd5520aa80af4dd9eb2a5a040bed64d560cbf75dd8371adfb152e
MD5 a70b6d6372b85d919102fa8907c3c485
BLAKE2b-256 30be8e019ed2de5d32c1221f8a5e4e3f6ec03a32681a074fc86ed5b8489d756f

See more details on using hashes here.

Provenance

The following attestation bundles were made for op_engine-0.1.0-py3-none-any.whl:

Publisher: release.yaml on ACCIDDA/op_engine

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