REGCOIL: Fast and robust calculation of stellarator coil shapes
A comparison of REGCOIL to NESCOIL for W7X geometry illustrates the significantly improved
coil spacing from REGCOIL near the grey arrows. The REGCOIL coils shown simultaneously yield a more accurate freeboundary
reconstruction of the target plasma shape than the NESCOIL coils.
REGCOIL is a code for computing the shapes of stellarator coils. It is intended as a replacement for the NESCOIL code,
for applications in which speed, ease of use, and reliability are paramount, such as
targeting coil complexity in fixedboundary plasma shape optimization, or for scoping new stellarator geometries.
REGCOIL is faster than NESCOIL (due to parallelization), allows finer control over the level of regularization,
and generally yields coil shapes with significantly greater minimum coiltocoil separation.
This latter benefit prevents
collisions between coils while improving access for ports. At the same time, the optimization problem solved
in REGCOIL is convex (as in NESCOIL), ensuring the optimization can never be stuck in a local minimum that is not the global
minimum, unlike more general coil optimization methods.
The source code for REGCOIL and a user manual are available on GitHub.
A paper describing the work is available at arXiv:1609.04378.
SFINCS: Stellarator FokkerPlanck Iterative Neoclassical Conservative Solver
Calculation of the parallel current in the W7X stellarator using SFINCS
SFINCS is a driftkinetic code for nonaxisymmetric plasmas, including stellarators and perturbed tokamaks.
It allows for comparison between several variants of the driftkinetic equation, differing the terms involving
the radial electric field. Several collision operators are available, including the full linearized FokkerPlanck
operator. General nested flux surface geometry is allowed, and interfaces are provided to several equilibrium formats.
An arbitrary number of species may be included.
The code solves for the distribution function of each species, with coupling in four coordinates:
the toroidal and poloidal angles in real space, and the velocity components parallel and perpendicular to B.
The code uses continuum discretizations, with finitedifferencing
in the toroidal and poloidal spatial angles, a Legendre modal expansion in the pitch angle,
and a pseudospectral collocation scheme in the speed coordinate.
At its core, the code solves a large sparse linear system.
The solve is carried out by a preconditioned Krylovspace algorithm
using the PETSc library.
Several moments of the distribution functions are then evaluated, including the
radial fluxes, flow, bootstrap current, and density and pressure variation
on a flux surface.
The source code for SFINCS, as well as extensive documentation, is available on GitHub.
PERFECT: Pedestal and Edge Radiallyglobal FokkerPlanck Evaluation of Collisional Transport
PERFECT solves a finiteorbitwidth driftkinetic equation to evaluate neoclassical phenomena in regions of a tokamak
with strong radial gradients, such as the Hmode pedestal.
General axisymmetric shaped flux surface geometry is permitted, and an arbitrary number of species may be included.
Collisions are implemented using the full linearized FokkerPlanck operator.
The code solves for the distribution function of each species, with coupling in four coordinates:
the radial and poloidal coordinates in real space, and the velocity components parallel and perpendicular to B.
The code uses continuum discretizations, with finitedifferencing
in the spatial coordinates, a Legendre modal expansion in the pitch angle,
and a pseudospectral collocation scheme in the speed coordinate.
At its core, the code solves a large sparse linear system.
The solve is carried out by a preconditioned Krylovspace algorithm
using the PETSc library.
Several moments of the distribution functions are then evaluated, including the
radial fluxes, flow, bootstrap current, and density and pressure variation
on a flux surface.
Excellent agreement has been obtained between PERFECT and finiteorbitwidth analytic theory:
Details of the project, including the equations implemented, algorithms, and physics results, are published here:
arXiv:1312.2148 (2013).
The source code for PERFECT is available on GitHub.
CODE: COllisional Distribution of Electrons
CODE computes the distribution function of primary (Dreicer) and secondary (avalanche) runaway electrons,
as well as the runaway generation rate.
These quantities are computed by solving
a FokkerPlanck equation using a relativistic collision operator.
The details of CODE are discussed in this publication: http://arxiv.org/abs/1305.3518
Tools for Gaussian quadrature and for discretizing velocity space
Below are several functions I wrote for spectrally accurate integration and differentiation of functions that resemble a Maxwellian distribution or Gaussian. More precisely, these routines are designed for functions that behave roughly like exp(x^2) for large x, and which exist on the semiinfinite domain [0,Inf). I have found these routines useful for numerical solution of kinetic problems.
The theoretical background of these subroutines is discussed in this paper:
Journal of Computational Physics 243, 130 (2013) http://dx.doi.org/10.1016/j.jcp.2013.02.041
MATLAB source files:
m20121125_05_GaussWeightsAndAbscissae.m
Computes the abscissae and weights for Gaussian quadrature for any weight function on any interval.
m20121007_01_GaussRadauWeightsAndAbscissae.m
Computes the abscissae and weights for Gaussian quadrature for any weight function on any interval, including a grid point at x=0 or some other desired location.
m20130312_02_SpectralNodesWeightsAndDifferentiationMatricesForV.m
Computes the abscissae, integration weights, and differentiation matrices for Maxwellianlike (Gaussianlike) functions.
m20121125_06_DemoOfIntegrationAndDifferentiationInV.m
Demonstration of the above two routines.
m20120703_03_polynomialInterpolationMatrix.m
Returns the matrix for spectral interpolation from one grid to another for any abscissae and weights.
The m20121125_07 and m20121125_06 programs above depend on the poldif.m routine which is part of the DMSuite package by J. A. C. Weideman and S. C. Reddy, available here or here.
Also, the polint.m routine from DMSuite is the foundation for the m20120703_03 function above.
I have also written Fortran 90 versions of all of the
velocityspace grid subroutines, available here:
grids.tar.gz
These routines use the type PetscScalar
so they can be called by codes that are based on the
PETSc library.
However, no other PETSc functionality is used, so you can change the type
to e.g. real if you want to use the routines in a nonPETSc application.
The makeXGrid module uses LAPACK,
which is automatically available
in a program compiled with PETSc libraries.
Several subroutines from the QUADPACK package
are dependencies of makeXGrid and are included in the zip file. (Both single and double precision versions are included.)
Poloidal density variation (asymmetry) of a trace impurity
Here are a set of scripts that
compute the poloidal density variation of a trace impurity in a tokamak.
Specifically, we solve equation (27) in
Fulop & Helander, Phys Plasmas 8, 3305 (2001).
The same equation appears in the top line of (9) in
Helander, Phys Plasmas 5, 3999 (1998)
(considering the trace impurity limit alpha=0.)
MATLAB source files:
This script solves the ODE for a single value of gamma and g, and plots the results as a
function of theta:
m20121024_01_solveFulopHelanderODE.m
This script solves the ODE for a range of values of gamma and g, and plots the inout
asymmetry as a function of these two parameters:
m20121024_02_solveFulopHelanderODEScan.m
Both of the above two programs use the following two utilities:
m20120528_03_FourierInterpolation.m
fourdif.m.
(This last routine is part of the DMSuite package by J. A. C. Weideman and S. C. Reddy, available here or here.)
