PlasmaControl / DESC

Stellarator Equilibrium and Optimization Suite
MIT License
95 stars 26 forks source link

Handle VMEC Input Files Better #183

Open dpanici opened 2 years ago

dpanici commented 2 years ago

Apparently in VMEC the boundary modes can be given with the following logic, which we currently do not support converting in DESC. Also, this could be useful to add as an input option in our own input files

 rbc(-22:22,0) = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.9752041013880218, -0.693363161259351, 0.3158097406419154,
                    -0.1336173987189171, 0.04250319143001195, -0.0017939240980503425,
                    -0.011073301883956194, 0.010402231681464624, -0.005115714919129545,
                    0.0001348021675985992, 0.002564506738780156, -0.0028903931958533633,
                    0.0018064368511084795, -0.00023521761858271873, -0.0007086499231920249,
                    0.0011111467874450785, -0.0005442993972098523, -1.2982368610783194e-05,
                    0.0007834476816723562, 2.2221180650775065e-06, -4.416136866781143e-05,
                    8.239232451572815e-05, -0.00010136354765774249

Relatedly (as raised by #1298), VMEC can specify splines for the profile inputs (among others), which we currently do not allow through an input file.

f0uriest commented 2 years ago

A possible generalized solution would be to use a fortran namelist reader like https://f90nml.readthedocs.io/en/latest/ for all the vmec reading/writing stuff (and spec too)

dpanici commented 1 year ago

@MothVine the f90 namelist reader we mentioned ^

dpanici commented 1 year ago

431 improves this a bit but we should just use f90nml as it takes a lot of logic to deal with the flexibility that the namelists allow.

improvements that need to be made that could be resolved with f90nml:

dpanici commented 1 year ago

Also, make sure that we can handle VMEC input files with INDATA and END with different cases, since they are not always upper case

dpanici commented 2 months ago

@dpanici I did this sometime, dig up the code for it