pyro-kinetics / pyrokinetics

Python library to run and analyse gyrokinetics simulations
https://pyrokinetics.readthedocs.io/en/latest/#
GNU Lesser General Public License v3.0
25 stars 6 forks source link

Load in tracer_efit as "circular" LocalGeometry with q and shat #319

Closed bpatel2107 closed 7 months ago

bpatel2107 commented 7 months ago

Fixes issue #255

Not sure if this is the best solution but it does let you read in GENE inputs with geometry set to tracer_efit assuming $q$ and $\hat{s}$ are defined in the input file. If not then when you load in eigenfunctions the mapping from flux tube to ballooning space won't work, see

https://github.com/pyro-kinetics/pyrokinetics/blob/enhancements/gene_tracer_efit/src/pyrokinetics/gk_code/gene.py#L1169-L1183

@dake0795 @joeyschmidt FYI

Ideally I'd want to have all the things in a LocalGeometry object (R, Z, plus derivatives w.r.t theta and r) but this is fine. Note you can't convert to CGYRO units as we don't know the value of Bunit/B0 without those derivatives mentioned above.

EDIT: This should also work for slab and s_alpha. Note this only works with reading in data. Writing out new files will fail

bpatel2107 commented 7 months ago

GENE v3.0 input can have an issue with setting FCVERSION in the parameters_XXXX files and that can have brackets i.e. FCVERSION = GNU Fortran (Spack GCC) 9.4.0\ which breaks f90nml in a bad way. Brackets are reserved for lists in fortran namelists so I don't think changing f90nml is going to happen.

Hacky fix is to convert the file to a str, read in, remove brackets and then use the _read_str method. Not ideal but a functional placeholder until fixed in GENE.