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.* Rn *Zn2 + 12. *Rn3*lgRn - 24.* Rn *Zn2*lgRn)* m_c[4]
126 + (6 *Rn5 - 48 *Rn3 *Zn2 + 16.* Rn *Zn4)*m_c[5]
127 + (-15. *Rn5 + 480. *Rn3 *Zn2 - 400.* Rn *Zn4 - 90. *Rn5*lgRn +
128 720. *Rn3 *Zn2*lgRn - 240.* Rn *Zn4*lgRn)* m_c[6] +
129 2.* Rn *Zn *m_c[8] + (-3. *Rn *Zn - 6.* Rn* Zn*lgRn)* m_c[9] + (12. *Rn3* Zn - 8.* Rn *Zn3)* m_c[10] + (-120. *Rn3* Zn - 80.* Rn *Zn3 + 240. *Rn3* Zn*lgRn -
130 160.* Rn *Zn3*lgRn) *m_c[11]
134 double m_R0, m_A, m_pp;
135 std::vector<double> m_c;
160 double Rn,Rn2,Rn4,Zn,Zn2,Zn3,Zn4,lgRn;
161 Rn = R/m_R0; Rn2 = Rn*Rn; Rn4 = Rn2*Rn2;
162 Zn = Z/m_R0; Zn2 =Zn*Zn; Zn3 = Zn2*Zn; Zn4 = Zn2*Zn2;
164 return m_pp/m_R0*( (3.* Rn2)/2. + (3./2. - (3. *Rn2)/2. +lgRn) *m_A + 2.* m_c[1] + (-3. - 2.*lgRn)* m_c[2] + (12. *Rn2 - 8. *Zn2) *m_c[3] +
165 (21. *Rn2 - 54. *Zn2 + 36. *Rn2*lgRn - 24. *Zn2*lgRn)* m_c[4]
166 + (30. *Rn4 - 144. *Rn2 *Zn2 + 16.*Zn4)*m_c[5] + (-165. *Rn4 + 2160. *Rn2 *Zn2 - 640. *Zn4 - 450. *Rn4*lgRn +
167 2160. *Rn2 *Zn2*lgRn - 240. *Zn4*lgRn)* m_c[6] +
168 2.* Zn* m_c[8] + (-9. *Zn - 6.* Zn*lgRn) *m_c[9]
169 + (36. *Rn2* Zn - 8. *Zn3) *m_c[10]
170 + (-120. *Rn2* Zn - 240. *Zn3 + 720. *Rn2* Zn*lgRn - 160. *Zn3*lgRn)* m_c[11]);
173 double m_R0, m_A, m_pp;
174 std::vector<double> m_c;
196 double Rn,Rn2,Rn4,Zn,Zn2,Zn3,Zn4,Zn5,lgRn;
197 Rn = R/m_R0; Rn2 = Rn*Rn; Rn4 = Rn2*Rn2;
198 Zn = Z/m_R0; Zn2 = Zn*Zn; Zn3 = Zn2*Zn; Zn4 = Zn2*Zn2; Zn5 = Zn3*Zn2;
201 return m_pp*(2.* Zn* m_c[2]
202 - 8. *Rn2* Zn* m_c[3] +
203 ((-18.)*Rn2 *Zn + 8. *Zn3 - 24. *Rn2* Zn*lgRn) *m_c[4]
204 + ((-24.) *Rn4* Zn + 32. *Rn2 *Zn3)* m_c[5]
205 + (150. *Rn4* Zn - 560. *Rn2 *Zn3 + 48. *Zn5 + 360. *Rn4* Zn*lgRn - 480. *Rn2 *Zn3*lgRn)* m_c[6]
208 + (3. *Zn2 - 3. *Rn2*lgRn)* m_c[9]
209 + (3. *Rn4 - 12. *Rn2 *Zn2) *m_c[10]
210 + ((-45.)*Rn4 + 40. *Zn4 + 60. *Rn4*lgRn - 240. *Rn2 *Zn2*lgRn)* m_c[11]);
215 std::vector<double> m_c;
234 double Rn,Rn2,Rn4,Zn,Zn2,Zn3,Zn4,lgRn;
235 Rn = R/m_R0; Rn2 = Rn*Rn; Rn4 = Rn2*Rn2;
236 Zn = Z/m_R0; Zn2 =Zn*Zn; Zn3 = Zn2*Zn; Zn4 = Zn2*Zn2;
238 return m_pp/m_R0*( 2.* m_c[2] - 8. *Rn2* m_c[3] + (-18. *Rn2 + 24. *Zn2 - 24. *Rn2*lgRn) *m_c[4] + (-24.*Rn4 + 96. *Rn2 *Zn2) *m_c[5]
239 + (150. *Rn4 - 1680. *Rn2 *Zn2 + 240. *Zn4 + 360. *Rn4*lgRn - 1440. *Rn2 *Zn2*lgRn)* m_c[6] + 6.* Zn* m_c[9] - 24. *Rn2 *Zn *m_c[10] + (160. *Zn3 - 480. *Rn2* Zn*lgRn) *m_c[11]);
243 std::vector<double> m_c;
264 double Rn,Rn2,Rn3,Zn,Zn2,Zn3,lgRn;
265 Rn = R/m_R0; Rn2 = Rn*Rn; Rn3 = Rn2*Rn;
266 Zn = Z/m_R0; Zn2 =Zn*Zn; Zn3 = Zn2*Zn;
269 -16.* Rn* Zn* m_c[3] + (-60.* Rn* Zn - 48.* Rn* Zn*lgRn)* m_c[4] + (-96. *Rn3* Zn + 64.*Rn *Zn3)* m_c[5]
270 + (960. *Rn3 *Zn - 1600.* Rn *Zn3 + 1440. *Rn3* Zn*lgRn - 960. *Rn *Zn3*lgRn) *m_c[6] + 2.* Rn* m_c[8] + (-3.* Rn - 6.* Rn*lgRn)* m_c[9]
271 + (12. *Rn3 - 24.* Rn *Zn2) *m_c[10] + (-120. *Rn3 - 240. *Rn *Zn2 + 240. *Rn3*lgRn - 480.* Rn *Zn2*lgRn)* m_c[11]
276 std::vector<double> m_c;
292 Ipol(
Parameters gp, std::function<
double(
double,
double)> psip ): m_R0(gp.R_0), m_A(gp.A), m_pp(gp.pp), m_pi(gp.pi), m_psip(psip) {
298 return m_pi*sqrt(-2.*m_A* m_psip(R,Z) /m_R0/m_pp + 1.);
301 double m_R0, m_A, m_pp, m_pi;
302 std::function<double(
double,
double)> m_psip;
313 IpolR(
Parameters gp, std::function<
double(
double,
double)> psip, std::function<
double(
double,
double)> psipR ):
314 m_R0(gp.R_0), m_A(gp.A), m_pp(gp.pp), m_pi(gp.pi), m_psip(psip), m_psipR(psipR) {
320 return -m_pi/sqrt(-2.*m_A* m_psip(R,Z) /m_R0/m_pp + 1.)*(m_A*m_psipR(R,Z)/m_R0/m_pp);
323 double m_R0, m_A, m_pp, m_pi;
324 std::function<double(
double,
double)> m_psip, m_psipR;
335 IpolZ(
Parameters gp, std::function<
double(
double,
double)> psip, std::function<
double(
double,
double)> psipZ ):
336 m_R0(gp.R_0), m_A(gp.A), m_pp(gp.pp), m_pi(gp.pi), m_psip(psip), m_psipZ(psipZ) {
342 return -m_pi/sqrt(-2.*m_A* m_psip(R,Z) /m_R0/m_pp + 1.)*(m_A*m_psipZ(R,Z)/m_R0/m_pp);
345 double m_R0, m_A, m_pp, m_pi;
346 std::function<double(
double,
double)> m_psip, m_psipZ;
@ heaviside
Psip is dampened to a constant outside a critical value.
@ solovev
dg::geo::solovev::Psip
static dg::geo::CylindricalFunctorsLvl2 createPsip(const std::function< bool(double, double)> predicate, const CylindricalFunctorsLvl2 &psip, double psi0, double alpha, double sign=-1)
Definition: modified.h:175
static dg::geo::CylindricalFunctorsLvl1 createIpol(const Parameters &gp, const CylindricalFunctorsLvl1 &psip)
Definition: solovev.h:354
static dg::geo::TokamakMagneticField createModifiedSolovevField(dg::geo::solovev::Parameters gp, double psi0, double alpha, double sign=-1)
DEPRECATED Create a modified Solovev Magnetic field.
Definition: solovev.h:400
static dg::geo::TokamakMagneticField createSolovevField(dg::geo::solovev::Parameters gp)
Create a Solovev Magnetic field.
Definition: solovev.h:375
static dg::geo::CylindricalFunctorsLvl2 createPsip(const Parameters &gp)
Definition: solovev.h:349
This struct bundles a function and its first derivatives.
Definition: fluxfunctions.h:182
const CylindricalFunctor & dfx() const
Definition: fluxfunctions.h:205
const CylindricalFunctor & f() const
Definition: fluxfunctions.h:203
const CylindricalFunctor & dfy() const
Definition: fluxfunctions.h:207
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: solovev.h:285
Ipol(Parameters gp, std::function< double(double, double)> psip)
Construct from given geometric parameters.
Definition: solovev.h:292
double do_compute(double R, double Z) const
Definition: solovev.h:296
Definition: solovev.h:308
IpolR(Parameters gp, std::function< double(double, double)> psip, std::function< double(double, double)> psipR)
Construct from given geometric parameters.
Definition: solovev.h:313
double do_compute(double R, double Z) const
Definition: solovev.h:318
Definition: solovev.h:330
IpolZ(Parameters gp, std::function< double(double, double)> psip, std::function< double(double, double)> psipZ)
Construct from given geometric parameters.
Definition: solovev.h:335
double do_compute(double R, double Z) const
Definition: solovev.h:340
Constructs and display geometric parameters for the solovev and taylor fields.
Definition: solovev_parameters.h:46
double pp
prefactor for Psi_p
Definition: solovev_parameters.h:49
double R_0
major tokamak radius
Definition: solovev_parameters.h:48
double a
little tokamak radius
Definition: solovev_parameters.h:51
std::string description
Definition: solovev_parameters.h:55
double elongation
elongation of the magnetic surfaces
Definition: solovev_parameters.h:52
double triangularity
triangularity of the magnetic surfaces
Definition: solovev_parameters.h:53
double do_compute(double R, double Z) const
Definition: solovev.h:68
Psip(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:67
Definition: solovev.h:114
double do_compute(double R, double Z) const
Definition: solovev.h:117
PsipR(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:116
Definition: solovev.h:155
double do_compute(double R, double Z) const
Definition: solovev.h:158
PsipRR(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:157
Definition: solovev.h:259
double do_compute(double R, double Z) const
Definition: solovev.h:262
PsipRZ(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:261
Definition: solovev.h:191
PsipZ(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:193
double do_compute(double R, double Z) const
Definition: solovev.h:194
Definition: solovev.h:229
PsipZZ(Parameters gp)
Construct from given geometric parameters.
Definition: solovev.h:231
double do_compute(double R, double Z) const
Definition: solovev.h:232