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

rebx_calculate_energy #37

Closed
hannorein opened this issue Jun 1, 2019 · 3 comments
Closed

rebx_calculate_energy #37

hannorein opened this issue Jun 1, 2019 · 3 comments

Comments

@hannorein
Copy link
Collaborator

There is a convenience function defined on the python side which is msising from c:

rebx.calculate_energy()

@dtamayo
Copy link
Owner

dtamayo commented Jun 2, 2019

Thanks. I removed this in the new version, and have removed it from master for consistency for now. That function was a placeholder for a function meant to automatically calculate the energy based on what effects you've added, but I think requires too much logic and overhead when adding new effects for it to be worth it. At the same time it's probably a useful function. Would love some feedback.

It would need a parallel list of unique effects, forces and operators should have a calculate energy function pointer field. There's also a distinction not only between conservative and dissipative effects, but also between conservative position and velocity dependent ones, because the former just have additive contributions to the potential, but the velocity dependent ones also change the kinetic terms. I guess one could rewrite the velocity dependent energy routines to subtract off the classical energy to just give the updates at the cost of large roundoff errors, or rewrite the routines to only calculate the update (not totally trivial).

@hannorein
Copy link
Collaborator Author

I agree. I think keeping some of the functions that calculate the energy around for some of the simpler effects such as gr potential would be helpful so that one doesn't need to reimplement them every time. But without any logic.

@dtamayo
Copy link
Owner

dtamayo commented Jun 3, 2019

I agree, thanks!

@dtamayo dtamayo closed this as completed Jun 3, 2019
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