Extension: Geometries
#include "dg/geometries/geometries.h"
toroidal.h
Go to the documentation of this file.
1#pragma once
2
3#include "magnetic_field.h"
4
5namespace dg{
6namespace geo{
7namespace toroidal{
8
11
16{
18 return psip;
19}
25{
27 return ipol;
28}
29
31
32}//namespace toroidal
33namespace circular{
34
37
41struct Psip : public aCylindricalFunctor<Psip>
42{
48 Psip( double R0, double a, double b): m_R0(R0), m_a(a), m_b(b) { }
49 double do_compute(double R, double Z) const
50 {
51 return 1. - (R-m_R0)*(R-m_R0)/m_a/m_a - Z*Z/m_b/m_b;
52 }
53 private:
54 double m_R0, m_a, m_b;
55};
57struct PsipR : public aCylindricalFunctor<PsipR>
58{
63 PsipR( double R0, double a): m_R0(R0), m_a(a) { }
64 double do_compute(double R, double Z) const
65 {
66 return -2*(R-m_R0)/m_a/m_a;
67 }
68 private:
69 double m_R0, m_a;
70};
72struct PsipZ : public aCylindricalFunctor<PsipZ>
73{
74 PsipZ( double b): m_b(b) { }
75 double do_compute(double R, double Z) const
76 {
77 return -2*Z/m_b/m_b;
78 }
79 private:
80 double m_b;
81};
82
91static inline CylindricalFunctorsLvl2 createPsip( double R0, double a , double b )
92{
93 return CylindricalFunctorsLvl2( Psip(R0, a, b), PsipR(R0, a), PsipZ(b),
94 Constant(-2./a/a), Constant(0), Constant(-2./b/b));
95}
100static inline CylindricalFunctorsLvl1 createIpol( double I0 )
101{
103 return ipol;
104}
106}//namespace circular
107
119{
120 MagneticFieldParameters params = { 1., 1., 0.,
123}
136static inline dg::geo::TokamakMagneticField createCircularField( double R0, double I0, double a = 1, double b = 1)
137{
138 MagneticFieldParameters params = { a, 1., 0.,
140 return TokamakMagneticField( R0, circular::createPsip(R0, a, b), circular::createIpol(I0), params);
141}
142
143}//namespace geo
144}//namespace dg
static CylindricalFunctorsLvl2 createPsip(double R0, double a, double b)
gives ellipsoid flux surfaces
Definition: toroidal.h:91
static dg::geo::TokamakMagneticField createCircularField(double R0, double I0, double a=1, double b=1)
Definition: toroidal.h:136
static CylindricalFunctorsLvl1 createIpol(double I0)
constant
Definition: toroidal.h:100
@ none
no modification
@ toroidal
dg::geo::createToroidalField
@ circular
dg::geo::circular::Psip
@ none
no shaping: Purely toroidal magnetic field
@ standardO
closed flux surfaces centered around an O-point located near (R_0, 0); flux-aligned grids can be cons...
static dg::geo::TokamakMagneticField createToroidalField(double R0)
Create a Toroidal Magnetic field.
Definition: toroidal.h:118
static CylindricalFunctorsLvl1 createIpol()
constant
Definition: toroidal.h:24
static CylindricalFunctorsLvl2 createPsip()
constant
Definition: toroidal.h:15
Definition: fluxfunctions.h:114
This struct bundles a function and its first derivatives.
Definition: fluxfunctions.h:182
This struct bundles a function and its first and second derivatives.
Definition: fluxfunctions.h:219
Meta-data about the magnetic field in particular the flux function.
Definition: magnetic_field.h:91
A tokamak field as given by R0, Psi and Ipol plus Meta-data like shape and equilibrium.
Definition: magnetic_field.h:162
Represent functions written in cylindrical coordinates that are independent of the angle phi serving ...
Definition: fluxfunctions.h:66
Definition: toroidal.h:42
double do_compute(double R, double Z) const
Definition: toroidal.h:49
Psip(double R0, double a, double b)
Construct from major radius.
Definition: toroidal.h:48
Definition: toroidal.h:58
PsipR(double R0, double a)
Construct from major radius.
Definition: toroidal.h:63
double do_compute(double R, double Z) const
Definition: toroidal.h:64
Definition: toroidal.h:73
PsipZ(double b)
Definition: toroidal.h:74
double do_compute(double R, double Z) const
Definition: toroidal.h:75