Debugging models
When your model exits with a message like so:
: The model exited at model time 2024-01-27T14:46:17.791 with return code Unstable. See https://docs.sciml.ai/DiffEqDocs/stable/basics/solution/#retcodes ┌ Error
it’s best to rerun the model with saveat = 0
in the solver settings. The model might then instead exit with
: Too large water balance error
┌ Error= Basin #2
│ id = 0.0017985748886167501
│ balance_error = 1.3503344464431657 │ relative_error
which helps you pin down the problematic node(s). The normal output for every calculation timestep is written until the moment of error, so one can use this information to understand the problem.