50 *offload_array = NULL;
53 "\nTrivial cartesian magnetic field (B_TC)\n"
54 "Magnetic axis at (R,z) = (%.1f,%.1f)\n"
55 "psi = %.1f, rho = %.1f\n"
56 "Magnetic field at origo\n"
57 "B_x = %.3f B_y = %.3f B_z = %.3f\n"
58 "Magnetic field gradient\n"
59 "dB_x/dx = %.3f dB_x/dy = %.3f B_x/dz = %.3f\n"
60 "dB_y/dx = %.3f dB_y/dy = %.3f B_y/dz = %.3f\n"
61 "dB_z/dx = %.3f dB_z/dy = %.3f B_z/dz = %.3f\n",
64 offload_data->
B[0], offload_data->
B[1], offload_data->
B[2],
65 offload_data->
dB[0], offload_data->
dB[1], offload_data->
dB[2],
66 offload_data->
dB[3], offload_data->
dB[4], offload_data->
dB[5],
67 offload_data->
dB[6], offload_data->
dB[7], offload_data->
dB[8]);
79 real** offload_array) {
81 *offload_array = NULL;
92 real* offload_array) {
93 Bdata->rhoval = offload_data->
rhoval;
94 Bdata->psival = offload_data->
psival;
95 Bdata->axisr = offload_data->
axisr;
96 Bdata->axisz = offload_data->
axisz;
98 Bdata->B = offload_data->
B;
99 Bdata->dB = offload_data->
dB;
116 psi[0] = Bdata->psival;
134 psi_dpsi[0] = Bdata->psival;
155 rho_drho[0] = Bdata->rhoval;
179 real rpz[3] = {r, phi, z};
183 Bxyz[0] = Bdata->B[0] + Bdata->dB[0]*xyz[0] + Bdata->dB[1]*xyz[1]
184 + Bdata->dB[2]*xyz[2];
185 Bxyz[1] = Bdata->B[1] + Bdata->dB[3]*xyz[0] + Bdata->dB[4]*xyz[1]
186 + Bdata->dB[5]*xyz[2];
187 Bxyz[2] = Bdata->B[2] + Bdata->dB[6]*xyz[0] + Bdata->dB[7]*xyz[1]
188 + Bdata->dB[8]*xyz[2];
211 real rpz[3] = {r, phi, z};
215 Bxyz[0] = Bdata->B[0] + Bdata->dB[0]*xyz[0] + Bdata->dB[1]*xyz[1]
216 + Bdata->dB[2]*xyz[2];
217 Bxyz[1] = Bdata->B[1] + Bdata->dB[3]*xyz[0] + Bdata->dB[4]*xyz[1]
218 + Bdata->dB[5]*xyz[2];
219 Bxyz[2] = Bdata->B[2] + Bdata->dB[6]*xyz[0] + Bdata->dB[7]*xyz[1]
220 + Bdata->dB[8]*xyz[2];
230 real B_dBxyz[12] = {Bdata->B[0], Bdata->dB[0], Bdata->dB[1], Bdata->dB[2],
231 Bdata->B[1], Bdata->dB[3], Bdata->dB[4], Bdata->dB[5],
232 Bdata->B[2], Bdata->dB[6], Bdata->dB[7], Bdata->dB[8]};
248 rz[0] = Bdata->axisr;
249 rz[1] = Bdata->axisz;
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.
Main header file for ASCOT5.
unsigned long int a5err
Simulation error flag.
void math_jac_xyz2rpz(real *xyz, real *rpz, real r, real phi)
Convert a Jacobian from cartesian to cylindrical coordinates.
#define math_vec_xyz2rpz(vxyz, vrpz, phi)
Transform vector from cartesian to cylindrical basis: vxyz -> vrpz, phi is the toroidal angle in radi...
#define math_rpz2xyz(rpz, xyz)
Convert cylindrical coordinates rpz to cartesian coordinates xyz.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
TC magnetic field parameters on the target.
TC magnetic field parameters that will be offloaded to target.