Skip to content

Commit

Permalink
Remove internal function call from Pprime
Browse files Browse the repository at this point in the history
  • Loading branch information
bclyons12 committed Aug 23, 2023
1 parent 367d013 commit 171d059
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/shot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -490,18 +490,16 @@ end

Pprime(shot::Shot, P::Nothing, dP_dψ) = dP_dψ

function Pprime(shot::Shot, P, dP_dψ::Nothing)
function dp(x)
if x == 0.0
ϵ = 1e-6
dp1 = dp(ϵ)
dp2 = dp(2ϵ)
return 2.0 * dp1 - dp2
end
return D(shot.P, x) / dψ_dρ(shot, x)
function _dp(x, shot)
if x == 0.0
ϵ = 1e-6
dp1 = _dp(ϵ, shot)
dp2 = _dp(2ϵ, shot)
return 2.0 * dp1 - dp2
end
return dp
return D(shot.P, x) / dψ_dρ(shot, x)
end
Pprime(shot::Shot, P, dP_dψ::Nothing) = (x -> _dp(x, shot))

function MXHEquilibrium.pressure_gradient(shot::Shot, psi)
rho = ρ(shot, psi)
Expand Down

0 comments on commit 171d059

Please sign in to comment.