JuliaStellarDynamics / OrbitalElements.jl

Compute orbital elements using Julia.
6 stars 2 forks source link

Bug in extremising frequency values for ILR #13

Closed michael-petersen closed 3 months ago

michael-petersen commented 3 months ago

For ILR (a unique resonance!) the extremising of frequencies seems to be returning the boundary value.

MWE:

using OrbitalElements

# set up the model
model = PlummerPotential()

# set up the resonance
n1,n2 = -1,2

ωmin,ωmax = OrbitalElements.frequency_extrema(-1,2,model)
# (0.0, 5.0e-13)
# hmmm, these values are suspiciously small. dig deeper manually...

# define the circular frequency curve
ωncirc(x::Float64)::Float64 = OrbitalElements._αcircular(x, model) * (n1 + n2 * OrbitalElements._βcircular(x, model))

xext =OrbitalElements._extremise_noedges(ωncirc, 0.,1.e8)
# where 1.e8 is the code default boundary. This returns the value of ωncirc at the boundary (i.e. 1.e8)

ωncirc(xext)
ωncirc(1.e8)
# 5.0e-13

Possibly something in the _extremise_noedges code?

MathieuRoule commented 3 months ago

Good catch ! Was an issue with _bisection (warn function unknown), but was caught in a try/catch statement in _extremise_noedges. Removed the warn and the try/catch. Should avoid try/catch in the future.