Get Non-negative ODE solution?

Is there any Mathematica option equivalent to “Nonnegative” in “odeset” in Matlab?

Here is the documentation about the function I’m talking about:

https://www.mathworks.com/help/matlab/math/nonnegative-ode-solution.html

I think it’s a very useful function and it’d be nice to have something similar in Mathematica.

Thanks in advance!

You may try with WhenEvent. For example, this gives a solution which becomes negative:

NDSolveValue[{y'[x] == Sqrt[Abs[y[x]]], y[1] == 1}, y, {x, -5, 3}]

but we can pick the nonnegative solution with this:

NDSolveValue[{y'[x] == Sqrt[Abs[y[x]]], y[1] == 1,
  WhenEvent[y[x] < 0, y[x] -> 0]},
 y, {x, -5, 1}]

Thanks for your answer!

Could this technique be applied to a vector variable?