Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

  • Add a function stub in ModelingToolkitBase that throws a helpful error when nlstep=true is used without ModelingToolkit loaded
  • ModelingToolkit overrides this stub with the actual implementation via MTKBase.generate_ODENLStepData

Problem

When calling ODEProblem(sys, u0, tspan, p; nlstep=true), the code fails with:

UndefVarError: `generate_ODENLStepData` not defined in `ModelingToolkitBase`

This happens because:

  1. generate_ODENLStepData is defined in ModelingToolkit/src/systems/solver_nlprob.jl
  2. But it's called from ModelingToolkitBase/src/problems/odeproblem.jl:46
  3. The function isn't available in the ModelingToolkitBase module scope

Solution

  1. Add a stub function in ModelingToolkitBase that throws a helpful error message
  2. Have ModelingToolkit override the stub by defining MTKBase.generate_ODENLStepData

Test plan

  • Verified nlstep=true works when ModelingToolkit is loaded
  • Verified helpful error message appears when only ModelingToolkitBase is used

🤖 Generated with Claude Code

Add a function stub in ModelingToolkitBase that throws a helpful error
message when `nlstep=true` is used without ModelingToolkit loaded.
ModelingToolkit then overrides this stub with the actual implementation.

This fixes the issue where calling `ODEProblem(sys, u0, tspan, p; nlstep=true)`
would fail with `UndefVarError: generate_ODENLStepData not defined` because
the function was defined in ModelingToolkit but called from ModelingToolkitBase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ChrisRackauckas-Claude ChrisRackauckas-Claude force-pushed the fix-nlstep-generate_ODENLStepData-stub branch from a6257ed to 4f4bb9b Compare December 27, 2025 17:06
@ChrisRackauckas ChrisRackauckas merged commit 63587ff into SciML:master Dec 28, 2025
33 of 68 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