ASCOT5
Loading...
Searching...
No Matches
B_STS.h File Reference

Header file for B_STS.c. More...

#include "../offload.h"
#include "../ascot5.h"
#include "../linint/linint.h"
#include "../spline/interp.h"

Go to the source code of this file.

Data Structures

struct  B_STS_data
 stellarator magnetic field parameters on the target More...
 

Functions

int B_STS_init (B_STS_data *data, int p_n_r, real p_r_min, real p_r_max, int p_n_phi, real p_phi_min, real p_phi_max, int p_n_z, real p_z_min, real p_z_max, int b_n_r, real b_r_min, real b_r_max, int b_n_phi, real b_phi_min, real b_phi_max, int b_n_z, real b_z_min, real b_z_max, int naxis, real axis_min, real axis_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_STS_free (B_STS_data *data)
 Free allocated resources.
 
void B_STS_offload (B_STS_data *data)
 Offload data to the accelerator.
 
a5err B_STS_eval_psi (real *psi, real r, real phi, real z, B_STS_data *Bdata)
 Evaluate poloidal flux psi.
 
DECLARE_TARGET_END a5err B_STS_eval_psi_dpsi (real psi_dpsi[4], real r, real phi, real z, B_STS_data *Bdata)
 Evaluate poloidal flux psi and its derivatives.
 
DECLARE_TARGET_END a5err B_STS_eval_rho_drho (real rho_drho[4], real r, real phi, real z, B_STS_data *Bdata)
 Evaluate normalized poloidal flux rho and its derivatives.
 
DECLARE_TARGET_END a5err B_STS_eval_B (real B[3], real r, real phi, real z, B_STS_data *Bdata)
 Evaluate magnetic field.
 
DECLARE_TARGET_END a5err B_STS_eval_B_dB (real B_dB[12], real r, real phi, real z, B_STS_data *Bdata)
 Evaluate magnetic field and its derivatives.
 
DECLARE_TARGET_END a5err B_STS_get_axis_rz (real rz[2], B_STS_data *Bdata, real phi)
 Return magnetic axis Rz-coordinates.
 

Detailed Description

Header file for B_STS.c.

Definition in file B_STS.h.

Function Documentation

◆ B_STS_init()

int B_STS_init ( B_STS_data * data,
int p_n_r,
real p_r_min,
real p_r_max,
int p_n_phi,
real p_phi_min,
real p_phi_max,
int p_n_z,
real p_z_min,
real p_z_max,
int b_n_r,
real b_r_min,
real b_r_max,
int b_n_phi,
real b_phi_min,
real b_phi_max,
int b_n_z,
real b_z_min,
real b_z_max,
int naxis,
real axis_min,
real axis_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
datapointer to the data struct
p_n_rnumber of r grid points in psi data
p_r_minminimum R coordinate in psi data grid [m]
p_r_maxmaximum R coordinate in psi data grid [m]
p_n_phinumber of phi grid points in psi data
p_phi_minminimum phi coordinate in psi data grid [rad]
p_phi_maxmaximum phi coordinate in psi data grid [rad]
p_n_znumber of z grid points in psi data
p_z_minminimum z coordinate in psi data grid [m]
p_z_maxmaximum z coordinate in psi data grid [m]
p_n_rnumber of r grid points in B data
b_r_minminimum R coordinate in B data grid [m]
b_r_maxmaximum R coordinate in B data grid [m]
b_n_phinumber of phi grid points in B data
b_phi_minminimum phi coordinate in B data grid [rad]
b_phi_maxmaximum phi coordinate in B data grid [rad]
b_n_znumber of z grid points in B data
b_z_minminimum z coordinate in B data grid [m]
b_z_maxmaximum z coordinate in B data grid [m]
naxisnumber of phi coordinates in magnetic axis data
axis_min,inimumphi grid point in axis data [rad]
axis_maxmaximum phi grid point in axis data [rad]
axis_rR coordinates of the magnetic axis [m]
axis_zz coordinates of the magnetic axis [m]
psi0poloidal flux at magnetic axis [Vs/m]
psi1poloidal flux at separatrix [Vs/m]
psipoloidal flux psi(R_i,phi_j,z_k) = arr[k*p_n_r*p_n_phi + j*p_n_r + i] [Vs/m]
B_rMagnetic field R component B_r(R_i,phi_j,z_k) = arr[k*b_n_r*b_n_phi + j*b_n_r + i] [T]
B_phiMagnetic field phi component B_phi(R_i,phi_j,z_k) = arr[k*b_n_r*b_n_phi + j*b_n_r + i] [T]
B_zMagnetic field z component B_z(R_i,phi_j,z_k) = arr[k*b_n_r*b_n_phi + j*b_n_r + i] [T]
Returns
zero if initialization succeeded

Definition at line 81 of file B_STS.c.

◆ B_STS_free()

void B_STS_free ( B_STS_data * data)

Free allocated resources.

Parameters
datapointer to the data struct

Definition at line 177 of file B_STS.c.

◆ B_STS_offload()

void B_STS_offload ( B_STS_data * data)

Offload data to the accelerator.

Parameters
datapointer to the data struct

Definition at line 189 of file B_STS.c.

◆ B_STS_eval_psi()

a5err B_STS_eval_psi ( real * psi,
real r,
real phi,
real z,
B_STS_data * Bdata )

Evaluate poloidal flux psi.

Parameters
psipointer where psi [V*s*m^-1] value will be stored
rR coordinate [m]
phiphi coordinate [rad]
zz coordinate [m]
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 212 of file B_STS.c.

◆ B_STS_eval_psi_dpsi()

DECLARE_TARGET_END a5err B_STS_eval_psi_dpsi ( real psi_dpsi[4],
real r,
real phi,
real z,
B_STS_data * Bdata )

Evaluate poloidal flux psi and its derivatives.

Parameters
psi_dpsipointer for storing psi [V*s*m^-1] and its derivatives
rR coordinate [m]
phiphi coordinate [rad]
zz coordinate [m]
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 244 of file B_STS.c.

◆ B_STS_eval_rho_drho()

DECLARE_TARGET_END a5err B_STS_eval_rho_drho ( real rho_drho[4],
real r,
real phi,
real z,
B_STS_data * Bdata )

Evaluate normalized poloidal flux rho and its derivatives.

Parameters
rho_drhopointer where rho and its derivatives will be stored
rR coordinate [m]
phiphi coordinate [rad]
zz coordinate [m]
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 286 of file B_STS.c.

◆ B_STS_eval_B()

DECLARE_TARGET_END a5err B_STS_eval_B ( real B[3],
real r,
real phi,
real z,
B_STS_data * Bdata )

Evaluate magnetic field.

Parameters
Bpointer to array where magnetic field values are stored
rR coordinate [m]
phiphi coordinate [deg]
zz coordinate [m]
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 335 of file B_STS.c.

◆ B_STS_eval_B_dB()

DECLARE_TARGET_END a5err B_STS_eval_B_dB ( real B_dB[12],
real r,
real phi,
real z,
B_STS_data * Bdata )

Evaluate magnetic field and its derivatives.

Parameters
B_dBpointer to array where the field and its derivatives are stored
rR coordinate [m]
phiphi coordinate [deg]
zz coordinate [m]
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 370 of file B_STS.c.

◆ B_STS_get_axis_rz()

DECLARE_TARGET_END a5err B_STS_get_axis_rz ( real rz[2],
B_STS_data * Bdata,
real phi )

Return magnetic axis Rz-coordinates.

Parameters
rzpointer where axis R and z [m] values will be stored
Bdatapointer to magnetic field data struct
phiphi coordinate [rad]
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 421 of file B_STS.c.