Changed every single number in the code to BigFloat. The result is unchanged.
using DifferentialEquations
using OrdinaryDiffEq
using ODEInterfaceDiffEq
using Plots
using Sundials
using LinearSolve
using BenchmarkTools
using Base.Threads
const θ = BigFloat(1.0e-6)
const Energy=BigFloat(50.0e0)
const Δmsq = BigFloat(2.5e-3*(1.0e6/197.3269631))
const Hvac=(Δmsq/(4.0*Energy))*[[-cos(2.0*θ)+0im, sin(2.0*θ)+0im] [sin(2.0*θ)+0im, cos(2.0*θ)+0im]]
const c = BigFloat(3e5)
const mup = BigFloat(1.0e5)
@time function eoms!(du,u,p,t)
println(t)
AngleBins=p[1]
for i = 1:AngleBins*8
du[i]=BigFloat(0.0e0)
end
Hself0 = zeros(Complex{BigFloat},2,2)
Hself1=zeros(Complex{BigFloat},2,2)
dcosth=BigFloat(2.0e0/AngleBins)
costharr=(range(BigFloat(-1.0+dcosth/2.0e0),BigFloat(1.0-dcosth/2.0e0),AngleBins))
#splock = SpinLock()
#Threads.@threads
for i = 0:AngleBins-1
#lock(splock)
rho=[[u[i*8+1]+0im, u[i*8+3]-1im*u[i*8+4]] [u[i*8+3]+1im*u[i*8+4],u[i*8+2]+0im]]
rhobar=[[u[i*8+5]+0im, u[i*8+7]-1im*u[i*8+8]] [u[i*8+7]+1im*u[i*8+8],u[i*8+6]+0im]]
Hself0=Hself0+(rho-rhobar)*dcosth
Hself1=Hself1+(rho-rhobar)*costharr[i+1]*dcosth
#unlock(splock)
end
#Threads.@threads
for i = 0:AngleBins-1
rho=[[u[i*8+1]+0im, u[i*8+3]-1im*u[i*8+4]] [u[i*8+3]+1im*u[i*8+4],u[i*8+2]+0im]]
rhobar=[[u[i*8+5]+0im, u[i*8+7]-1im*u[i*8+8]] [u[i*8+7]+1im*u[i*8+8],u[i*8+6]+0im]]
Hself=mup*(Hself0-Hself1*costharr[i+1])
dudt=-c*1.0e0im*((Hvac+Hself)*rho-rho*(Hvac+Hself))
dudtbar=-c*1.0e0im*((-BigFloat(1.0e0)*Hvac+Hself)*rhobar-rhobar*(BigFloat(-1.0e0)*Hvac+Hself))
du[i*8+1]=real(dudt[1,1])
du[i*8+2]=real(dudt[2,2])
du[i*8+3]=real(dudt[1,2])
du[i*8+4]=imag(dudt[1,2])
du[i*8+5]=real(dudtbar[1,1])
du[i*8+6]=real(dudtbar[2,2])
du[i*8+7]=real(dudtbar[1,2])
du[i*8+8]=imag(dudtbar[1,2])
end
end
AngleBins=100
size=8*AngleBins
dcosth=BigFloat(2.0e0/AngleBins)
costharr=range(BigFloat(-1.0+dcosth/2.0e0),BigFloat(1.0-dcosth/2.0e0),AngleBins)
u0=zeros(BigFloat,size)
for i=0:AngleBins-1
u0[8*i+1]=BigFloat(0.5e0)
u0[8*i+5]=BigFloat(0.47e0)+BigFloat(0.05)*exp(-(costharr[i+1]-BigFloat(1.0e0))*(costharr[i+1]-BigFloat(1.0e0)))
end
p=[AngleBins]
tspan = (BigFloat(0.0),BigFloat(1e-6))
prob = ODEProblem(eoms!,u0,tspan,p)
#reltolp=1e-10
#abstolp=1e-10
reltolp=1e-20
abstolp=1e-20
#@time sol1 = solve(prob,ARKODE(Sundials.Explicit(),etable = Sundials.DORMAND_PRINCE_7_4_5),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol2 = solve(prob,CVODE_BDF(linear_solver=:GMRES,krylov_dim=30),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol3 = solve(prob,CVODE_Adams(linear_solver=:GMRES,krylov_dim=30),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol4 = solve(prob,KenCarp47(linsolve=KrylovJL_GMRES(),concrete_jac=true),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol5 = solve(prob,TRBDF2(linsolve=KrylovJL_GMRES(),concrete_jac=true),reltol=reltolp,abstol=abstolp,saveat=1e-8)
@time sol6 = solve(prob,VCABM(),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol7 = solve(prob,ODEInterfaceDiffEq.radau(),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol8 = solve(prob,RadauIIA5(),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#reltolp=1e-14
#abstolp=1e-14
#@time sol9 = solve(prob,ODEInterfaceDiffEq.radau(),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#@time sol10 = solve(prob,RadauIIA5(),reltol=reltolp,abstol=abstolp,saveat=1e-8)
#reltolp=1e-6
#abstolp=1e-6
#@time sol8 = solve(prob,Rosenbrock23(autodiff=true),reltol=reltolp,abstol=abstolp,saveat=1e-8)
using Plots
#plot(sol1,vars=(2),yscale=:log10,ylims=(1e-15,1e-2),label="DORMAND_PRINCE_7_4_5 24 sec")
#plot!(sol2,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="CVODE_BDF 17.69 sec")
#plot!(sol3,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="CVODE_Adams 6.37 sec")
#plot!(sol4,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="KenCarp47 24.14 sec")
#plot!(sol5,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="TRBDF2 6.75 sec")
#plot(sol7,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="ODEInterfaceDiffEq.radau() tol=1e-12")
#plot!(sol8,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="RadauIIA5 tol=1e-12")
#plot!(sol9,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="ODEInterfaceDiffEq.radau() tol=1e-14")
#plot!(sol10,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="RadauIIA5 tol=1e-14")
plot(sol6,vars=(2),yscale=:log10,ylims=(1e-15,1e-3),label="VCABM tol=1e-20")