Skip to content

Conversation

YingboMa
Copy link
Member

Before:

julia> prob.f(du, prob.u0, prob.p, 0.0)
ERROR: DomainError with -1.0:
log will only return a complex result if called with a complex argument. Try log(Complex(x)).

a DomainError only throws with numeric information, which is not very helpful.

With debug_system, we get a symbolic aware error message.

julia> sys = debug_system(sys);

julia> prob = ODEProblem(sys, [], (0, 1.0));

julia> du = zero(prob.u0);

julia> prob.f(du, prob.u0, prob.p, 0.0)
ERROR: DomainError with (-1.0,):
log errors with input(s): -cos(Q(t)) => -1.0
Stacktrace:
  [1] (::ModelingToolkit.LoggedFun{typeof(log)})(args::Float64)
  ...

@YingboMa YingboMa merged commit 422c653 into master Sep 30, 2022
@YingboMa YingboMa deleted the myb/debugging branch September 30, 2022 00:25
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.

1 participant