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); acceptsRunConfigwithAdaptiveConfig,DtControllerConfig, andOperatorSpecs.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,DtControllerConfigfor method/IMEX/adaptive control. - Adapters: optional flepimop2 integration (extra dependency) via entrypoints in the adapter package. The adapter merges any
mixing_kernelsalready computed by op_system (no automatic generation) and consumes config-supplied IMEX operator specs (dict orOperatorSpecs), forwarding the chosenoperator_axistoCoreSolver.
Development
uv sync --dev
just ci
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3d912bfae0227733d7c286e1e0276c3e6e0e0872ebd56be916dbdaae6b4a36
|
|
| MD5 |
bae4436fb3b2f3f8b1c905ddb03a3a68
|
|
| BLAKE2b-256 |
e2ace9b9bbd09d3062cd01ca845e3081e8f5c2b792def06d57fbbcbacdba2e63
|
Provenance
The following attestation bundles were made for op_engine-0.1.0.tar.gz:
Publisher:
release.yaml on ACCIDDA/op_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
op_engine-0.1.0.tar.gz -
Subject digest:
1c3d912bfae0227733d7c286e1e0276c3e6e0e0872ebd56be916dbdaae6b4a36 - Sigstore transparency entry: 1393470576
- Sigstore integration time:
-
Permalink:
ACCIDDA/op_engine@ea7e8b0d244b8e8f1821049029c0fc1963b7eb76 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ACCIDDA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ea7e8b0d244b8e8f1821049029c0fc1963b7eb76 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a8f489255dd5520aa80af4dd9eb2a5a040bed64d560cbf75dd8371adfb152e
|
|
| MD5 |
a70b6d6372b85d919102fa8907c3c485
|
|
| BLAKE2b-256 |
30be8e019ed2de5d32c1221f8a5e4e3f6ec03a32681a074fc86ed5b8489d756f
|
Provenance
The following attestation bundles were made for op_engine-0.1.0-py3-none-any.whl:
Publisher:
release.yaml on ACCIDDA/op_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
op_engine-0.1.0-py3-none-any.whl -
Subject digest:
00a8f489255dd5520aa80af4dd9eb2a5a040bed64d560cbf75dd8371adfb152e - Sigstore transparency entry: 1393470581
- Sigstore integration time:
-
Permalink:
ACCIDDA/op_engine@ea7e8b0d244b8e8f1821049029c0fc1963b7eb76 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ACCIDDA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ea7e8b0d244b8e8f1821049029c0fc1963b7eb76 -
Trigger Event:
workflow_dispatch
-
Statement type: