|
ASCOT5
|
Analytic magnetic field. More...
#include <stdlib.h>#include <stdio.h>#include <math.h>#include "../ascot5.h"#include "../consts.h"#include "../print.h"#include "../error.h"#include "B_GS.h"Go to the source code of this file.
Functions | |
| int | B_GS_init (B_GS_data *data, real R0, real z0, real raxis, real zaxis, real B_phi0, real psi0, real psi1, real psi_mult, real c[14], int Nripple, real a0, real alpha0, real delta0) |
| Initialize magnetic field data. | |
| void | B_GS_free (B_GS_data *data) |
| Free allocated resources. | |
| void | B_GS_offload (B_GS_data *data) |
| Offload data to the accelerator. | |
| a5err | B_GS_eval_psi (real *psi, real r, real phi, real z, B_GS_data *Bdata) |
| Evaluate poloidal flux psi. | |
| a5err | B_GS_eval_psi_dpsi (real psi_dpsi[4], real r, real phi, real z, B_GS_data *Bdata) |
| Evaluate poloidal flux psi and its derivatives. | |
| a5err | B_GS_eval_rho_drho (real rho_drho[4], real r, real phi, real z, B_GS_data *Bdata) |
| Evaluate normalized poloidal flux rho and its derivatives. | |
| a5err | B_GS_eval_B (real B[3], real r, real phi, real z, B_GS_data *Bdata) |
| Evaluate magnetic field. | |
| a5err | B_GS_eval_B_dB (real B_dB[12], real r, real phi, real z, B_GS_data *Bdata) |
| Evaluate magnetic field and its derivatives. | |
| a5err | B_GS_get_axis_rz (real rz[2], B_GS_data *Bdata) |
| Return magnetic axis R-coordinate. | |
Analytic magnetic field.
This module implements a toroidal magnetic field based on an analytical solution to the Grad-Shafranov equation [1].
In this model, the poloidal flux psi is calculated as
![\begin{align*}\psi(R,Z) =
&\psi_c [(1-A) (r^4/8) \\
&+ A (r^2\log(r)/2) \\
&+ c_0 \\
&+ c_1 (r^2) \\
&+ c_2 (r^2\log(r) - z^2) \\
&+ c_3 (r^4 - 4r^2z^2) \\
&+ c_4 (3r^4\log(r) - 9r^2z^2 - 12r^2\log(r)z^2 + 2z^4) \\
&+ c_5 (r^6 - 12r^4z^2 + 8r^2z^4) \\
&+ c_6 (8z^6 - 140r^2z^4 - 120r^2\log(r)z^4 + 180r^4\log(r)z^2
+ 75r^4z^2 - 15r^6\log(r)) \\
&+ c_7 (z) \\
&+ c_8 (zr^2) \\
&+ c_9 (z^3 - 3zr^2\log(r)) \\
&+ c_{10} (3zr^4 - 4z^3r^2) \\
&+ c_{12} (8z^5 - 45zr^4 - 80z^3r^2\log(r) + 60zr^4\log(r)) ]
\end{align*}](form_12.png)
where 






and toroidal field is evaluated as

This module also includes the possibility to have an analytical model for toroidal field ripple, which is used if ripple period 

where

and 

[1] A.J. Cerfon, J.P. Freidberg. "One size fits all" analytic solutions to the Grad-Shafranov equation. Physics of Plasmas 17 (3) (2010) 032502. http://scitation.aip.org/content/aip/journal/pop/17/3/10.1063/1.3328818
Definition in file B_GS.c.
| int B_GS_init | ( | B_GS_data * | data, |
| real | R0, | ||
| real | z0, | ||
| real | raxis, | ||
| real | zaxis, | ||
| real | B_phi0, | ||
| real | psi0, | ||
| real | psi1, | ||
| real | psi_mult, | ||
| real | c[14], | ||
| int | Nripple, | ||
| real | a0, | ||
| real | alpha0, | ||
| real | delta0 ) |
Initialize magnetic field data.
| data | pointer to the data struct |
| R0 | major radius R coordinate [m] |
| z0 | midplane z coordinate [m] |
| raxis | magnetic axis R coordinate [m] |
| zaxis | magnetic axis z coordinate [m] |
| B_phi0 | on-axis toroidal field [T] |
| psi0 | poloidal flux at axis [Vs/m] |
| psi1 | poloidal flux at separatrix [Vs/m] |
| psi_mult | psi multiplier |
| psi_coeff | coefficients for evaluating psi |
| Nripple | number of toroidal field coils |
| a0 | minor radius |
| alpha0 | ripple r-dependency delta ~ (r/a0)^alpha0 |
| delta0 | ripple strength |
| void B_GS_free | ( | B_GS_data * | data | ) |
| void B_GS_offload | ( | B_GS_data * | data | ) |
Evaluate normalized poloidal flux rho and its derivatives.
| rho_drho | pointer where rho and its derivatives will be stored |
| r | R coordinate [m] |
| phi | phi coordinate [rad] |
| z | z coordinate [m] |
| Bdata | pointer to magnetic field data struct |