Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MaxNumSub return code #876

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.65.1"
version = "2.66.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
1 change: 1 addition & 0 deletions docs/src/interfaces/Solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ SciMLBase.ReturnCode.Success
SciMLBase.ReturnCode.Terminated
SciMLBase.ReturnCode.DtNaN
SciMLBase.ReturnCode.MaxIters
SciMLBase.ReturnCode.MaxNumSub
SciMLBase.ReturnCode.DtLessThanMin
SciMLBase.ReturnCode.Unstable
SciMLBase.ReturnCode.InitialFailure
Expand Down
22 changes: 22 additions & 0 deletions src/retcodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@ EnumX.@enumx ReturnCode begin
"""
MaxIters

"""
ReturnCode.MaxNumSub

A failure exit state of the solver. If this return code is given, then the
solving process was unsuccessful and exited early because during the solver's
adaptivity, mesh length exceeded the `max_num_subintervals` either set by default or specified
by users in the solver.

## Common Reasons for Seeing this Return Code

- This commonly occurs in BVP solving if the original mesh are too coarse or
the tolerance are too stringent. It is recommended that in such cases, one tries to increase the default `max_num_subintervals`
Comment on lines +155 to +163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this maxiters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, MaxIters is used for the exit because the default iteration number exceeded, say, number of Newton iterations, but for cases when solving ill-conditioned problems with adaptivity(we redistribute or halve the mesh), the mesh would become so large that we need to warn users instead of just throw Failure. Although the reasons for MaxIters and MaxNumSub are similar, tolerance is stringent or nonstiff solvers on stiff problems, etc, I believe these failure statuses are two different things.

in solvers, or decrease the tolerance.

## Properties

- `successful_retcode` = `false`
"""
MaxNumSub

"""
ReturnCode.DtLessThanMin

Expand Down Expand Up @@ -417,6 +437,8 @@ function Base.convert(::Type{ReturnCode.T}, retcode::Symbol)
ReturnCode.Terminated
elseif retcode == :MaxIters || retcode == :MAXITERS_EXCEED
ReturnCode.MaxIters
elseif retcode == :MaxNumSub
ReturnCode.MaxNumSub
elseif retcode == :MaxTime || retcode == :TIME_LIMIT
ReturnCode.MaxTime
elseif retcode == :DtLessThanMin
Expand Down
Loading