SciML / ModelingToolkit.jl

An acausal modeling framework for automatically parallelized scientific machine learning (SciML) in Julia. A computer algebra system for integrated symbolics for physics-informed machine learning and automated transformations of differential equations
https://mtk.sciml.ai/dev/
Other
1.41k stars 204 forks source link

fix: fix initialization with defaults dependent on indepvar #2820

Closed AayushSabharwal closed 1 month ago

AayushSabharwal commented 3 months ago

Close #2799

Checklist

Additional context

Add any other context about the problem here.

hersle commented 1 month ago

I think the only problem is that t should not be substituted for DDEs. Same as in https://github.com/SciML/ModelingToolkit.jl/pull/2877.

AayushSabharwal commented 1 month ago

Thank you! I never would've found that

AayushSabharwal commented 1 month ago

Is there any way to check if an ODESystem represents a DDE?

hersle commented 1 month ago

From what I understand in test/dde.jl, it is not possible to tell at the system level; only the problem level (since DDE systems are ODESystems, but DDE problems are DDEProblems).

Maybe process_DEProblem(constructor, ...; symbolic_u0, ...) could check if constructor isa DDEFunction || constructor isa SDDEFunction, and if so pass t0 = nothing to get_u0*()? Alternatively, it looks to me like symbolic_u0 = true is passed if (and only if) the system/problem is a (S)DDE, so maybe it could check if symbolic_u0 instead?

hersle commented 1 month ago

Nice. This looks good now?