Skip to content

Document unbound_inputs as the fallback for discovering an input - #5090

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:unbound-inputs-fallback
Sep 7, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:unbound-inputs-fallback

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

What changed and why

#5087 tells you to name the input variable
to mtkcompile, which assumes you already know which variable carries the external signal.
For a model you did not build, or one assembled programmatically, that is exactly the part
you are missing. unbound_inputs reports the input variables the connection structure
leaves external, and its result can be passed straight to mtkcompile:

unbound_inputs(model)                              # [force₊f₊u(t)]
sys = mtkcompile(model; inputs = unbound_inputs(model))

Fifteen lines added to docs/src/examples/interactive_simulation.md, plus unbound_inputs
in that example's import line. No code changes.

Verification

The page uses plain ```julia fences, so Documenter does not execute them. The snippet was
run by hand against ModelingToolkit 11.41.0 and ModelingToolkitStandardLibrary, on the same
mass-spring-damper model the surrounding section already uses:

unbound_inputs(model) = [force₊f₊u(t)]
VERIFIED via unbound_inputs: t=4.0 s=0.08628 saved=81 retcode=Success

so the discovered name compiles, drives through integrator.ps[...] and step!, and the
solve completes.

typos clean.

What I did not verify, and one thing a reviewer should weigh

I did not get a clean full docs build for this branch. My local run hit pre-existing
failures in docs/src/tutorials/bifurcation_diagram_computation.md, an unrelated page, so I
stopped it. This PR touches one markdown file and adds no executed block, but CI is the real
check here.

More importantly — this describes behaviour that
#5089 changes.
As of current master,
unbound_inputs returns [force₊f₊u(t)] for this model, so the page is accurate today.
#5089 makes namespace nesting segment-aware, and with it this same call returns [],
because the Force case works on master only through a string-prefix collision
("force₊flange" vs "force₊f"). The underlying semantics question is tracked in
#5088.

So this page and #5089 must not land independently: if #5089 merges first, this section
needs rewriting to whatever discovery mechanism replaces it, and if this merges first the
docs go stale the moment #5089 does. Sequencing is the reviewer's call — I am opening it now
on request rather than holding it behind #5088 as I had originally planned.


This PR should be ignored until reviewed by @ChrisRackauckas.

🤖 Generated with Claude Code

https://claude.ai/code/session_019wKpyZHy9u4QhR4ePiVmam

The interactive-integrator page tells you to name the input variable to
`mtkcompile`, which assumes you know which variable carries the external signal.
For a model you did not build, or one assembled programmatically, that is the
part you are missing. `unbound_inputs` reports the input variables the
connection structure leaves external, and its result can be passed straight to
`mtkcompile`.

Follow-up to SciML#5087.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019wKpyZHy9u4QhR4ePiVmam
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 7, 2026 09:43
@ChrisRackauckas
ChrisRackauckas merged commit fd27659 into SciML:master Sep 7, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants