Header file for B_2DS.c.
More...
#include "../offload.h"
#include "../ascot5.h"
#include "../error.h"
#include "../spline/interp.h"
Go to the source code of this file.
|
int | B_2DS_init (B_2DS_data *data, int n_r, real r_min, real r_max, int n_z, real z_min, real z_max, real axis_r, real axis_z, real psi0, real psi1, real *psi, real *B_r, real *B_phi, real *B_z) |
| Initialize magnetic field data.
|
|
void | B_2DS_free (B_2DS_data *data) |
| Free allocated resources.
|
|
void | B_2DS_offload (B_2DS_data *data) |
| Offload data to the accelerator.
|
|
a5err | B_2DS_eval_psi (real *psi, real r, real phi, real z, B_2DS_data *Bdata) |
| Evaluate poloidal flux psi.
|
|
DECLARE_TARGET_END a5err | B_2DS_eval_psi_dpsi (real psi_dpsi[4], real r, real phi, real z, B_2DS_data *Bdata) |
| Evaluate poloidal flux psi and its derivatives.
|
|
DECLARE_TARGET_END a5err | B_2DS_eval_rho_drho (real rho_drho[4], real r, real phi, real z, B_2DS_data *Bdata) |
| Evaluate normalized poloidal flux rho and its derivatives.
|
|
DECLARE_TARGET_END a5err | B_2DS_eval_B (real B[3], real r, real phi, real z, B_2DS_data *Bdata) |
| Evaluate magnetic field.
|
|
DECLARE_TARGET_END a5err | B_2DS_eval_B_dB (real B_dB[12], real r, real phi, real z, B_2DS_data *Bdata) |
| Evaluate magnetic field and its derivatives.
|
|
DECLARE_TARGET_END a5err | B_2DS_get_axis_rz (real rz[2], B_2DS_data *Bdata) |
| Return magnetic axis R-coordinate.
|
|
Header file for B_2DS.c.
Contains declaration of B_2DS_offload_data and B_2DS_data structs.
Definition in file B_2DS.h.
◆ B_2DS_init()
int B_2DS_init |
( |
B_2DS_data * | data, |
|
|
int | n_r, |
|
|
real | r_min, |
|
|
real | r_max, |
|
|
int | n_z, |
|
|
real | z_min, |
|
|
real | z_max, |
|
|
real | axis_r, |
|
|
real | axis_z, |
|
|
real | psi0, |
|
|
real | psi1, |
|
|
real * | psi, |
|
|
real * | B_r, |
|
|
real * | B_phi, |
|
|
real * | B_z ) |
Initialize magnetic field data.
- Parameters
-
n_r | number of r grid points |
r_min | minimum R coordinate in the grid [m] |
r_max | maximum R coordinate in the grid [m] |
n_z | number of z grid points |
z_min | minimum z coordinate in the grid [m] |
z_max | maximum z coordinate in the grid [m] |
axis_r | R coordinate of magnetic axis [m] |
axis_z | z coordinate of magnetic axis [m] |
psi0 | poloidal flux at magnetic axis [Vs/m] |
psi1 | poloidal flux at separatrix [Vs/m] |
psi | poloidal flux psi(R_i,z_j) = arr[j*n_r + i] [Vs/m] |
B_r | Magnetic field R component B_r(R_i,z_j) = arr[j*n_r + i] [T] |
B_phi | Magnetic field phi component B_phi(R_i,z_j) = arr[j*n_r + i] [T] |
B_z | Magnetic field z component B_z(R_i,z_j) = arr[j*n_r + i] [T] |
- Returns
- zero if initialization succeeded
Definition at line 55 of file B_2DS.c.
◆ B_2DS_free()
Free allocated resources.
- Parameters
-
data | pointer to data struct |
Definition at line 125 of file B_2DS.c.
◆ B_2DS_offload()
Offload data to the accelerator.
- Parameters
-
data | pointer to the data struct |
Definition at line 137 of file B_2DS.c.
◆ B_2DS_eval_psi()
Evaluate poloidal flux psi.
- Parameters
-
psi | pointer where psi [V*s*m^-1] value will be stored |
r | R coordinate [m] |
phi | phi coordinate [rad] |
z | z coordinate [m] |
Bdata | pointer to magnetic field data struct |
- Returns
- Non-zero a5err value if evaluation failed, zero otherwise
Definition at line 158 of file B_2DS.c.
◆ B_2DS_eval_psi_dpsi()
Evaluate poloidal flux psi and its derivatives.
- Parameters
-
psi_dpsi | pointer for storing psi [V*s*m^-1] and its derivatives |
r | R coordinate [m] |
phi | phi coordinate [rad] |
z | z coordinate [m] |
Bdata | pointer to magnetic field data struct |
- Returns
- Non-zero a5err value if evaluation failed, zero otherwise
Definition at line 181 of file B_2DS.c.
◆ B_2DS_eval_rho_drho()
Evaluate normalized poloidal flux rho and its derivatives.
- Parameters
-
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 |
- Returns
- Non-zero a5err value if evaluation failed, zero otherwise
Definition at line 212 of file B_2DS.c.
◆ B_2DS_eval_B()
Evaluate magnetic field.
- Parameters
-
B | pointer to array where magnetic field values are stored |
r | R coordinate [m] |
phi | phi coordinate [deg] |
z | z coordinate [m] |
Bdata | pointer to magnetic field data struct |
- Returns
- Non-zero a5err value if evaluation failed, zero otherwise
Definition at line 250 of file B_2DS.c.
◆ B_2DS_eval_B_dB()
Evaluate magnetic field and its derivatives.
- Parameters
-
B_dB | pointer to array where the field and its derivatives are stored |
r | R coordinate [m] |
phi | phi coordinate [deg] |
z | z coordinate [m] |
Bdata | pointer to magnetic field data struct |
- Returns
- Non-zero a5err value if evaluation failed, zero otherwise
Definition at line 296 of file B_2DS.c.
◆ B_2DS_get_axis_rz()
Return magnetic axis R-coordinate.
- Parameters
-
rz | pointer where axis R and z [m] values will be stored |
Bdata | pointer to magnetic field data struct |
- Returns
- Zero a5err value as this function can't fail.
Definition at line 365 of file B_2DS.c.