Repository navigation
Interpolate the mgrid field cubically and free the vacuum arrays between runs - #27
Draft
krystophny wants to merge 2 commits into
Draft
krystophny wants to merge 2 commits into
krystophny wants to merge 2 commits into
Conversation
becoil interpolated the coil field bilinearly, an O(h**2) error that moves the free boundary with the grid spacing. On the DIII-D deck (126 x 201 grid, 16 mm spacing) refining the grid 2x moved the volume by 4.5e-4 and the axis by 0.37 mm. A tensor 4-point Lagrange stencil, centred and shifted inward at the grid edges, gives the same result on the original and the refined grid and agrees with VMEC++, which interpolates the same way. The new test solves a small tokamak in an analytic field tabulated at 50 mm; bilinear interpolation moves its axis by 48 mm from the fine-grid result, cubic by 0.2 mm.
precal allocates sinmni, cosmni, counts_vac and disps_vac, which neither cleanup (called by the Python interface between runs) nor fileout freed, so a second free-boundary run in one process stopped with an allocation error. test_second_run solves the same case twice in one process.
This branch has not been deployed
This file contains hidden or 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
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.
This PR holds two free-boundary fixes, one commit each.
Cubic mgrid interpolation (a4f8dc4).$(R, Z)$ (becoil.f#L61-L87). The interpolation error is $O(h^2)$ in the table spacing $h$ and shifts the computed boundary and magnetic axis. The commit uses cubic Lagrange interpolation with 4 points per direction in $R$ and $Z$ , one-sided at the table edges (becoil.f#L63-L87), with an $O(h^4)$ interpolation error.
becoilinterpolates the mgrid field bilinearly intest_mgrid_resolutionsolves a tokamak with its axis nearOn the public DIII-D example, input.DIII-D_lasym_false run with$R \times Z$ = 126 x 201 nodes), a table with half the spacing moves the bilinear axis by 0.37 mm and the plasma volume by $4.5\times10^{-4}$ relative. With cubic interpolation the two tables give the same axis within 1 µm and the same volume within $3\times10^{-7}$ .
LASYM = T,MPOL = 16,NS = 128andPHIEDGEscaled by 0.95, in mgrid_d3d_ef.nc (Second run in one process (1a47748).
precalallocates four NESTOR work arrays (precal.f#L152, #L224) that neither the Python interface'scleanupnorfileoutfrees, so a second free-boundary run in the same Python process stops withThe commit frees them in both places (cleanup.f90#L52-L56, fileout.f#L329-L334).
test_second_runsolves the tokamak oftest_mgrid_resolutiontwice in one process and requires the same axis and volume.On 70c637a both new tests fail. With the two commits they pass with 1 and 2 MPI ranks, and
test_simpleandtest_regressionpass unchanged.Chris&AI