7#include "dg/algorithm.h"
55 return m_R0*m_pp*(*m_horner)( R/m_R0,Z/m_R0);
59 std::shared_ptr<Horner2d> m_horner;
66 std::vector<double> beta ( (gp.
M-1)*gp.
N);
67 for(
unsigned i=0; i<gp.
M-1; i++)
68 for(
unsigned j=0; j<gp.
N; j++)
69 beta[i*gp.
N+j] = (
double)(i+1)*gp.
c[ ( i+1)*gp.
N +j];
70 m_horner = std::make_shared<Horner2d>( beta, gp.
M-1, gp.
N);
74 return m_pp*(*m_horner)( R/m_R0,Z/m_R0);
78 std::shared_ptr<Horner2d> m_horner;
84 std::vector<double> beta ( (gp.
M-2)*gp.
N);
85 for(
unsigned i=0; i<gp.
M-2; i++)
86 for(
unsigned j=0; j<gp.
N; j++)
87 beta[i*gp.
N+j] = (
double)((i+2)*(i+1))*gp.
c[ (i+2)*gp.
N +j];
88 m_horner = std::make_shared<Horner2d>( beta, gp.
M-2, gp.
N);
92 return m_pp/m_R0*(*m_horner)( R/m_R0,Z/m_R0);
96 std::shared_ptr<Horner2d> m_horner;
102 std::vector<double> beta ( gp.
M*(gp.
N-1));
103 for(
unsigned i=0; i<gp.
M; i++)
104 for(
unsigned j=0; j<gp.
N-1; j++)
105 beta[i*(gp.
N-1)+j] = (double)(j+1)*gp.
c[ i*gp.
N +j+1];
106 m_horner = std::make_shared<Horner2d>( beta, gp.
M, gp.
N-1);
110 return m_pp*(*m_horner)( R/m_R0,Z/m_R0);
114 std::shared_ptr<Horner2d> m_horner;
120 std::vector<double> beta ( gp.
M*(gp.
N-2));
121 for(
unsigned i=0; i<gp.
M; i++)
122 for(
unsigned j=0; j<gp.
N-2; j++)
123 beta[i*(gp.
N-2)+j] = (double)((j+2)*(j+1))*gp.
c[ i*gp.
N +j+2];
124 m_horner = std::make_shared<Horner2d>( beta, gp.
M, gp.
N-2);
128 return m_pp/m_R0*(*m_horner)(R/m_R0,Z/m_R0);
132 std::shared_ptr<Horner2d> m_horner;
138 std::vector<double> beta ( (gp.
M-1)*(gp.
N-1));
139 for(
unsigned i=0; i<gp.
M-1; i++)
140 for(
unsigned j=0; j<gp.
N-1; j++)
141 beta[i*(gp.
N-1)+j] = (double)((j+1)*(i+1))*gp.
c[ (i+1)*gp.
N +j+1];
142 m_horner = std::make_shared<Horner2d>( beta, gp.
M-1, gp.
N-1);
146 return m_pp/m_R0*(*m_horner)(R/m_R0,Z/m_R0);
150 std::shared_ptr<Horner2d> m_horner;
@ polynomial
dg::geo::polynomial::Psip
dg::geo::CylindricalFunctorsLvl2 createPsip(const Parameters &gp)
Definition polynomial.h:153
dg::geo::TokamakMagneticField createPolynomialField(const dg::geo::polynomial::Parameters &gp)
Create a Polynomial Magnetic field.
Definition polynomial.h:183
dg::geo::CylindricalFunctorsLvl1 createIpol(const Parameters &gp)
Definition polynomial.h:158
Definition fluxfunctions.h:113
This struct bundles a function and its first derivatives.
Definition fluxfunctions.h:185
This struct bundles a function and its first and second derivatives.
Definition fluxfunctions.h:222
Meta-data about the magnetic field in particular the flux function.
Definition magnetic_field.h:101
A tokamak field as given by R0, Psi and Ipol plus Meta-data like shape and equilibrium.
Definition magnetic_field.h:172
Represent functions written in cylindrical coordinates that are independent of the angle phi serving ...
Definition fluxfunctions.h:66
Constructs and display geometric parameters for the polynomial fields.
Definition polynomial_parameters.h:43
std::string description
Definition polynomial_parameters.h:53
double triangularity
triangularity of the magnetic surfaces
Definition polynomial_parameters.h:49
std::vector< double > c
M*N coefficients for the polynomial equilibrium, c[i*N+j] corresponds to R^i Z^j;.
Definition polynomial_parameters.h:52
double R_0
major tokamak radius
Definition polynomial_parameters.h:44
double a
little tokamak radius
Definition polynomial_parameters.h:47
unsigned N
number of coefficients in Z
Definition polynomial_parameters.h:51
double elongation
elongation of the magnetic surfaces
Definition polynomial_parameters.h:48
unsigned M
number of coefficients in R
Definition polynomial_parameters.h:50
double pi
prefactor for current I
Definition polynomial_parameters.h:46
Definition polynomial.h:38
Psip(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:44
double do_compute(double R, double Z) const
Definition polynomial.h:45
Definition polynomial.h:63
PsipR(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:65
double do_compute(double R, double Z) const
Definition polynomial.h:72
Definition polynomial.h:81
PsipRR(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:83
double do_compute(double R, double Z) const
Definition polynomial.h:90
Definition polynomial.h:135
double do_compute(double R, double Z) const
Definition polynomial.h:144
PsipRZ(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:137
Definition polynomial.h:99
PsipZ(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:101
double do_compute(double R, double Z) const
Definition polynomial.h:108
Definition polynomial.h:117
double do_compute(double R, double Z) const
Definition polynomial.h:126
PsipZZ(const Parameters &gp)
Construct from given geometric parameters.
Definition polynomial.h:119