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

User defined termination condition #965

Open
axla-io opened this issue Apr 6, 2023 · 4 comments
Open

User defined termination condition #965

axla-io opened this issue Apr 6, 2023 · 4 comments

Comments

@axla-io
Copy link

axla-io commented Apr 6, 2023

Hi, how can I define my own termination condition with the current API?
It doesn't look like it's possible but I might be wrong...

For instance, I'd like the solver to terminate when a certain energy is below a tolerance or only check a subset of the state vector.

@ChrisRackauckas
Copy link
Member

@avik-pal I don't think there is a way to give an arbitrary function in the new termination conditions?

@axla-io
Copy link
Author

axla-io commented Apr 22, 2023

Alright. If I'd like to add this, two options come to mind:

  1. Changing the callback handling so that the solve function checks if a user defined TerminateSteadyState callback is passed as an argument. If yes, use it. If not, use the one from the alg .
  2. Adding a dispatch to _has_converged for a custom termination mode

I think option 1 might be easier to implement, but would maybe not be so consistent with the API? If you think it's an alright idea, I would know how to write up a PR for option 1.

@axla-io
Copy link
Author

axla-io commented Apr 27, 2023

But I don't know if adding this would have any benefits over just using ODEProblem with infinite timespan and a TerminateSteadyState condition...

@ChrisRackauckas
Copy link
Member

I think it's reasonable to allow for a function form in the new termination conditions. See https://docs.sciml.ai/NonlinearSolve/stable/basics/TerminationCondition/ . But they are much more comprehensive now, so do try and see if the new conditions better suit your problem.

@avik-pal avik-pal transferred this issue from SciML/SteadyStateDiffEq.jl Nov 16, 2023
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

No branches or pull requests

2 participants