Write EQDSK header dimensions in fixed 3i4 columns#396
Merged
Conversation
write_eqdsk emitted the grid dimensions free-form, so any dimension with three or more digits shifted out of the (6a8,3i4) columns that Fortran readers use, including libneo's own read_eqfile1/read_eqfile2: a 129x129 file came back as nw=12, nh=912 and the reader aborted. The header text is also padded to its full 48 columns so short headers cannot shift the integer fields.
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.
Problem
write_eqdskwrites the g-file header integers free-form (0 129 129). Fortran readers parse them with(6a8,3i4), so every grid dimension with three or more digits lands across column boundaries: libneo's ownread_eqfile1/read_eqfile2seenw=12, nh=912for a 129x129 file and abort withREAD_EQFILE2: Error reading. Files with two-digit dimensions (e.g. the 65x65 POTATO gate file) only worked by accident.Fix
Write
idum, nw, nhin fixed four-character columns and pad the 48-column header text, matching the EFIT g-file convention the readers assume.Tests
python/tests/test_eqdsk_base.py(new): header column assertions for 65x65, 129x129, 257x129, plus writer/reader round-trips. RED before the fix for both three-digit cases, GREEN after.