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

My ODE peoblems is always Aborting Help!!! #992

Closed
HaoJieZhang0917 opened this issue Oct 24, 2023 · 13 comments
Closed

My ODE peoblems is always Aborting Help!!! #992

HaoJieZhang0917 opened this issue Oct 24, 2023 · 13 comments

Comments

@HaoJieZhang0917
Copy link

I'm trying to calculate a second-order ordinary BVP differential equation problem, but no matter which method I use, my results always show divergence. But I don't know what the problem with my model or boundary conditions is. Is there a professional who can help me?

The equation is :
ddu=u^2-v^2+du*w
ddv=2uv+dv*w
dw=-2*u
image

My code is :
` using DifferentialEquations

function Onedisk_BasicFlow_Eqution(du,u,p,t)
    #u[1,2,3,4,5]=[u,v,w,u',v']
    du[1]=u[4]
    du[2]=u[5]
    du[3]=-2.0*u[1]
    du[4]=u[1]*u[1]-u[2]^2 +u[4]*u[3]
    du[5]=2.0*u[1]*u[2] +u[5]*u[3]
end
function Onedisk_BasicFlow_bc(residual,u,p,t)
    residual[1]=u[1][1]
    residual[2]=u[1][2]-1
    residual[3]=u[1][3]
    residual[4]=u[end][1]
    residual[5]=u[end][2]
end
u0=[0,0,0,0,0]
tspan=[0.0,5.0]
Onedisk_BasicFlow = BVProblem(Onedisk_BasicFlow_Eqution,Onedisk_BasicFlow_bc,[0,1,1.2,0,0], tspan)
prob=Onedisk_BasicFlow
sol=solve(prob,Rosenbrock23(),abstol = 1e-10, reltol = 1e-10)`
@ChrisRackauckas
Copy link
Member

That's a boundary value problem. You gave it an ODE solver, not a BVP solver. That doesn't make sense. See the tutorial on BVPs: https://docs.sciml.ai/DiffEqDocs/stable/tutorials/bvp_example/. You need to use a solver for BVPs, like Shooting(Rosenbrock23()).

@HaoJieZhang0917
Copy link
Author

HaoJieZhang0917 commented Oct 24, 2023

That's a boundary value problem. You gave it an ODE solver, not a BVP solver. That doesn't make sense. See the tutorial on BVPs: https://docs.sciml.ai/DiffEqDocs/stable/tutorials/bvp_example/. You need to use a solver for BVPs, like Shooting(Rosenbrock23()).

Thanks for the reply.Before this, I have used the Shooting(Vern8()) method to solve the BVP problem, but the results are still aborting, I think there may be a problem with my model settings and boundary condition settings, but I don't know where the problem is.

@ChrisRackauckas
Copy link
Member

What is the error message or warning? Is the model stiff? You show a stiff ODE solver earlier, but now you're showing a method only for non-stiff equations.

@ErikQQY
Copy link
Member

ErikQQY commented Oct 24, 2023

I tested this problem on the latest version of BoundaryValueDiffEq.jl:

  • Single Shooting: warning dt<=dtmin, Failure retcode
  • Multiple Shooting: warning dt<=dtmin, Successful retcode
  • MIRK methods: no warning, Successful retcode

Final solution:

temporal

@HaoJieZhang0917
Copy link
Author

I tested this problem on the latest version of BoundaryValueDiffEq.jl:

  • Single Shooting: warning dt<=dtmin, Failure retcode
  • Multiple Shooting: warning dt<=dtmin, Successful retcode
  • MIRK methods: no warning, Successful retcode

Final solution:

temporal

yes, it is the right result.I have caculated out by python.But when i use julia,it takes a very long time to use MIRK method,so i just use the shooting .I do not know the reason why it is useless for shooting- _ -

@HaoJieZhang0917
Copy link
Author

What is the error message or warning? Is the model stiff? You show a stiff ODE solver earlier, but now you're showing a method only for non-stiff equations.

sorry, the model is stiff . Just like the next follower shows , it can be solved by MIRK method , but not for shooting

@HaoJieZhang0917
Copy link
Author

I tested this problem on the latest version of BoundaryValueDiffEq.jl:

  • Single Shooting: warning dt<=dtmin, Failure retcode
  • Multiple Shooting: warning dt<=dtmin, Successful retcode
  • MIRK methods: no warning, Successful retcode

Final solution:

temporal

How long it takes by using MIRK method?

@ChrisRackauckas
Copy link
Member

orry, the model is stiff . Just like the next follower shows , it can be solved by MIRK method , but not for shooting

Yes that's expected. Shooting methods are not as stable as collocation methods, and so for sufficiently difficult problems it will be only the MIRK and similar methods that are stable.

@HaoJieZhang0917
Copy link
Author

orry, the model is stiff . Just like the next follower shows , it can be solved by MIRK method , but not for shooting

Yes that's expected. Shooting methods are not as stable as collocation methods, and so for sufficiently difficult problems it will be only the MIRK and similar methods that are stable.

Thank you for your help!

@ErikQQY
Copy link
Member

ErikQQY commented Oct 24, 2023

But when i use julia,it takes a very long time to use MIRK method,so i just use the shooting .I do not know the reason why it is useless for shooting- _ -

Could you show the version of BoundaryValueDiffEq.jl you are using? It is pretty fast here to get the final result using MIRK methods. @HaoJieZhang0917

@HaoJieZhang0917
Copy link
Author

orry, the model is stiff . Just like the next follower shows , it can be solved by MIRK method , but not for shooting

Yes that's expected. Shooting methods are not as stable as collocation methods, and so for sufficiently difficult problems it will be only the MIRK and similar methods that are stable.

i have another question , can the parameter tspan be set to a non-equidistant mesh?similar to the Chebyshev method.

@HaoJieZhang0917
Copy link
Author

But when i use julia,it takes a very long time to use MIRK method,so i just use the shooting .I do not know the reason why it is useless for shooting- _ -

Could you show the version of BoundaryValueDiffEq.jl you are using? It is pretty fast here to get the final result using MIRK methods. @HaoJieZhang0917

The verson of BoundaryValueDiffEq.jl is v4.0.1 . I almost need 15 mins to caculate it through i have setted the dt=0.5...

@ChrisRackauckas
Copy link
Member

That compile time is fixed with Julia v1.1.0.

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

3 participants