Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find boundary psi without original #179

Open
bclyons12 opened this issue Jul 30, 2024 · 2 comments
Open

Find boundary psi without original #179

bclyons12 opened this issue Jul 30, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@bclyons12
Copy link
Member

The find_psi_boundary function was updated to take the original_psi_boundary as an input. What should I do if I don't know the original boundary flux? In my case, I'm not starting from a dd and just want to find the boundary flux from a gridded psi.

@bclyons12 bclyons12 added the question Further information is requested label Jul 30, 2024
@orso82
Copy link
Member

orso82 commented Aug 1, 2024

# determine if this is a closed boundary equilibrium solution mapped to RZ grid like CHEASE would do.
# When this happens the last closed surface touches the computation domain.
# In this case we don't want to alter the original value of psi_boundary.
psi_edge = [PSI[1, :]; PSI[end, :]; PSI[:, 1]; PSI[:, end]]
if psi_axis < original_psi_boundary
psi_edge0 = minimum(psi_edge)
else
psi_edge0 = maximum(psi_edge)
end
surface, _ = flux_surface(dimR, dimZ, PSI, RA, ZA, Float64[], Float64[], psi_edge0, :closed)
if !isempty(surface) && ((abs((minimum(surface[1].z) - minimum(dimZ))) < 1E-3) || (abs((maximum(surface[1].z) - maximum(dimZ))) < 1E-3))
return (last_closed=original_psi_boundary, first_open=nothing)
end

@bclyons12
Copy link
Member Author

bclyons12 commented Aug 2, 2024

Per discussion with @orso82, the routine currently assumes that if the minimum/maximum psi on the domain boundary corresponds to a closed flux surface, the user has probably provided a CHEASE equilibrium with concentric surfaces outside the plasma boundary. Thus, the routine returns the original boundary. This fails if a free-boundary solution is given where the domain boundary is the limiter. Commenting out the lines above fixes the problem.

We should think about how to fix/refactor this. Likely we want a flag for whether to perform this "CHEASE" check. Also, the original psi boundary may not be known, so it would be good if there was a way to specify concave vs convex. This is know from Ip and the COCOS as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants