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

Question about the Cvode(cvode_mem, tout, y0, &t, CV_NORMAL) command #354

Open
jianqixi opened this issue Apr 21, 2022 · 4 comments
Open

Comments

@jianqixi
Copy link

Dear All,

I have one question about the CVode solver. In my current code, I have used Cvode(cvode_mem, tout, y0, &t, CV_NORMAL) to solve my ODE function, f, but it seems like the solver has been trapped in a cycle. It always calls the ODE function, f, (I defined one "hello" output in function f if the function is called), but the solver does not get the solution. Does it mean the solver is trapped in the internal step? What is the solver doing in the cycle, does it updates the step size?

To check whether the solver is trapped in the internal step, I tried to artificially terminate the cycle by using CVodeSetMaxNumSteps(cvode_mem, mxsteps=3), but it still doesn't work, the solver still calls the ODE function, f, multiple times. So now I am a little bit confusing, if the solver is trapped in the internal step, why after I define the max step =3, does it still go inside the ODE function multiple times? Thank you for your answers.

@ChrisRackauckas ChrisRackauckas transferred this issue from SciML/DifferentialEquations.jl Apr 22, 2022
@ChrisRackauckas
Copy link
Member

This is a Sundials direct interface issue. I would say, the simplest thing to do is just use the common interface, or look at the common interface's implementation. We don't generally give support for the direct interface.

@jianqixi
Copy link
Author

Thank you for your response. Would you like to give me some introductions for the usage of the common interface? Thank you,

@ChrisRackauckas
Copy link
Member

https://github.com/SciML/Sundials.jl#common-interface-api
https://diffeq.sciml.ai/stable/tutorials/faster_ode_example/
https://diffeq.sciml.ai/stable/tutorials/advanced_ode_example/

etc.

To check whether the solver is trapped in the internal step, I tried to artificially terminate the cycle by using CVodeSetMaxNumSteps(cvode_mem, mxsteps=3), but it still doesn't work, the solver still calls the ODE function, f, multiple times.

My guess is that it's part of the Jacobian or nonlinear solver iterations, both of it which sounds like you didn't have a maximum on.

@jianqixi
Copy link
Author

Thank you very much for your information. I will try to transfer the interface in the code. Thank you,

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