Nonlinear systems and ModelingToolkitStandardLibrary

Much work in thermal/fluid problems involve steady state cases. I have been playing around with NonlinearSolve.jl and it works well. What I’m having trouble is in the integration it with ModelingToolkitStandardLibrary.jl.

I have not been able to use NonlinearSystem instead of ODESystem and I don’t know if this is even possible since the components in ModelingToolkitStandardLibrary.jl extend ODESystem.

If every component has has zero time derivatives, ODESystem and structural_simplify return a nonlinear system of equations as expected (it is a DAE solver after all…) that can be integrated using something like

sys = structural_simplify(model)
prob = ODAEProblem(sys, Pair[], (0, 10.0))
sol = solve(prob, Tsit5())

and the solution will have two time steps: the first and the last (as expected). Is it possible to use NonlinearSystem directly or is this ‘hack’ is the only/best approach?

Thanks
Paulo

1 Like

You can just convert any ODESystem to a NonlinearProblem.