VirtualPlanetaryLaboratory / vplanet

The Virtual Planet Simulator
MIT License
135 stars 55 forks source link

Implement the LSODA ODE solver in place of RK4 #186

Open Nicholaswogan opened 3 years ago

Nicholaswogan commented 3 years ago

VPLanet would probably be ~10x faster, and a more flexible if it used a production quality ODE solver. I think LSODA (this is link to C version) is a good option. It automatically detects stiff ODEs, and will switch methods to be as efficient as possible. This would allow VPlanet to implement modules with stiff ODEs, like chemical reactions in the atmosphere. It looks like the POISE module already introduces stiff ODEs, which RK4 has a hard time dealing with.

RoryBarnes commented 3 years ago

Thanks for the suggestion, Nick! The current solver is pretty basic and doesn't handle large disparities in timescales for ODEs, so this method could be a great option for improving speed.