ASCOT5
|
Magnetic field interface. More...
#include <stdio.h>
#include "ascot5.h"
#include "error.h"
#include "print.h"
#include "B_field.h"
#include "Bfield/B_GS.h"
#include "Bfield/B_2DS.h"
#include "Bfield/B_3DS.h"
#include "Bfield/B_STS.h"
#include "Bfield/B_TC.h"
Go to the source code of this file.
Functions | |
void | B_field_free (B_field_data *data) |
Free allocated resources. | |
void | B_field_offload (B_field_data *data) |
Offload data to the accelerator. | |
a5err | B_field_eval_psi (real *psi, real r, real phi, real z, real t, B_field_data *Bdata) |
Evaluate poloidal flux psi. | |
a5err | B_field_eval_psi_dpsi (real psi_dpsi[4], real r, real phi, real z, real t, B_field_data *Bdata) |
Evaluate poloidal flux psi and its derivatives. | |
a5err | B_field_eval_rho (real rho[2], real psi, B_field_data *Bdata) |
Evaluate normalized poloidal flux rho and its psi derivative. | |
a5err | B_field_eval_rho_drho (real rho_drho[4], real r, real phi, real z, B_field_data *Bdata) |
Evaluate normalized poloidal flux rho and its derivatives. | |
a5err | B_field_eval_B (real B[3], real r, real phi, real z, real t, B_field_data *Bdata) |
Evaluate magnetic field. | |
a5err | B_field_eval_B_dB (real B_dB[15], real r, real phi, real z, real t, B_field_data *Bdata) |
Evaluate magnetic field and its derivatives. | |
a5err | B_field_get_axis_rz (real rz[2], B_field_data *Bdata, real phi) |
Return magnetic axis Rz-coordinates. | |
Magnetic field interface.
This is an interface through which magnetic field data is initialized and accessed. Reading e.g. from disk is done elsewhere.
To add a new magnetic field instance, make sure these functions are implemented and called from this interface, and that B_field.h contains enum type for the new instance.
The interface checks which instance given data corresponds to from B_field_offload_data.type and B_field_data.type from the structure that is given as an argument, and calls the relevant function for that instance.
Definition in file B_field.c.
void B_field_free | ( | B_field_data * | data | ) |
void B_field_offload | ( | B_field_data * | data | ) |
Evaluate poloidal flux psi.
This function evaluates the poloidal flux psi at the given coordinates. The psi is exactly as it appears in Grad-Shafranov equation.
This is a SIMD function.
psi | pointer where psi [V*s*m^-1] value will be stored |
r | R coordinate [m] |
phi | phi coordinate [rad] |
z | z coordinate [m] |
t | time coordinate [s] |
Bdata | pointer to magnetic field data struct |
a5err B_field_eval_psi_dpsi | ( | real | psi_dpsi[4], |
real | r, | ||
real | phi, | ||
real | z, | ||
real | t, | ||
B_field_data * | Bdata ) |
Evaluate poloidal flux psi and its derivatives.
This function evaluates the poloidal flux psi and its derivatives at the given coordinates. The psi is exactly as it appears in Grad-Shafranov equation.
The values are stored in the given array as:
This is a SIMD function.
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] |
t | time coordinate [s] |
Bdata | pointer to magnetic field data struct |
a5err B_field_eval_rho | ( | real | rho[2], |
real | psi, | ||
B_field_data * | Bdata ) |
Evaluate normalized poloidal flux rho and its psi derivative.
This function evaluates the normalized poloidal flux rho at the given coordinates. The rho is evaluated from psi as:
where is psi at magnetic axis and is psi at separatrix.
This is a SIMD function.
rho | pointer where rho value will be stored |
psi | poloidal flux from which rho is evaluated |
Bdata | pointer to magnetic field data struct |
Evaluate normalized poloidal flux rho and its derivatives.
This function evaluates the normalized poloidal flux rho at the given coordinates. The rho is evaluated from psi as:
where is psi at magnetic axis and is psi at separatrix.
The values are stored in the given array as:
This is a SIMD function.
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 |
Evaluate magnetic field.
This function evaluates the magnetic field at the given coordinates.
The values are stored in the given array as:
This is a SIMD function.
B | pointer to array where magnetic field values are stored |
r | R coordinate [m] |
phi | phi coordinate [deg] |
z | z coordinate [m] |
t | time coordinate [s] |
Bdata | pointer to magnetic field data struct |
Evaluate magnetic field and its derivatives.
This function evaluates the magnetic field and its derivatives at the given coordinates.
The values are stored in the given array as:
This is a SIMD function.
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] |
t | time coordinate [s] |
Bdata | pointer to magnetic field data struct |
a5err B_field_get_axis_rz | ( | real | rz[2], |
B_field_data * | Bdata, | ||
real | phi ) |
Return magnetic axis Rz-coordinates.
Returns magnetic axis Rz-coordinates at given toroidal angle.
rz | pointer where axis R and z [m] values will be stored |
Bdata | pointer to magnetic field data struct |
phi | phi coordinate [rad] |