ClusterMonteCarlo / CMC-COSMIC

14 stars 19 forks source link

cmc_bhlosscone orbital period error handling #49

Closed tomas-cabrera closed 9 months ago

tomas-cabrera commented 1 year ago

The gsl integration of the orbital period in the loss cone physics fails with a nondescript gsl error occasionally (occasionally: first discovered when trying to integrate a King-profiled cluster with 1e6 stars and a central black hole of 1e5 Msun; error occurred at 0.016 Gyr/timestep 4728). This commit implements error handling that returns the approximate orbital period (Porbapprox) when integration fails.

Also during the orbital period calculation the code frequently calculates imaginary velocities at peri-/apocenter, as noted previously in 85ea13f6a90d74093b70b11a4ac08d23914bc723 and 42ea4ba74e2dae03fd9df8d95a5fc4ccd8a1f2c5 ("frequently" here means almost all the time). Whether this is connected to the integration error mentioned above is unknown, as this imaginary velocity problem starts from the first timestep, while it takes a while for the integration error to be encountered.