hannorein / rebound

💫 An open-source multi-purpose N-body code.
https://rebound.readthedocs.io/
GNU General Public License v3.0
844 stars 219 forks source link

Soft sphere implementation #770

Closed Francyrad closed 4 months ago

Francyrad commented 5 months ago

Describe what feature you would like to see added to REBOUND.

It would be wonderfull to implement soft sphere in Rebound according to the following paper:

https://academic.oup.com/mnras/article/513/4/4711/6575940

Soft sphere is also been implemented in the N-Body simulator OpenSPH and I've been able to reproduce hard-sphere simulations, but within hours instead of months (moon formation simulations)

After implementing it in background, it may be added to the simulation like this:

double coefficient_of_restitution_constant(const struct reb_simulation* const r, double v){
    // v is the normal impact velocity.
    // Here, we just use a constant coefficient of restitution
    return 0.5;
}
struct reb_simulation* r = reb_simulation_create();
r->collision = REB_COLLISION_DIRECT;
r->coefficient_of_restitution = coefficient_of_restitution_constant;
r->collision_resolve = reb_collision_resolve_softsphere;`

And someother string to implement the spring constant

Thank you in advance, it would be an amazing implementation for rebound Francesco

hannorein commented 4 months ago

Sorry, I don't understand what feature you'd like to have added to REBOUND. You're referring to an MNRAS article that implements a soft sphere model for REBOUND? Is that what you'd like to see? If so I'd suggest you contact the authors of that paper.

Francyrad commented 4 months ago

Yes, that's what i mean, but no answer so far :(

hannorein commented 4 months ago

That's unfortunate. I don't think I can help out here. I'm not going to implement this myself. I suggest you keep pushing the original authors to share their code.