QUASR and G-Frame#
GVEC-QUASR interface#
Note
The QUASR interface requires simsopt to be installed.
The QUAsi-symmetric Stellarator Repository QUASR [1] [2] [3] is a database of curl-free stellarators optimized for volume quasi-symmetry.
A QUASR configuration can be loaded with
pygvec load-quasr ID -v
where ID is replaced with the desired configuration and -v is for verbose. Alternatively
pygvec load-quasr -s FILE -v
can be used instead, to load a boundary from a simsopt compatible JSON file (e.g. manually downloaded from QUASR).
With
pygvec load-quasr -f FILE -v
the cartesian boundary data is read directly from the supplied netCDF file (in this case simsopt is also not required).
In the script, depending on the type of input, the boundary surface data is used to construct a G-Frame, which is described in [4]. The script writes a netCDF file containing the G-Frame and the boundary cross-sections, and along with it a first GVEC parameter file.
The
-vis for verbose mode, which prints the steps executed by the script to screen.The
--cleanparameter sets the desired tolerance to remove modes from the input surface (cleanup), and therefore changes the boundary surface!The
--stellsymflag imposes stellarator symmetry for the input surface. It is recommended to first check without this flag and see if necessary and applicable. Changes the boundary surface!The
--cutoffparameter sets a desired cutoff toroidal mode number for the G-Frame construction (does not change the boundary surface).The
--tolparameter sets the desired tolerance for determining minimal necessary Fourier modes for the output boundary X1,X2.The
--ntand--nzparameters set the number of points in \(\vartheta\) and \(\zeta\) respectively for one field period, from which a G-Frame as well as the boundary cross-sections are computed. The points exclude the periodic endpoint and should be chosen to be odd.With
--save-xyzthe cartesian boundary data can be saved as anetCDFfile.All parameters can be seen with
pygvec load-quasr --help.
Construction from other surface data#
One can also use other surfaces from which to construct a G-Frame and its corresponding cross-sections, providing the surface data only.
The surface cartesian position \((x,y,z)(\vartheta_i,\zeta_j)\) must be evaluated at a meshgrid on the full torus, excluding the periodic endpoint:
\(\vartheta_i=2\pi \frac{i}{n_\vartheta},i=0\dots,n_\vartheta-1,\quad \zeta_j=2\pi\frac{j}{n_\zeta},j=0,\dots,n_\zeta-1\)
\(n_\vartheta,n_\zeta\) should be chosen to be odd.
Below an example, with an eval_surface function that evaluates the surface in cartesian coordinates,
provided the number of points ntheta and nzeta over one field period and the number of field periods nfp.
import gvec
import numpy as np
theta=np.linspace(0,2*np.pi,ntheta,endpoint=False)
zeta=np.linspace(0,2*np.pi,nzeta*nfp,endpoint=False)
xyz=np.zeros((nzeta,ntheta,3))
for j in range(nzeta):
for i in range(ntheta):
xyz[j,i,:] = eval_surface(theta[i],zeta[j])
gvec.scipts.quasr.save_xyz(xyz,nfp,'surface.nc')
Once the surface is written to file, the above script can be used:
pygvec load-quasr -f surface.nc -v
The construction of the G-Frame uses the toroidal angle \(\zeta\) from the data, a recommended choice is to use the Boozer angle for \(\zeta\).
Note
If the surface data is computed from cylinder coordinates, the construction will not change this, and the resulting cross-sections will not change shape!
Visualization of the G-Frame file#
The script above produces a netCDF file containing the G-Frame and the corresponding boundary. One can visualize both via VTK.
import gvec
gvec.vtk.gframe_to_vtk("netcdf-file-gframe.nc")
This produces a .vts file for the axis of the G-Frame and of the boundary surface, which can be viewed e.g. in Paraview. More visualization options are available, see docstring of gframe_to_vtk.