Extension: Geometries
#include "dg/geometries/geometries.h"
3.2 Magnetic field, curvatures and associated functors
Collaboration diagram for 3.2 Magnetic field, curvatures and associated functors:

Classes

struct  dg::geo::MagneticFieldParameters
 Meta-data about the magnetic field in particular the flux function. More...
 
struct  dg::geo::TokamakMagneticField
 A tokamak field as given by R0, Psi and Ipol plus Meta-data like shape and equilibrium. More...
 
struct  dg::geo::LaplacePsip
 \( \Delta\psi_p = \psi_R/R + \psi_{RR}+\psi_{ZZ} \) More...
 
struct  dg::geo::Bmodule
 \( |B| = R_0\sqrt{I^2+(\nabla\psi)^2}/R \) More...
 
struct  dg::geo::InvB
 \( |B|^{-1} = R/R_0\sqrt{I^2+(\nabla\psi)^2} \) More...
 
struct  dg::geo::LnB
 \( \ln{|B|} \) More...
 
struct  dg::geo::BR
 \( \frac{\partial |B| }{ \partial R} \) More...
 
struct  dg::geo::BZ
 \( \frac{\partial |B| }{ \partial Z} \) More...
 
struct  dg::geo::CurvatureNablaBR
 Approximate \( \mathcal{K}^{R}_{\nabla B} \). More...
 
struct  dg::geo::CurvatureNablaBZ
 Approximate \( \mathcal{K}^{Z}_{\nabla B} \). More...
 
struct  dg::geo::CurvatureKappaR
 Approximate \( \mathcal{K}^{R}_{\vec{\kappa}}=0 \). More...
 
struct  dg::geo::CurvatureKappaZ
 Approximate \( \mathcal{K}^{Z}_{\vec{\kappa}} \). More...
 
struct  dg::geo::DivCurvatureKappa
 Approximate \( \vec{\nabla}\cdot \mathcal{K}_{\vec{\kappa}} \). More...
 
struct  dg::geo::DivCurvatureNablaB
 Approximate \( \vec{\nabla}\cdot \mathcal{K}_{\nabla B} \). More...
 
struct  dg::geo::TrueCurvatureNablaBR
 True \( \mathcal{K}^{R}_{\nabla B} \). More...
 
struct  dg::geo::TrueCurvatureNablaBZ
 True \( \mathcal{K}^{Z}_{\nabla B} \). More...
 
struct  dg::geo::TrueCurvatureNablaBP
 True \( \mathcal{K}^{\varphi}_{\nabla B} \). More...
 
struct  dg::geo::TrueCurvatureKappaR
 True \( \mathcal{K}^R_{\vec{\kappa}} \). More...
 
struct  dg::geo::TrueCurvatureKappaZ
 True \( \mathcal{K}^Z_{\vec{\kappa}} \). More...
 
struct  dg::geo::TrueCurvatureKappaP
 True \( \mathcal{K}^\varphi_{\vec{\kappa}} \). More...
 
struct  dg::geo::TrueDivCurvatureKappa
 True \( \vec{\nabla}\cdot \mathcal{K}_{\vec{\kappa}} \). More...
 
struct  dg::geo::TrueDivCurvatureNablaB
 True \( \vec{\nabla}\cdot \mathcal{K}_{\nabla B} \). More...
 
struct  dg::geo::GradLnB
 \( \nabla_\parallel \ln{(B)} \) More...
 
struct  dg::geo::Divb
 \( \nabla \cdot \vec b \) More...
 
struct  dg::geo::BFieldP
 \( B^\varphi = R_0I/R^2\) More...
 
struct  dg::geo::BFieldR
 \( B^R = R_0\psi_Z /R\) More...
 
struct  dg::geo::BFieldZ
 \( B^Z = -R_0\psi_R /R\) More...
 
struct  dg::geo::BFieldT
 \( B^{\theta} = B^R\partial_R\theta + B^Z\partial_Z\theta\) More...
 
struct  dg::geo::BHatR
 \( b^R = B^R/|B|\) More...
 
struct  dg::geo::BHatZ
 \( b^Z = B^Z/|B|\) More...
 
struct  dg::geo::BHatP
 \( \hat b^\varphi = B^\varphi/|B|\) More...
 
struct  dg::geo::BHatRR
 \( \partial_R b^R\) More...
 
struct  dg::geo::BHatRZ
 \( \partial_Z b^R\) More...
 
struct  dg::geo::BHatZR
 \( \partial_R b^Z\) More...
 
struct  dg::geo::BHatZZ
 \( \partial_Z b^Z\) More...
 
struct  dg::geo::BHatPR
 \( \partial_R \hat b^\varphi\) More...
 
struct  dg::geo::BHatPZ
 \( \partial_Z \hat b^\varphi\) More...
 
struct  dg::geo::DivVVP
 \( \nabla\cdot\left( \frac{ \hat b }{\hat b^\varphi}\right)\) More...
 
struct  dg::geo::RhoP
 
struct  dg::geo::Hoo
 Inertia factor \( \mathcal I_0 = B^2/(R_0^2|\nabla\psi_p|^2)\). More...
 
struct  dg::geo::WallDirection
 Determine if poloidal field points towards or away from the nearest wall. More...
 

Enumerations

enum class  dg::geo::equilibrium {
  dg::geo::equilibrium::solovev , dg::geo::equilibrium::taylor , dg::geo::equilibrium::polynomial , dg::geo::equilibrium::guenter ,
  dg::geo::equilibrium::toroidal , dg::geo::equilibrium::circular
}
 How flux-function is computed. Decides how to construct magnetic field. More...
 
enum class  dg::geo::modifier { dg::geo::modifier::none , dg::geo::modifier::heaviside , dg::geo::modifier::sol_pfr }
 How flux-function is modified. More...
 
enum class  dg::geo::description {
  dg::geo::description::standardO , dg::geo::description::standardX , dg::geo::description::doubleX , dg::geo::description::none ,
  dg::geo::description::square , dg::geo::description::centeredX
}
 How flux function looks like. Decider on whether and what flux aligned grid to construct. More...
 

Functions

static TokamakMagneticField dg::geo::periodify (const TokamakMagneticField &mag, double R0, double R1, double Z0, double Z1, dg::bc bcx, dg::bc bcy)
 Use dg::geo::Periodify to periodify every function in the magnetic field. More...
 
CylindricalVectorLvl1 dg::geo::createEPhi (int sign)
 Contravariant components of the unit vector field (0, 0, +/- 1/R) and its Divergence and derivative (0,0) in cylindrical coordinates. More...
 
CylindricalVectorLvl0 dg::geo::createCurvatureNablaB (const TokamakMagneticField &mag, int sign)
 Approximate curvature vector field (CurvatureNablaBR, CurvatureNablaBZ, Constant(0)) More...
 
CylindricalVectorLvl0 dg::geo::createCurvatureKappa (const TokamakMagneticField &mag, int sign)
 Approximate curvature vector field (CurvatureKappaR, CurvatureKappaZ, Constant(0)) More...
 
CylindricalVectorLvl0 dg::geo::createTrueCurvatureKappa (const TokamakMagneticField &mag)
 True curvature vector field (TrueCurvatureKappaR, TrueCurvatureKappaZ, TrueCurvatureKappaP) More...
 
CylindricalVectorLvl0 dg::geo::createTrueCurvatureNablaB (const TokamakMagneticField &mag)
 True curvature vector field (TrueCurvatureNablaBR, TrueCurvatureNablaBZ, TrueCurvatureNablaBP) More...
 
CylindricalVectorLvl0 dg::geo::createGradPsip (const TokamakMagneticField &mag)
 Gradient Psip vector field (PsipR, PsipZ, 0) More...
 
CylindricalVectorLvl1 dg::geo::createBHat (const TokamakMagneticField &mag)
 Contravariant components of the magnetic unit vector field and its Divergence and derivative in cylindrical coordinates. More...
 

Detailed Description

Enumeration Type Documentation

◆ description

enum class dg::geo::description
strong

How flux function looks like. Decider on whether and what flux aligned grid to construct.

The reason for this enum is that it is very hard to automatically detect if the construction of a flux aligned X-grid is possible, but for a human it is very easy to see.

Enumerator
standardO 

closed flux surfaces centered around an O-point located near (R_0, 0); flux-aligned grids can be constructed

standardX 

closed flux surfaces centered around an O-point located near (R_0, 0) and bordered by a separatrix with a single X-point; flux-aligned X-grids can be constructed

doubleX 

closed flux surfaces centered around an O-point located near (R_0, 0) and bordered by a separatrix with two X-points; flux-aligned X-grids cannnot be constructed

none 

no shaping: Purely toroidal magnetic field

square 

closed flux surfaces centered around an O-point and bordered by a square with four X-points in the corners (mainly the Guenter field)

centeredX 

one X-point in the middle, no O-point, only open flux surfaces, X-grids cannot be constructed

◆ equilibrium

enum class dg::geo::equilibrium
strong

How flux-function is computed. Decides how to construct magnetic field.

Enumerator
solovev 

dg::geo::solovev::Psip

taylor 

dg::geo::taylor::Psip

polynomial 

dg::geo::polynomial::Psip

guenter 

dg::geo::guenter::Psip

toroidal 

dg::geo::createToroidalField

circular 

dg::geo::circular::Psip

◆ modifier

enum class dg::geo::modifier
strong

How flux-function is modified.

Enumerator
none 

no modification

heaviside 

Psip is dampened to a constant outside a critical value.

sol_pfr 

Psip is dampened in the SOL and PFR regions but not in the closed field line region.

Function Documentation

◆ createBHat()

CylindricalVectorLvl1 dg::geo::createBHat ( const TokamakMagneticField mag)
inline

Contravariant components of the magnetic unit vector field and its Divergence and derivative in cylindrical coordinates.

Parameters
magthe tokamak magnetic field
Returns
the tuple BHatR, BHatZ, BHatP, Divb, DivVVP constructed from mag

◆ createCurvatureKappa()

CylindricalVectorLvl0 dg::geo::createCurvatureKappa ( const TokamakMagneticField mag,
int  sign 
)
inline

Approximate curvature vector field (CurvatureKappaR, CurvatureKappaZ, Constant(0))

Parameters
magthe tokamak magnetic field
signindicate positive or negative unit vector in approximation
Returns
the tuple CurvatureKappaR, CurvatureKappaZ, dg::geo::Constant(0) constructed from mag
Note
The contravariant components in cylindrical coordinates

◆ createCurvatureNablaB()

CylindricalVectorLvl0 dg::geo::createCurvatureNablaB ( const TokamakMagneticField mag,
int  sign 
)
inline

Approximate curvature vector field (CurvatureNablaBR, CurvatureNablaBZ, Constant(0))

Parameters
magthe tokamak magnetic field
signindicate positive or negative unit vector in approximation
Returns
the tuple CurvatureNablaBR, CurvatureNablaBZ, dg::geo::Constant(0) constructed from mag
Note
The contravariant components in cylindrical coordinates

◆ createEPhi()

CylindricalVectorLvl1 dg::geo::createEPhi ( int  sign)
inline

Contravariant components of the unit vector field (0, 0, +/- 1/R) and its Divergence and derivative (0,0) in cylindrical coordinates.

Parameters
signindicate positive or negative unit vector
Returns
the tuple dg::geo::Constant(0), dg::geo::Constant(0), \( 1/R \), Constant(0), Constant(0)
Note
This is equivalent to inserting a toroidal magnetic field into the dg::geo::createBHat function.

◆ createGradPsip()

CylindricalVectorLvl0 dg::geo::createGradPsip ( const TokamakMagneticField mag)
inline

Gradient Psip vector field (PsipR, PsipZ, 0)

Parameters
magthe tokamak magnetic field
Returns
the tuple PsipR, PsipZ, 0 constructed from mag
Note
The contravariant components in cylindrical coordinates

◆ createTrueCurvatureKappa()

CylindricalVectorLvl0 dg::geo::createTrueCurvatureKappa ( const TokamakMagneticField mag)
inline

True curvature vector field (TrueCurvatureKappaR, TrueCurvatureKappaZ, TrueCurvatureKappaP)

Parameters
magthe tokamak magnetic field
Returns
the tuple TrueCurvatureKappaR, TrueCurvatureKappaZ, TrueCurvatureKappaP constructed from mag
Note
The contravariant components in cylindrical coordinates

◆ createTrueCurvatureNablaB()

CylindricalVectorLvl0 dg::geo::createTrueCurvatureNablaB ( const TokamakMagneticField mag)
inline

True curvature vector field (TrueCurvatureNablaBR, TrueCurvatureNablaBZ, TrueCurvatureNablaBP)

Parameters
magthe tokamak magnetic field
Returns
the tuple TrueCurvatureNablaBR, TrueCurvatureNablaBZ, TrueCurvatureNablaBP constructed from mag
Note
The contravariant components in cylindrical coordinates

◆ periodify()

static TokamakMagneticField dg::geo::periodify ( const TokamakMagneticField mag,
double  R0,
double  R1,
double  Z0,
double  Z1,
dg::bc  bcx,
dg::bc  bcy 
)
inlinestatic

Use dg::geo::Periodify to periodify every function in the magnetic field.

Note that derivatives are periodified with dg::inverse boundary conditions

Parameters
magThe magnetic field to periodify
R0left boundary in R
R1right boundary in R
Z0lower boundary in Z
Z1upper boundary in Z
bcxboundary condition in x (determines how function is periodified)
bcyboundary condition in y (determines how function is periodified)
Attention
So far this was only tested for Neumann boundary conditions. It is uncertain if Dirichlet boundary conditions work
Returns
new periodified magnetic field