From 63feefbd1b913efa2b5fa2ea13bd1f39f3b38b04 Mon Sep 17 00:00:00 2001 From: Nuwan Yapa Date: Mon, 17 Feb 2025 19:33:47 -0500 Subject: [PATCH] RK4 -> Tsit5 --- nucleons.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nucleons.jl b/nucleons.jl index 32ce4a8..7abc274 100644 --- a/nucleons.jl +++ b/nucleons.jl @@ -27,19 +27,19 @@ end divs is the number of mesh divisions so solution would be returned as a 2×(1+divs) matrix, shooting method divides the interval into two partitions at r_max/2, ensuring convergence at both r=0 and r=r_max, the other parameters are the same from dirac!(...)." -function solveNucleonWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true) +function solveNucleonWf(κ, p, E, Φ0, W0, B0, A0, r_max, divs; shooting=true, normalize=true, algo=Tsit5()) Δr = r_max / divs if shooting @assert divs % 2 == 0 "divs must be an even number when shooting=true" prob = ODEProblem(dirac!, [0, 1], (r_max, r_max / 2)) - sol = solve(prob, RK4(), p=(κ, p, E, Φ0, W0, B0, A0), saveat=Δr) + sol = solve(prob, algo, p=(κ, p, E, Φ0, W0, B0, A0), saveat=Δr) wf_right = reverse(hcat(sol.u...); dims=2) r_max = r_max / 2 # for the next step end prob = ODEProblem(dirac!, [0, 1], (0, r_max)) - sol = solve(prob, RK4(), p=(κ, p, E, Φ0, W0, B0, A0), saveat=Δr) + sol = solve(prob, algo, p=(κ, p, E, Φ0, W0, B0, A0), saveat=Δr) wf = hcat(sol.u...) if shooting # join two segments