Detecting warnings in ODE system during solving

I do scanning in a big number of parameters in a system of ODEs to detect possible warnings during solving by changing one parameter value at a time (increase and/or decrease by some orders of magnitude). I would like to do it in a more automatic way. How could I extract a warning in an if statement in order to mark the variable that happened?

@test_warn, though what you’re really looking for is to check the return code, i.e. sol.retcode which returns a code that describes why it failed. See:

if successful_retcode(sol.retcode) ... is a way to branch on whether the solver successfully exited or not.

1 Like

Thank you Chris!