Skip to content

Expose all CoreSolver methods, extend validate_system(), wire jacobian#51

Merged
jc-macdonald merged 5 commits intomainfrom
feat/41-44-validate-methods
Apr 9, 2026
Merged

Expose all CoreSolver methods, extend validate_system(), wire jacobian#51
jc-macdonald merged 5 commits intomainfrom
feat/41-44-validate-methods

Conversation

@jc-macdonald
Copy link
Copy Markdown
Collaborator

Widens the provider's method palette to all 9 CoreSolver solvers and adds early validation so incompatible engine/system pairings surface at construction time rather than mid-run().

Changes

  • All 9 methods exposedMethodName in config.py now includes implicit-euler, trapezoidal, bdf2, and ros2 alongside the existing 5.
  • validate_system() extended — IMEX method without operators → missing_operators. Implicit/Rosenbrock method without system.option("jacobian")missing_jacobian. Existing state_change check preserved.
  • Jacobian wiring — For implicit methods, run() retrieves the Jacobian callable from system.option("jacobian") and passes it through to RunConfig.
  • py.typed marker added — Enables downstream mypy checking of the provider package.
  • Test mypy cleanupStateChangeEnum literals, OpEngineEngineConfig constructors, narrowed type: ignore comments. All 20 tests pass, ruff + mypy --strict clean.

Related

- config.py: MethodName now includes implicit-euler, trapezoidal, bdf2, ros2
- validate_system(): IMEX + missing operators → missing_operators warning
- validate_system(): implicit/Rosenbrock + missing jacobian → missing_jacobian warning
- Existing state_change check preserved

Refs #41, #44
For implicit-euler, trapezoidal, bdf2, and ros2, the provider now
retrieves the Jacobian callable from system.option('jacobian') and
passes it through to CoreSolver via RunConfig.

Refs #41, #44
- IMEX + missing operators → missing_operators (3 tests)
- implicit/Rosenbrock + missing jacobian → missing_jacobian (4 parametrized)
- implicit + jacobian provided → no warning (4 parametrized)
- explicit methods → no extra issues
- implicit-euler run with system jacobian verifies end-to-end wiring

Refs #41, #44
- Add py.typed marker to provider package
- Use StateChangeEnum.FLOW/DELTA instead of string literals
- Use OpEngineEngineConfig() instead of raw dicts
- Narrow type: ignore[assignment] → type: ignore[method-assign]
@jc-macdonald jc-macdonald added provider flepimop2 provider/connector package enhancement New feature or request labels Apr 9, 2026
@jc-macdonald jc-macdonald added this to the Provider Integration milestone Apr 9, 2026
@jc-macdonald jc-macdonald added the testing Test infrastructure and accuracy benchmarks label Apr 9, 2026
@jc-macdonald jc-macdonald self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Member

@pearsonca pearsonca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor notes only

state_change: StateChangeEnum
config: OpEngineEngineConfig = Field(default_factory=OpEngineEngineConfig)

_IMPLICIT_METHODS: frozenset[str] = frozenset(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like an enum?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also partially matches elements in config.py - feels like these should perhaps be extracted as a marker type rather than tracked as strings

method: Literal["euler", "heun", "imex-euler", "imex-heun-tr", "imex-trbdf2"] = (
"heun"
)
method: Literal[
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see prev note re enum

Copy link
Copy Markdown
Collaborator

@TimothyWillard TimothyWillard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @pearsonca

Base automatically changed from feat/42-49-bind-api to main April 9, 2026 16:01
Address review feedback from @pearsonca: method names are now a
proper StrEnum (SolverMethod) with is_imex/is_implicit properties,
replacing string literals and the _IMPLICIT_METHODS frozenset.

- Add SolverMethod(StrEnum) to config.py with all 9 methods
- Add is_imex and is_implicit properties on enum
- Move _IMPLICIT_METHODS frozenset to config.py module level
- Remove _IMPLICIT_METHODS class variable from engine
- Update all tests to use SolverMethod enum members
- Drop type: ignore[arg-type] from parametrized tests
@jc-macdonald
Copy link
Copy Markdown
Collaborator Author

Agreed — pushed d3884fe replacing the string literals with a SolverMethod(StrEnum) in config.py. It has all 9 methods as members plus is_imex and is_implicit properties, so the consumer code reads method.is_imex / method.is_implicit instead of string checks. The _IMPLICIT_METHODS frozenset moved to module level in config.py as well. Tests updated to use enum members throughout.

@jc-macdonald jc-macdonald merged commit 31a0fab into main Apr 9, 2026
5 checks passed
@jc-macdonald jc-macdonald deleted the feat/41-44-validate-methods branch April 9, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request provider flepimop2 provider/connector package testing Test infrastructure and accuracy benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose all CoreSolver methods in flepimop2 provider config Implement validate_system() in flepimop2 provider

3 participants