-
Notifications
You must be signed in to change notification settings - Fork 90
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
Hypnotoad nonorthogonal fixes #1593
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously was using number of points in leg segment, could cause error if the number of points in the core segment happened to be less.
If the grid creation needs to be restarted from create_nonorthogonal, it should restart the nonorthogonal procedure rather than the orthogonal one.
Length of z-component was calculated incorrectly because the original length of the vector was not stored, and the calculation for the z-component used the normalized r-component.
If the intersection point is in the last segment of the wall, after the last point in the 'boundary' array, then the index needs to be wrapped around to the beginning of the array.
The vector that is supposed to be parallel to the wall was hard-coded to [1,0] for the second wall intersection in the case with only one X-point.
Add first point on boundary to end so that contour is treated as closed.
DERIV is inaccurate at the first/last points where it uses one-sided differences. Wrapping around is not correct for open contours, but the ends of these should not be close to an X-point.
When following lines along separatrix away from the X-point, continue until both R and Z have reached an extremum. This should take the line at least a quarter and at most half way around a closed contour. The previous behaviour risked stopping after a very short distance if the X-point was not at the top or bottom of the contour.
Finding distance by integrating index derivatives along contours is not accurate, as the contour points may be very unevenly spaced. The algorithm from poloidal_grid which directly adds up the distance between grid points is more robust: this commit copies that algorithm to line_dist.
Using INTERPOLATE is consistent with how contours are treated elsewhere, which can prevent errors (for example the projected poloidal location of the X-point being slightly different when calculated when fft_interp or INTERPOLATE is used to find the starting position, leading to a position being found on the wrong side of the X-point). Also, fft_interp is likely to be inaccurate on contours, as their points can be very unevenly spaced. INTERPOLATE uses linear interpolation which is more robust.
Function is defined in follow_gradient_nonorth.pro Previously was radial_differential, which is a name conflict with the function defined in follow_gradient.pro, and caused Hypnotoad to crash when re-running non-orthogonal grid generation.
bendudson
approved these changes
Feb 21, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @johnomotani !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Collection of bugfixes for Hypnotoad (see commit messages). The TORPEX cases I've been trying to grid seem to be good at getting into strange corner cases...