Skip to content

Broken amount of parameters: much more parameters in resulting ODEProblem than symbolic parameters in MTK system #3444

@Datseris

Description

@Datseris

Describe the bug 🐞

I just updated my MTK version and I find an incredible odd behavior. The number of parameters in the MTK model that generates the ODE Problem is much less than the parameters in the ODE Problem itself.

I have

julia> prob
ODEProblem with uType SVector{5, Float64} and tType Float64. In-place: false
Initialization status: FULLY_DETERMINED
Non-trivial mass matrix: false
timespan: (0.0, Inf)
u0: 5-element SVector{5, Float64} with indices SOneTo(5):
  290.0
    1.0
 1200.0
  290.0
   11.0

All of my parameters are real numbers so by default they become "tunable", and I have:

julia> prob.p.tunable
79-element Vector{Float64}:
 1.0
 0.38
 0.0012
 1.0
 5.0
 0.3
 0.2
 0.0
 ⋮

This is much more than the actual parameters of my model. Indeed, If I check the symbolic parameters in the MTK System I get

julia> mtk = prob.f.sys
Model CTBBL:
Equations (5):
  5 standard: see equations(CTBBL)
Unknowns (5): see unknowns(CTBBL)
  SST(t) [defaults to 290.0]: SCT sea surface temperature
  C(t) [defaults to 1.0]: cloud fraction
  z_b(t) [defaults to 1200.0]: height of the cloud top = top of the boundary layer = at inversion, m
  s_b(t) [defaults to 290.0]: liquid water static energy of boundary layer, K (cₚ units)
  ⋮
Parameters (25): see parameters(CTBBL)
  e_D [defaults to 1.0]: height depression efficiency.
  ⋮

25 parameters is the correct number.

Expected behavior

The number of parameters in the ODE problem should be the same.

There must have been a breaking change because before I updated I didn't have this problem.
Note that I recovered this problem because I build all my models with split = false, so that I do NOT create the specialized MTK container, ecll my parameters are real numbers. Even in that case I have the huge missmatch of 70+ parameters in the created ODEProblem even though my system only has 25.

What was the change that caused this? Is there perhaps a new API way to obtain the "real" parameters of an ODEProb created from an ODESystem?

Minimal Reproducible Example 👇

If you really need a MRE for this, I'll try to make one from scratch. My codebase is now too complicated to modify it into a MRE. But I doubt a MRE is needed, this seems to be a deliberate change.

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
pkg> st -m ModelingToolkit Symbolics SymbolicUtils SymbolicIndexingInterface
Status `...\Manifest.toml`
  [961ee093] ModelingToolkit v9.64.3
  [2efcf032] SymbolicIndexingInterface v0.3.38
  [d1185830] SymbolicUtils v3.16.0
  [0c5d862f] Symbolics v6.29.2
  • Output of versioninfo()

1.10.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions