Skip to content

RDPK3 family crashes on init: MVector{3, Float64}(::Bool, ::Bool, ::Bool) MethodError in PIDController #3384

@singhharsh1708

Description

@singhharsh1708

Bug Description

The entire RDPK3 solver family (RDPK3Sp35, RDPK3SpFSAL35, RDPK3Sp49, RDPK3SpFSAL49, RDPK3Sp510, RDPK3SpFSAL510) crashes during init with a MethodError when constructing the PIDController.

Minimal Reproducer

using OrdinaryDiffEqLowStorageRK

function f!(du, u, p, t)
    du[1] = -0.5 * u[1]
    du[2] = -1.5 * u[2]
end

prob = ODEProblem(f!, [1.0, 1.0], (0.0, 1.0))
integrator = init(prob, RDPK3Sp35(), dt = 0.1)

Error

MethodError: no method matching MVector{3, Float64}(::Bool, ::Bool, ::Bool)

Root Cause

In OrdinaryDiffEqCore/src/integrators/controllers.jl, the PIDController constructor initializes the error history vector with Bool literals:

# Line 550
err = MVector{3, QT}(true, true, true)

When QT = Float64, newer versions of StaticArrays no longer accept Bool arguments for MVector{3, Float64}. The true literals are Bool, not Float64.

Affected Solvers

All 6 RDPK3 solvers use legacy_default_controller / default_controller which calls PIDController with RDPK3-specific beta coefficients, all hitting this code path:

  • RDPK3Sp35
  • RDPK3SpFSAL35
  • RDPK3Sp49
  • RDPK3SpFSAL49
  • RDPK3Sp510
  • RDPK3SpFSAL510

Proposed Fix

Change line 550 in OrdinaryDiffEqCore/src/integrators/controllers.jl from:

err = MVector{3, QT}(true, true, true)

to:

err = MVector{3, QT}(one(QT), one(QT), one(QT))

This uses one(QT) which is always type-correct (returns 1.0 for Float64, etc.) instead of relying on implicit Bool → QT conversion.

Discovery

Found while adding AllocCheck.jl allocation tests for OrdinaryDiffEqLowStorageRK. All 39 other low-storage RK solvers pass their allocation tests fine; only the RDPK3 family is excluded due to this crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions