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

simsopt.mhd.Vmec silently accepts bogus inputs -> Vmec.get_input returns bogus data #439

Open
eguiraud-pf opened this issue Jul 25, 2024 · 0 comments

Comments

@eguiraud-pf
Copy link

Reproducer:

In [4]: !echo "not a valid vmec input file" > /tmp/input.invalid

In [5]: !cat /tmp/input.invalid
not a valid vmec input file

In [6]: simsopt.mhd.Vmec("/tmp/input.invalid").get_input()
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  SEQ =    1 TIME SLICE  0.0000E+00
  PROCESSING INPUT.invalid
  THIS IS PARVMEC (PARALLEL VMEC), VERSION 9.0
  Lambda: Full Radial Mesh. L-Force: hybrid full/half.

  COMPUTER:    OS:    RELEASE:   DATE = Jul 25,2024  TIME = 22:28:32
Out[6]: '&INDATA\n! This file created by simsopt on July 25 2024, 22:28:32\n\n! ---- Geometric parameters ----\nNFP = 1\nLASYM = F\n\n! ---- Resolution parameters ----\nMPOL = 6\nNTOR = 0\nNTHETA = 18\nNZETA = 1\nNS_ARRAY    =     31\nNITER_ARRAY =    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100    100\nFTOL_ARRAY  =  1e-10\n\n! ---- Boundary toroidal flux ----\nPHIEDGE = 1.0\n\n! ---- Pressure profile specification ----\nPMASS_TYPE = "power_series"\nAM = 0.0 \nPRES_SCALE = 1.0\n\n! ---- Profile specification of iota or current ----\nNCURR = 0\nPIOTA_TYPE = "power_series"\nAI = 0.0 \n\n! ---- Other numerical parameters ----\nDELT = 1.0\nNSTEP = 10\n\n! ---- Boundary shape. Array index order is (n, m) ----\n/\n\n'

Not sure what the best way to validate the input would be without actually trying to run the underlying Fortran. Maybe the Python side could at least check that the first line of the file is &INDATA.

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

No branches or pull requests

1 participant