Extension: Geometries
#include "dg/geometries/geometries.h"
guenter.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <cmath>
5#include <vector>
6
7#include "dg/blas.h"
8
9#include "magnetic_field.h"
10
15namespace dg
16{
17namespace geo
18{
22namespace guenter
23{
26
27
31struct Psip : public aCylindricalFunctor<Psip>
32{
33 Psip(double R_0 ): R_0(R_0) {}
34 double do_compute(double R, double Z) const
35 {
36 return cos(M_PI*0.5*(R-R_0))*cos(M_PI*Z*0.5);
37 }
38 private:
39 double R_0;
40};
44struct PsipR : public aCylindricalFunctor<PsipR>
45{
46 PsipR(double R_0 ): R_0(R_0) {}
47 double do_compute(double R, double Z) const
48 {
49 return -M_PI*0.5*sin(M_PI*0.5*(R-R_0))*cos(M_PI*Z*0.5);
50 }
51 private:
52 double R_0;
53};
57struct PsipRR : public aCylindricalFunctor<PsipRR>
58{
59 PsipRR(double R_0 ): R_0(R_0) {}
60 double do_compute(double R, double Z) const
61 {
62 return -M_PI*M_PI*0.25*cos(M_PI*0.5*(R-R_0))*cos(M_PI*Z*0.5);
63 }
64 private:
65 double R_0;
66};
70struct PsipZ : public aCylindricalFunctor<PsipZ>
71
72{
73 PsipZ(double R_0 ): R_0(R_0) {}
74 double do_compute(double R, double Z) const
75 {
76 return -M_PI*0.5*cos(M_PI*0.5*(R-R_0))*sin(M_PI*Z*0.5);
77 }
78 private:
79 double R_0;
80};
84struct PsipZZ : public aCylindricalFunctor<PsipZZ>
85{
86 PsipZZ(double R_0 ): R_0(R_0){}
87 double do_compute(double R, double Z) const
88 {
89 return -M_PI*M_PI*0.25*cos(M_PI*0.5*(R-R_0))*cos(M_PI*Z*0.5);
90 }
91 private:
92 double R_0;
93};
97struct PsipRZ : public aCylindricalFunctor<PsipRZ>
98{
99 PsipRZ(double R_0 ): R_0(R_0) {}
100 double do_compute(double R, double Z) const
101 {
102 return M_PI*M_PI*0.25*sin(M_PI*0.5*(R-R_0))*sin(M_PI*Z*0.5);
103 }
104 private:
105 double R_0;
106};
107
111struct Ipol : public aCylindricalFunctor<Ipol>
112{
113 Ipol( double I_0): I_0(I_0) {}
114 double do_compute(double R, double Z) const { return I_0; }
115 private:
116 double I_0;
117};
121struct IpolR : public aCylindricalFunctor<IpolR>
122{
123 IpolR( ) {}
124 double do_compute(double R, double Z) const { return 0; }
125 private:
126};
130struct IpolZ : public aCylindricalFunctor<IpolZ>
131{
132 IpolZ( ) {}
133 double do_compute(double R, double Z) const { return 0; }
134 private:
135};
136
137static inline CylindricalFunctorsLvl2 createPsip( double R_0)
138{
139 return CylindricalFunctorsLvl2( Psip(R_0), PsipR(R_0), PsipZ(R_0),
140 PsipRR(R_0), PsipRZ(R_0), PsipZZ(R_0));
141}
142static inline CylindricalFunctorsLvl1 createIpol( double I_0)
143{
144 return CylindricalFunctorsLvl1( Ipol(I_0), IpolR(), IpolZ());
145}
147} //namespace guenter
148
158static inline dg::geo::TokamakMagneticField createGuenterField( double R_0, double I_0)
159{
160 MagneticFieldParameters params = { 1., 1., 0.,
162 return TokamakMagneticField( R_0, guenter::createPsip(R_0), guenter::createIpol(I_0), params);
163}
164} //namespace geo
165}//namespace dg
#define M_PI
static CylindricalFunctorsLvl2 createPsip(double R_0)
Definition: guenter.h:137
static CylindricalFunctorsLvl1 createIpol(double I_0)
Definition: guenter.h:142
static dg::geo::TokamakMagneticField createGuenterField(double R_0, double I_0)
Create a Guenter Magnetic field.
Definition: guenter.h:158
@ none
no modification
@ guenter
dg::geo::guenter::Psip
@ square
closed flux surfaces centered around an O-point and bordered by a square with four X-points in the co...
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: guenter.h:112
double do_compute(double R, double Z) const
Definition: guenter.h:114
Ipol(double I_0)
Definition: guenter.h:113
Definition: guenter.h:122
double do_compute(double R, double Z) const
Definition: guenter.h:124
IpolR()
Definition: guenter.h:123
Definition: guenter.h:131
double do_compute(double R, double Z) const
Definition: guenter.h:133
IpolZ()
Definition: guenter.h:132
Definition: guenter.h:32
Psip(double R_0)
Definition: guenter.h:33
double do_compute(double R, double Z) const
Definition: guenter.h:34
Definition: guenter.h:45
PsipR(double R_0)
Definition: guenter.h:46
double do_compute(double R, double Z) const
Definition: guenter.h:47
Definition: guenter.h:58
PsipRR(double R_0)
Definition: guenter.h:59
double do_compute(double R, double Z) const
Definition: guenter.h:60
Definition: guenter.h:98
PsipRZ(double R_0)
Definition: guenter.h:99
double do_compute(double R, double Z) const
Definition: guenter.h:100
Definition: guenter.h:72
PsipZ(double R_0)
Definition: guenter.h:73
double do_compute(double R, double Z) const
Definition: guenter.h:74
Definition: guenter.h:85
PsipZZ(double R_0)
Definition: guenter.h:86
double do_compute(double R, double Z) const
Definition: guenter.h:87