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.1.tar.gz (83.6 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.1-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: op_engine-0.1.1.tar.gz
  • Upload date:
  • Size: 83.6 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.1.tar.gz
Algorithm Hash digest
SHA256 5ed7a6135476f69d16c34dc1801b072bace2a67eddc0c3a31c518aaec4b590ae
MD5 a6625c686886c175508ba96c52763ff4
BLAKE2b-256 e57001b05a9a6303a2b3640a9ab57d19739d1fe140bcc90c9857ced54b7aa3fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for op_engine-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: op_engine-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd256a2633e51559267818474b5b2f368ce274dde4fa08333c4c2ba797623d8f
MD5 f13aced59891493bbded8a81254cf28e
BLAKE2b-256 0aa22dcb6a57615bcb2311b1f0d37c638478e97f57390cf59701eca6e28288bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for op_engine-0.1.1-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