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

Does heyoka support external dynamic input of the ODE system? #417

Open
gaowutong opened this issue May 11, 2024 · 1 comment
Open

Does heyoka support external dynamic input of the ODE system? #417

gaowutong opened this issue May 11, 2024 · 1 comment

Comments

@gaowutong
Copy link

Hello and thanks for this great project!

I notice that heyoka supports runtime parameters in its expression system. But what if the parameters has different values at different time steps? How can I handle this?

This is common in many cases. A particular scenario is propagating It requires to read planeteary ephemeris data and get the position of some planets at each time step to compute their perturbations. But it seems heyoka compiles the expression at the beginning and does not allow to change it during integration.

@bluescarni
Copy link
Owner

Hi @gaowutong

You can change the values in the parameters array at any time you want. The parameters array is accessible from a taylor_adaptive object via member functions such as get_pars() (for read-only access), get_pars_data() (for read-write access) and others, see here:

https://github.com/bluescarni/heyoka/blob/master/include/heyoka/taylor.hpp#L549

For instance, you can change the values in the parameters array at the end of each timestep via a step callback, explained here:

https://bluescarni.github.io/heyoka/tut_adaptive.html#time-limited-propagation

Another option is to use the event detection system - specifically, a terminal event which stops the integration whenever you need to change the parameters' values via an event callback:

https://bluescarni.github.io/heyoka/tut_events.html#terminal-events

Please let me know if you need further help/explanations.

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