Hi guys,
I am wrapping up a script to solve the TOV equation, similar to the TOVsolver_Julia, and I used ‘CommonSolve’ and ‘DifferentialEquations’ packages. In the solver, unlike the case in TOVsolver_Julia, I used callbacks to terminate the integration when P<0
condition(u, t, integrator) = u[1] < 0
affect!(integrator) = terminate!(integrator)
cb = DiscreteCallback(condition, affect!)
and applied Tsit5 and DP5 (the same as TOVsolver_Julia). However, I found some unsmooth results that did not occur in my hand-crafted RK4 method in the mass-radius curves for different initial conditions for the density at r=0,
Using solve in CommonSolve
In addition, I found out that in some cases, the integration becomes unstable, and a warning pops up for both Tsit5 and DP5 algorithms.
> Warning: Verbosity toggle: dt_epsilon
> │ At t= 9656.595735553243, dt was forced below floating point epsilon 1.8189894035458565e-12. Aborting. There is either an error in your model specification or the true solution is unstable (or the true solution can not be represented in the precision of Float64.
> └ @ SciMLBase ~/.julia/packages/SciMLBase/TKP6E/src/integrator_interface.jl:736
Does anyone know if there is a better approach for this type of differential equation?
