45 real** offload_array) {
47 switch(offload_data->
type) {
81 print_err(
"Error: Unregonized magnetic field type.");
89 *
sizeof(
real) / (1024.0*1024.0) );
106 real** offload_array) {
107 switch(offload_data->
type) {
144 real* offload_array) {
147 switch(offload_data->
type) {
150 &(Bdata->BGS), &(offload_data->
BGS), offload_array);
155 &(Bdata->B2DS), &(offload_data->
B2DS), offload_array);
160 &(Bdata->B3DS), &(offload_data->
B3DS), offload_array);
165 &(Bdata->BSTS), &(offload_data->
BSTS), offload_array);
170 &(Bdata->BTC), &(offload_data->
BTC), offload_array);
175 print_err(
"Error: Unregonized magnetic field type.\n");
179 Bdata->type = offload_data->
type;
205 switch(Bdata->type) {
269 switch(Bdata->type) {
300 for(
int k=1; k<4; k++) {psi_dpsi[k] = 0;}
330 real psi0 = 0.0, psi1 = 1.0;
331 switch(Bdata->type) {
333 psi0 = Bdata->BGS.psi0;
334 psi1 = Bdata->BGS.psi1;
338 psi0 = Bdata->B2DS.psi0;
339 psi1 = Bdata->B2DS.psi1;
343 psi0 = Bdata->B3DS.psi0;
344 psi1 = Bdata->B3DS.psi1;
348 psi0 = Bdata->BSTS.psi0;
349 psi1 = Bdata->BSTS.psi1;
353 psi0 = Bdata->BTC.psival;
363 real delta = (psi1 - psi0);
364 if( (psi - psi0) / delta < 0 ) {
367 rho[0] = sqrt( (psi - psi0) / delta );
368 rho[1] = 1.0 / (2*delta*rho[0]);
414 switch(Bdata->type) {
445 for(
int k=1; k<4; k++) {rho_drho[k] = 0;}
476 switch(Bdata->type) {
507 for(
int k=1; k<3; k++) {B[k] = 0;}
551 switch(Bdata->type) {
582 for(
int k=1; k<12; k++) {B_dB[k] = 0;}
602 switch(Bdata->type) {
a5err B_2DS_eval_psi(real *psi, real r, real phi, real z, B_2DS_data *Bdata)
Evaluate poloidal flux psi.
void B_2DS_free_offload(B_2DS_offload_data *offload_data, real **offload_array)
Free offload array.
void B_2DS_init(B_2DS_data *Bdata, B_2DS_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
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.
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.
a5err B_2DS_eval_B(real B[3], real r, real phi, real z, B_2DS_data *Bdata)
Evaluate magnetic field.
a5err B_2DS_get_axis_rz(real rz[2], B_2DS_data *Bdata)
Return magnetic axis R-coordinate.
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.
int B_2DS_init_offload(B_2DS_offload_data *offload_data, real **offload_array)
Initialize magnetic field offload data.
void B_3DS_free_offload(B_3DS_offload_data *offload_data, real **offload_array)
Free offload array.
a5err B_3DS_eval_rho_drho(real rho_drho[4], real r, real phi, real z, B_3DS_data *Bdata)
Evaluate normalized poloidal flux rho and its derivatives.
a5err B_3DS_eval_B(real B[3], real r, real phi, real z, B_3DS_data *Bdata)
Evaluate magnetic field.
int B_3DS_init_offload(B_3DS_offload_data *offload_data, real **offload_array)
Initialize magnetic field offload data.
void B_3DS_init(B_3DS_data *Bdata, B_3DS_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
a5err B_3DS_eval_psi_dpsi(real psi_dpsi[4], real r, real phi, real z, B_3DS_data *Bdata)
Evaluate poloidal flux psi and its derivatives.
a5err B_3DS_get_axis_rz(real rz[2], B_3DS_data *Bdata)
Return magnetic axis R-coordinate.
a5err B_3DS_eval_psi(real *psi, real r, real phi, real z, B_3DS_data *Bdata)
Evaluate poloidal flux psi.
a5err B_3DS_eval_B_dB(real B_dB[12], real r, real phi, real z, B_3DS_data *Bdata)
Evaluate magnetic field and its derivatives.
void B_GS_init(B_GS_data *Bdata, B_GS_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
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_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.
void B_GS_free_offload(B_GS_offload_data *offload_data, real **offload_array)
Free offload array.
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_psi_dpsi(real psi_dpsi[4], real r, real phi, real z, B_GS_data *Bdata)
Evaluate poloidal flux psi and its derivatives.
int B_GS_init_offload(B_GS_offload_data *offload_data, real **offload_array)
Initialize magnetic field offload data.
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.
void B_STS_free_offload(B_STS_offload_data *offload_data, real **offload_array)
Free offload array.
void B_STS_init(B_STS_data *Bdata, B_STS_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
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.
int B_STS_init_offload(B_STS_offload_data *offload_data, real **offload_array)
Initialize magnetic field offload data.
a5err B_STS_eval_psi(real *psi, real r, real phi, real z, B_STS_data *Bdata)
Evaluate poloidal flux psi.
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.
a5err B_STS_get_axis_rz(real rz[2], B_STS_data *Bdata, real phi)
Return magnetic axis Rz-coordinates.
a5err B_STS_eval_B(real B[3], real r, real phi, real z, B_STS_data *Bdata)
Evaluate magnetic field.
void B_TC_free_offload(B_TC_offload_data *offload_data, real **offload_array)
Free offload array.
a5err B_TC_eval_rho_drho(real rho_drho[4], real r, real phi, real z, B_TC_data *Bdata)
Evaluate normalized poloidal flux rho and its derivatives.
a5err B_TC_eval_psi(real *psi, real r, real phi, real z, B_TC_data *Bdata)
Evaluate poloidal flux psi.
a5err B_TC_eval_psi_dpsi(real psi_dpsi[4], real r, real phi, real z, B_TC_data *Bdata)
Evaluate poloidal flux psi and its derivatives.
a5err B_TC_eval_B_dB(real B_dB[12], real r, real phi, real z, B_TC_data *Bdata)
Evaluate magnetic field and its derivatives.
void B_TC_init(B_TC_data *Bdata, B_TC_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
int B_TC_init_offload(B_TC_offload_data *offload_data, real **offload_array)
Initialize magnetic field offload data.
a5err B_TC_get_axis_rz(real rz[2], B_TC_data *Bdata)
Return magnetic axis R-coordinate.
a5err B_TC_eval_B(real B[3], real r, real phi, real z, B_TC_data *Bdata)
Evaluate magnetic field.
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.
int B_field_init_offload(B_field_offload_data *offload_data, real **offload_array)
Load magnetic field data and prepare parameters.
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_psi(real *psi, real r, real phi, real z, real t, B_field_data *Bdata)
Evaluate poloidal flux psi.
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_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.
int B_field_init(B_field_data *Bdata, B_field_offload_data *offload_data, real *offload_array)
Initialize magnetic field data struct on target.
a5err B_field_get_axis_rz(real rz[2], B_field_data *Bdata, real phi)
Return magnetic axis Rz-coordinates.
void B_field_free_offload(B_field_offload_data *offload_data, real **offload_array)
Free offload array and reset parameters.
a5err B_field_eval_B(real B[3], real r, real phi, real z, real t, B_field_data *Bdata)
Evaluate magnetic field.
Header file for B_field.c.
Main header file for ASCOT5.
unsigned long int a5err
Simulation error flag.
static DECLARE_TARGET_SIMD a5err error_raise(error_type type, int line, error_file file)
Raise a new error.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
#define print_err(...)
Print to standard error.
Magnetic field simulation data.
Magnetic field offload data.