31 #pragma omp parallel for
32 for(
int ix = 0; ix < n; ix++) {
42 for(
int i = 1; i < coil_n; i++) {
50 p1p2[0] = p2[0] - p1[0];
51 p1p2[1] = p2[1] - p1[1];
52 p1p2[2] = p2[2] - p1[2];
55 p1x[0] = x[ix] - p1[0];
56 p1x[1] = y[ix] - p1[1];
57 p1x[2] = z[ix] - p1[2];
60 p2x[0] = x[ix] - p2[0];
61 p2x[1] = y[ix] - p2[1];
62 p2x[2] = z[ix] - p2[2];
71 xs[0] = p1[0] + s*p1p2[0] - x[ix];
72 xs[1] = p1[1] + s*p1p2[1] - y[ix];
73 xs[2] = p1[2] + s*p1p2[2] - z[ix];
82 Bx[ix] += abs_B * dir_B[0] /
math_norm(dir_B);
83 By[ix] += abs_B * dir_B[1] /
math_norm(dir_B);
84 Bz[ix] += abs_B * dir_B[2] /
math_norm(dir_B);
Main header file for ASCOT5.
void biosaw_calc_B(int n, real *x, real *y, real *z, int coil_n, real *coil_x, real *coil_y, real *coil_z, real *Bx, real *By, real *Bz)
Evaluate magnetic field due to a coil at given points.
Header file for biosaw.c.
Header file containing physical and mathematical constants.
#define CONST_MU0
Magnetic constant [kg*m*s^-2*A^-2]
#define math_dot(a, b)
Calculate dot product a[3] dot b[3].
#define math_copy(a, b)
Copies elements of vector b to vector a.
#define math_cross(a, b, c)
Calculate cross product for 3D vectors c = a x b.
#define math_norm(a)
Calculate norm of 3D vector a.