Skip to content

Update Van der Pol test implementations for DiffEqProblemLibrary.jl PR #153#2807

Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:update-tests-for-diffeqproblemlibrary-153
Aug 3, 2025
Merged

Update Van der Pol test implementations for DiffEqProblemLibrary.jl PR #153#2807
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:update-tests-for-diffeqproblemlibrary-153

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

This PR updates two test files that are broken by DiffEqProblemLibrary.jl PR #153, which removes ModelingToolkit dependency by converting symbolic ODE problems to direct function implementations.

Problem

DiffEqProblemLibrary.jl PR #153 breaks tests that access prob_ode_vanderpol.f.sys because the new implementation uses direct ODE functions instead of ModelingToolkit symbolic systems.

Broken files:

  • /test/interface/stiffness_detection_test.jl (lines 5-6)
  • /lib/OrdinaryDiffEqFIRK/test/ode_firk_tests.jl (line 47)

Solution

Replace ModelingToolkit system access with explicit Van der Pol function implementations using the same variable ordering as the new ODEProblemLibrary implementation.

Variable Ordering Analysis

The new ODEProblemLibrary implementation uses:

function vanderpol(du, u, p, t)
    x = u[1]  # x is first component
    y = u[2]  # y is second component  
    μ = p[1]  # μ is first parameter
    du[1] = y                      # dx/dt = y
    du[2] = μ * ((1 - x^2) * y - x) # dy/dt = μ * ((1 - x^2) * y - x)
end
prob_ode_vanderpol = ODEProblem(vanderpol, [sqrt(3), 0.0], (0.0, 1.0), [1.0])

Changes Made

1. test/interface/stiffness_detection_test.jl

  • Before: sys = prob_ode_vanderpol.f.sys; prob1 = ODEProblem(sys, [sys.y => 0, sys.x => 2.0, sys.μ => inv(0.003)], (0.0, 6))
  • After: Explicit Van der Pol function with [x, y] = [2.0, 0.0] ordering

2. lib/OrdinaryDiffEqFIRK/test/ode_firk_tests.jl

  • Before: sys = prob_ode_vanderpol.f.sys; vanstiff = ODEProblem{iip}(sys, [sys.y => 0, sys.x => sqrt(3), sys.μ => 1e6], (0.0, 1.0))
  • After: Explicit Van der Pol function with [x, y] = [sqrt(3), 0.0] ordering

Verification

Mathematical consistency: All implementations produce identical results
Variable ordering: Matches new ODEProblemLibrary exactly (u[1] = x, u[2] = y, p[1] = μ)
Initial conditions preserved:

  • Stiffness test: [x, y] = [2.0, 0.0] (was [sys.x => 2.0, sys.y => 0])
  • FIRK test: [x, y] = [sqrt(3), 0.0] (was [sys.x => sqrt(3), sys.y => 0])
    Parameters preserved: Same μ values used
    Equations preserved: dx/dt = y, dy/dt = μ((1-x²)y-x)

Test Plan

  • Verify all modified functions produce identical mathematical results
  • Confirm variable ordering matches source implementation
  • Test both in-place and out-of-place function variants
  • Validate initial conditions map correctly from symbolic to explicit form
  • Run affected test suites to ensure no regressions

Impact

This change ensures OrdinaryDiffEq.jl tests continue working when DiffEqProblemLibrary.jl PR #153 is merged, maintaining test coverage while removing the ModelingToolkit dependency as intended.

🤖 Generated with Claude Code

…SciML#153

DiffEqProblemLibrary.jl PR SciML#153 removes ModelingToolkit dependency by converting
symbolic ODE problems to direct function implementations. This breaks two test
files that relied on accessing the ModelingToolkit system via prob_ode_vanderpol.f.sys.

Changes made:
- test/interface/stiffness_detection_test.jl: Replace ModelingToolkit system access
  with explicit Van der Pol function implementations using correct variable ordering
- lib/OrdinaryDiffEqFIRK/test/ode_firk_tests.jl: Replace sys access with explicit
  Van der Pol function using same ordering as new ODEProblemLibrary implementation

Variable ordering maintained: u[1] = x, u[2] = y, p[1] = μ
Equations preserved: dx/dt = y, dy/dt = μ((1-x²)y-x)
Initial conditions preserved:
- Stiffness test: [x, y] = [2.0, 0.0] (was [sys.x => 2.0, sys.y => 0])
- FIRK test: [x, y] = [sqrt(3), 0.0] (was [sys.x => sqrt(3), sys.y => 0])

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

Co-Authored-By: Claude <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 73ba237 into SciML:master Aug 3, 2025
173 of 189 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