Motivation
Companion to ACCIDDA/op_system#156.
Currently flepimop2-op_engine retrieves operator specs from system.option("operators", None) as an untyped dict and has to reverse-engineer the model axis structure before calling build_crank_nicolson_operator. There is no enforced contract between what op_system produces and what this adapter expects.
Proposal
Once ACCIDDA/op_system#156 lands a typed OperatorDescriptor dataclass in op_system's public API, update the flepimop2-op_engine adapter to:
- Read
system.option("operators") as tuple[OperatorDescriptor, ...] rather than an opaque dict.
- Build CN (L, R) matrices from the typed descriptor fields:
for desc in system.option("operators", ()):
L, R = build_crank_nicolson_operator(desc.geometry, desc.coefficient, dt)
- Drop any internal parsing/coercion logic (
_coerce_operator_specs) that currently normalises the untyped option.
What stays in op_engine
build_crank_nicolson_operator(geom, cfg, dt) — CN matrix construction at solve time (depends on dt, which is solver-side)
StageOperatorFactory and per-step factory calls for adaptive / TR-BDF2 schemes
- LU factorisation caching in
implicit_solve
All of this remains entirely correct. Only the source of the operator geometry changes from an untyped option to a typed descriptor.
Scope
- Update
OpEngineFlepimop2Engine in flepimop2-op_engine/src/flepimop2/engine/op_engine/__init__.py
- Remove or simplify
_coerce_operator_specs
- Add a type annotation / isinstance guard on the incoming option value
- Update tests in
flepimop2-op_engine to pass OperatorDescriptor instances
Dependency
Blocked on ACCIDDA/op_system#156.
Motivation
Companion to ACCIDDA/op_system#156.
Currently
flepimop2-op_engineretrieves operator specs fromsystem.option("operators", None)as an untyped dict and has to reverse-engineer the model axis structure before callingbuild_crank_nicolson_operator. There is no enforced contract between what op_system produces and what this adapter expects.Proposal
Once ACCIDDA/op_system#156 lands a typed
OperatorDescriptordataclass in op_system's public API, update theflepimop2-op_engineadapter to:system.option("operators")astuple[OperatorDescriptor, ...]rather than an opaque dict._coerce_operator_specs) that currently normalises the untyped option.What stays in op_engine
build_crank_nicolson_operator(geom, cfg, dt)— CN matrix construction at solve time (depends ondt, which is solver-side)StageOperatorFactoryand per-step factory calls for adaptive / TR-BDF2 schemesimplicit_solveAll of this remains entirely correct. Only the source of the operator geometry changes from an untyped option to a typed descriptor.
Scope
OpEngineFlepimop2Engineinflepimop2-op_engine/src/flepimop2/engine/op_engine/__init__.py_coerce_operator_specsflepimop2-op_engineto passOperatorDescriptorinstancesDependency
Blocked on ACCIDDA/op_system#156.