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

Parameter t in the function v of ODEProblem is not the current time #148

Closed
LivelyLiz opened this issue Dec 8, 2022 · 3 comments
Closed

Comments

@LivelyLiz
Copy link

Maybe I misunderstand something crucial, but I tried to integrate a time varying ODE and the result is just wrong. When I looked at the value t that I get, it seems to be always the timestep taken, not the total time of the current integration step.

Example:

using GeometricIntegrators

function eo(xdot, t, x, params)
    println(t)
    xdot[1] = x[1]
end

prob = ODEProblem(eo, (0.0, 1.0), 0.1, [3.0])
int = Integrator(prob, TableauRK4())

integrate(prob, int)

prints:

0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
0.0
0.05
0.05
0.1
@michakraus
Copy link
Member

This is curious! From what I can see (a) you are doing everything correctly and (b) there is no obvious issue in the integrator causing this problem. I may have an idea, though. I will investigate this...

@michakraus
Copy link
Member

This is fixed in the master branch for most Runge-Kutta methods (not yet for more special integrators). This was a rather nasty thing. I guess we don't have tests for time-dependent problems...

Please update to master

]add GeometricIntegrators #master

and try again.

@LivelyLiz
Copy link
Author

👍 Looks like it's working now. Thanks for the quick response

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