ASCOT5
Loading...
Searching...
No Matches
Functions | Variables
gctransform.c File Reference

Module for performing guiding center transformations. More...

#include "offload_acc_omp.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "ascot5.h"
#include "consts.h"
#include "physlib.h"
#include "gctransform.h"

Go to the source code of this file.

Functions

void gctransform_setorder (int order)
 Set the order of the transformation.
 
void gctransform_particle2guidingcenter (real mass, real charge, real *B_dB, real r, real phi, real z, real pr, real pphi, real pz, real *R, real *Phi, real *Z, real *ppar, real *mu, real *zeta)
 Transform particle to guiding center phase space.
 
void gctransform_guidingcenter2particle (real mass, real charge, real *B_dB, real R, real Phi, real Z, real ppar, real mu, real zeta, real *r, real *phi, real *z, real *pparprt, real *muprt, real *zetaprt)
 Transform guiding center to particle phase space.
 
void gctransform_pparmuzeta2prpphipz (real mass, real charge, real *B_dB, real phi, real ppar, real mu, real zeta, real *pr, real *pphi, real *pz)
 Transform particle ppar, mu, and zeta to momentum vector.
 

Variables

static int GCTRANSFORM_ORDER = 1
 

Detailed Description

Module for performing guiding center transformations.

The guiding center transformation is done both ways between particle phase-space [r, phi, z, pr, pphi, pz] and guiding center phase-space [R, Phi, Z, ppar, mu, zeta] to first order (both in spatial and momentum space coordinates).

The guiding genter motion is defined from a basis {bhat, e1, e2}, where bhat is magnetic field unit vector. e1 and e2 are chosen so that e1 = (bhat x z) / |bhat x z| and bhat x e1 = e2. Thus we are assuming that magnetic field is never parallel to z axis.

This module works as follows:

The transformation is relativistic.

Reference: "Guiding-center transformation of the radiation-reaction force in a nonuniform magnetic field", E. Hirvijoki et. al. https://arxiv.org/pdf/1412.1966.pdf

Definition in file gctransform.c.

Function Documentation

◆ gctransform_setorder()

void gctransform_setorder ( int order)

Set the order of the transformation.

Parameters
orderorder which is either zero or one

Definition at line 62 of file gctransform.c.

◆ gctransform_particle2guidingcenter()

void gctransform_particle2guidingcenter ( real mass,
real charge,
real * B_dB,
real r,
real phi,
real z,
real pr,
real pphi,
real pz,
real * R,
real * Phi,
real * Z,
real * ppar,
real * mu,
real * zeta )

Transform particle to guiding center phase space.

The transformation is done from coordinates [r, phi, z, pr, pphi, pz] to [R, Phi, Z, ppar, mu, zeta]. If particle is neutral, the transformation will be in zeroth order both in real and momentum space as that transformation is valid when q = 0.

Parameters
massmass [kg]
chargecharge [C]
B_dBgradient of magnetic field vector at particle position
rparticle R coordinate [m]
phiparticle phi coordinate [rad]
zparticle z coordinate [m]
prparticle momentum R component [kg m/s]
pphiparticle momentum phi component [kg m/s]
pzparticle momentum z component [kg m/s]
Rpointer to guiding center R coordinate [m]
Phipointer to guiding center phi coordinate [rad]
Zpointer to guiding center z coordinate [m]
pparpointer to guiding center parallel momentum [kg m/s]
mupointer to guiding center magnetic moment [J/T]
zetapointer to guiding center gyroangle [rad]

Definition at line 90 of file gctransform.c.

◆ gctransform_guidingcenter2particle()

void gctransform_guidingcenter2particle ( real mass,
real charge,
real * B_dB,
real R,
real Phi,
real Z,
real ppar,
real mu,
real zeta,
real * r,
real * phi,
real * z,
real * pparprt,
real * muprt,
real * zetaprt )

Transform guiding center to particle phase space.

The transformation is done from coordinates [R, Phi, Z, ppar, mu] to [r, phi, z, ppar_prt, mu_prt, zeta_prt]. If particle is neutral, the transformation will be in zeroth order both in real and momentum space as that transformation is valid when q = 0.

Parameters
massmass [kg]
chargecharge [C]
B_dBgradient of magnetic field vector at guiding center position
Rguiding center R coordinate [m]
Phiguiding center phi coordinate [rad]
Zguiding center z coordinate [m]
pparguiding center parallel momentum [kg m/s]
muguiding center magnetic moment [J/T]
zetaguiding center gyroangle [rad]
rpointer to particle R coordinate [m]
phipointer to particle phi coordinate [rad]
zpointer to particle z coordinate [m]
pparprtpointer to particle parallel momentum [kg m/s]
muprtpointer to particle magnetic moment [J/T]
zetaprtpointer to particle gyroangle [rad]

Definition at line 329 of file gctransform.c.

◆ gctransform_pparmuzeta2prpphipz()

void gctransform_pparmuzeta2prpphipz ( real mass,
real charge,
real * B_dB,
real phi,
real ppar,
real mu,
real zeta,
real * pr,
real * pphi,
real * pz )

Transform particle ppar, mu, and zeta to momentum vector.

The transformation is done from coordinates [R, Phi, Z, ppar, mu] to [r, phi, z, pr, pphi, pz]. The transformation is done to first order.

Parameters
massmass [kg]
chargecharge [C]
B_dBgradient of magnetic field vector at particle position
phiparticle phi coordinate [rad]
pparparticle parallel momentum [kg m/s]
muparticle magnetic moment [J/T]
zetaparticle gyroangle [rad]
prpointer to particle momentum R-component [kg m/s]
pphipointer to particle momentum phi-component [kg m/s]
pzpointer to particle momentum z-component [kg m/s]

Definition at line 554 of file gctransform.c.

Variable Documentation

◆ GCTRANSFORM_ORDER

int GCTRANSFORM_ORDER = 1
static

Order to which guiding center transformation is done in momentum space.

Definition at line 53 of file gctransform.c.