Skip to content

Commit

Permalink
Prevent extrapolation in solve
Browse files Browse the repository at this point in the history
  • Loading branch information
bclyons12 committed Jan 29, 2024
1 parent 63fa0cf commit 376c480
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/shot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ end


function (shot::Shot)(r, z; extrapolate::Bool=false)
ρ, θ = ρθ_RZ(shot, r, z)
!extrapolate &&= min(ρ, 1.0))
ρ, θ = ρθ_RZ(shot, r, z; extrapolate)
return psi_ρθ(shot, ρ, θ)
end

Expand Down
6 changes: 2 additions & 4 deletions src/surfaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,14 @@ function Δ(shot, ρ, R, Z; tid = Threads.threadid())
return Δ
end

function ρθ_RZ(shot, R, Z)
function ρθ_RZ(shot, R, Z; extrapolate::Bool=false)
f = x -> Δ(shot, x, R, Z)
if f(1.0) >= 0.0
ρ = Roots.find_zero(f, (0,1), Roots.A42())
else
ρ = Roots.find_zero(f, 1.0)
ρ = extrapolate ? Roots.find_zero(f, 1.0) : 1.0
end
#ρ = f(1.0) < 0.0 ? 1.0 : Roots.find_zero(f, 0.5)#(0,1), Roots.A42())
θ, _ === 0.0) ? (0.0, 0.0) : θ_at_RZ(shot, ρ, R, Z)
#println((ρ, θ))
return ρ, θ
end

Expand Down

0 comments on commit 376c480

Please sign in to comment.