40 gradB[0] = (B[0]*B_dB[1] + B[1]*B_dB[5] + B[2]*B_dB[9]) / normB;
41 gradB[1] = (B[0]*B_dB[2] + B[1]*B_dB[6] + B[2]*B_dB[10])
43 gradB[2] = (B[0]*B_dB[3] + B[1]*B_dB[7] + B[2]*B_dB[11]) / normB;
49 curlB[0] = B_dB[10] / y[0] - B_dB[7];
50 curlB[1] = B_dB[3] - B_dB[9];
51 curlB[2] = (B[1] - B_dB[2]) / y[0] + B_dB[5];
54 real alpha = mhd_dmhd[0];
55 gradalpha[0] = mhd_dmhd[2];
56 gradalpha[1] = mhd_dmhd[3];
57 gradalpha[2] = mhd_dmhd[4];
59 real gradalphacrossB[3];
63 Bstar[0] = B[0] + gradalphacrossB[0] + alpha * curlB[0]
64 + ( y[3] / charge ) * ( curlB[0] / normB
65 - gradBcrossB[0] / (normB*normB));
66 Bstar[1] = B[1] + gradalphacrossB[1] + alpha * curlB[1]
67 + ( y[3] / charge ) * ( curlB[1] / normB
68 - gradBcrossB[0] / (normB*normB));
69 Bstar[2] = B[2] + gradalphacrossB[2] + alpha * curlB[2]
70 + ( y[3] / charge ) * ( curlB[2] / normB
71 - gradBcrossB[2] / (normB*normB));
74 Estar[0] = E[0] - mhd_dmhd[7] - y[4] * gradB[0] / ( charge * gamma )
76 Estar[1] = E[1] - mhd_dmhd[8] - y[4] * gradB[1] / ( charge * gamma )
78 Estar[2] = E[2] - mhd_dmhd[9] - y[4] * gradB[2] / ( charge * gamma )
82 Bhat[0] = B[0] / normB;
83 Bhat[1] = B[1] / normB;
84 Bhat[2] = B[2] / normB;
88 real EstarcrossBhat[3];
91 ydot[0] = (y[3] * Bstar[0] / ( gamma * mass )
92 + EstarcrossBhat[0]) / BhatDotBstar;
93 ydot[1] = (y[3] * Bstar[1] / ( gamma * mass )
94 + EstarcrossBhat[1]) / (y[0]*BhatDotBstar);
95 ydot[2] = (y[3] * Bstar[2] / ( gamma * mass )
96 + EstarcrossBhat[2]) / BhatDotBstar;
97 ydot[3] = charge *
math_dot(Bstar,Estar) / BhatDotBstar;
99 ydot[5] = charge * normB / (gamma*mass);
static DECLARE_TARGET_SIMD void step_gceom_mhd(real *ydot, real *y, real mass, real charge, real *B_dB, real *E, real *mhd_dmhd)
Calculate guiding center equations of motion for a single particle.