GENE-GIST#
Experimental Feature
This feature is experimental and still being tested.
Added in version 1.3.
This is the interface to the gyrokinetic turbulence code GENE using GIST-files. It can be used to generate GIST-files for specified fieldlines from a GVEC equilibrium.
The interface is installed automatically with pyGVEC and available with pygvec to-gist.
Usage#
pygvec to-gist is a pyGVEC subcommand which is installed as part of the gvec package.
The options for pygvec to-gist are:
$ pygvec to-gist --help
usage: pygvec to-gist [-h] [--rundir RUNDIR] (-s S | -r RHO) [-a ALPHA] [--npol NPOL]
[--gridpoints GRIDPOINTS] [--MNfactor MNFACTOR]
[-x {auto,none,pol,tor,both}] [-o OUTPUTFILE] [-p]
[--projectname PROJECTNAME] [-v | -q]
Produce a GENE-GIST input file from a GVEC state.
options:
-h, --help show this help message and exit
--rundir RUNDIR GVEC run directory
-s S position of the target flux surface (in normalized toroidal flux, 0 < s <= 1)
-r RHO, --rho RHO position of the target flux surface (in square root of the normalized toroidal flux, 0 < rho <= 1)
-a ALPHA, --alpha ALPHA
fieldline label as float or multiple of pi (e.g. '0.0', '2pi', 'pi/2', default 0.0)
--npol NPOL number of poloidal turns (default 1)
--gridpoints GRIDPOINTS
number of grid points along the fieldline (default 128)
--MNfactor MNFACTOR multiplication factor for the maximum fourier modes for the boozer transform (default 3)
-x {auto,none,pol,tor,both}, --flip {auto,none,pol,tor,both}
flip the poloidal or toroidal direction with respect to GVEC's Boozer coordinates; 'auto' determines the necessary flips to get positive toroidal and poloidal flux (default: 'auto')
-o OUTPUTFILE, --outputfile OUTPUTFILE
output file name (default: '{projectname}_s{s}.gist.txt')
-p, --plot plot the output quantities ('{projectname}_s{s}.gist.png')
--projectname PROJECTNAME
override the project name for the output files (default: use GVEC state name)
-v, --verbose verbosity level: -v for info, -vv for debug
-q, --quiet suppress output
A typical conversion command would then be:
pygvec to-gist -s 0.25 -p -v
which will look for a GVEC parameter- and statefile in the current directory.
Derivations for GIST quantities#
Boozer coordinates#
Boozer coordinates \(\left(\rho,\theta_B,\zeta_B\right)\) are a particular kind of straight-fieldline coordinates, where the following relations hold for the magnetic field \(\vec{B}\):
Here \(\rho_B\in[0,1]\) is a radial, radius-like coordinate, typically chosen such that \(\rho^2\) is the normalized toroidal flux. \(\theta_B, \zeta_B \in [0,2\pi)\) are the poloidal and toroidal periodic, angle-like coordinates.
changing coordinate directions#
In GVEC, Boozer coordinates are right-handed and follow the directions of the logical (flux aligned) coordinates \(\left(\rho,\theta,\zeta\right)\). The directions of the two angular coordinates are arbitrary and need to be flipped in certain cases.
Flipping toroidally \(\zeta \to -\zeta\) changes \(\Phi \to -\Phi, \iota \to -\iota, \Jac \to -\Jac\).
Flipping poloidally \(\theta \to -\theta\) changes \(\chi \to -\chi, \iota \to -\iota, \Jac \to -\Jac\).
The geometry also needs to be flipped accordingly and all derived quantities change, but the formulas stay the same.
Fieldline coordinates#
The transformation to the fieldline coordinates \(\left(\rho_\alpha,\alpha,\phi_\alpha\right)\) can be defined as:
The inverse transformation is then:
The reciprocal and tangential basis vectors are then:
And the Jacobian determinant is
The magnetic field takes the form
which shows that the magnetic field is tangential to the fieldline defined by constant \(\rho,\alpha\).
The derivatives of some quantity \(Q\) in fieldline coordinates are then:
GIST quantities#
The GIST coordinate system is defined as
where
and \(\rho_0\) is the position of the flux surface of interest.
The normalized GIST coordinate system is defined as
The reciprocal basis vectors in the normalized GIST coordinate system are then
with the normalized gradient \(\hat\nabla = a\nabla\). The associated components of the metric tensor, defined as
are
The Jacobian determinant is
and the magnetic field is defined by:
Note that with the usual convention of \(\Phi = \Phi_{edge}\rho^2\), it follows
Some quantities of interest are (see relevant literature on GENE for definitions and motivation):
For comparison with VMEC quantities, note that
The GIST file then contains the Fortran namelist parameters with:
s0\(= \rho_0^2\)my_dpdx\(= \hat{p}\)q0\(= q_0\)shat\(= \hat{s}\)gridpointsn_pol\(= n_{pol}\)Lref\(= a\)Bref\(= B_{ref}\)n0_global\(= N_{FP}\)beta\(= \hat{\beta}\)
and the columns:
\(\hat{g}^{11}\)
\(\hat{g}^{12}\)
\(\hat{g}^{22}\)
\(\hat{b}\)
\(\hat\Jac\)
\(L_2\)
\(-L_1\)
\(\hat{b}_\phi\)
which are evaluated at gridpoints equidistantly spaced points in \(\phi_\alpha\in\left[-n_{pol}\pi,n_{pol}\pi\right)\) for a fixed \(\rho=\rho_0\) and \(\alpha\).
coordinate directions#
In principle the directions of \(\theta_B,\zeta_B\) are arbitrary. It can however make sense to fix their directions such that certain quantities become positive.
Let us note:
In order for \(B_{ref}\) to be positive, we need to choose the direction of \(\zeta_B\), such that the toroidal magnetic flux \(\Phi\) is positive.
Any change in direction also changes the sign of \(\iota\) and \(\Jac_B\). \(\hat\Jac\) however maintains the sign.
We can therefore change the direction of \(\theta_B\), such that the poloidal magnetic flux \(\chi\) is also positive.