35 GPU_DATA_IS_MAPPED(h[0:p->
n_mrk], rnd[0:3*p->
n_mrk])
36 GPU_PARALLEL_LOOP_ALL_LEVELS
37 for(
int i = 0; i < p->
n_mrk; i++) {
51 vin_xyz[0] = ( p->
p_r[i] * cosphi - p->
p_phi[i] * sinphi )
52 / ( gamma * p->
mass[i] );
53 vin_xyz[1] = ( p->
p_r[i] * sinphi + p->
p_phi[i] * cosphi )
54 / ( gamma * p->
mass[i] );
55 vin_xyz[2] = p->
p_z[i] / ( gamma * p->
mass[i] );
62 p->
r[i], p->
phi[i], p->
z[i],
69 n_species, mb, qb, nb, Tb);
73 real F = 0, Dpara = 0, Dperp = 0;
75 for(
int j = 0; j < n_species; j++) {
76 real vb = sqrt( 2 * Tb[j] / mb[j] );
82 nb[j], vb, clogab[j], mufun[0]);
84 nb[j], vb, clogab[j], mufun[0]);
86 nb[j], vb, clogab[j], mufun[1]);
90 real sdt = sqrt(h[i]);
92 dW[0] = sdt * rnd[0*p->
n_mrk + i];
93 dW[1] = sdt * rnd[1*p->
n_mrk + i];
94 dW[2] = sdt * rnd[2*p->
n_mrk + i];
101 real k2 = sqrt(2*Dpara)*t1;
102 real k3 = sqrt(2*Dperp);
105 vout_xyz[0] = vin_xyz[0] + k1*vhat[0] + k2*vhat[0]
106 + k3*(dW[0] - t1*vhat[0]);
107 vout_xyz[1] = vin_xyz[1] + k1*vhat[1] + k2*vhat[1]
108 + k3*(dW[1] - t1*vhat[1]);
109 vout_xyz[2] = vin_xyz[2] + k1*vhat[2] + k2*vhat[2]
110 + k3*(dW[2] - t1*vhat[2]);
117 p->
p_r[i] = ( vout_xyz[0] * cosphi + vout_xyz[1] * sinphi )
118 * gamma * p->
mass[i];
119 p->
p_phi[i] = ( -vout_xyz[0] * sinphi + vout_xyz[1] * cosphi )
120 * gamma * p->
mass[i];
121 p->
p_z[i] = vout_xyz[2] * gamma * p->
mass[i];
Main header file for ASCOT5.
#define MAX_SPECIES
Maximum number of plasma species.
Header file containing physical and mathematical constants.
unsigned long int a5err
Simulation error flag.
#define math_dot(a, b)
Calculate dot product a[3] dot b[3].
#define math_unit(a, b)
Calculate unit vector b from a 3D vector a.
#define math_norm(a)
Calculate norm of 3D vector a.
Header file for mccc package.
Routines to evaluate coefficients needed to evaluate collisions.
#define mccc_coefs_Dpara(ma, qa, va, qb, nb, vb, clogab, mu0)
Evaluate non-relativistic parallel diffusion coefficient [m^2/s^3].
static void mccc_coefs_mufun(real mufun[3], real x, mccc_data *mdata)
Evaluate special functions needed by collision coefficients.
#define mccc_coefs_Dperp(ma, qa, va, qb, nb, vb, clogab, mu1)
Evaluate non-relativistic perpendicular diffusion coefficient [m^2/s^3].
#define mccc_coefs_F(ma, qa, mb, qb, nb, vb, clogab, mu0)
Evaluate non-relativistic friction coefficient [m/s^2].
static DECLARE_TARGET_END void mccc_coefs_clog(real *clogab, real ma, real qa, real va, int nspec, const real *mb, const real *qb, const real *nb, const real *Tb)
Evaluate Coulomb logarithm.
void mccc_fo_euler(particle_simd_fo *p, real *h, plasma_data *pdata, mccc_data *mdata, real *rnd)
Integrate collisions for one time-step.
Header file for particle.c.
Methods to evaluate elementary physical quantities.
#define physlib_gamma_pnorm(m, p)
Evaluate Lorentz factor from momentum norm.
#define physlib_gamma_vnorm(v)
Evaluate Lorentz factor from velocity norm.
const real * plasma_get_species_mass(plasma_data *pls_data)
Get mass of all plasma species.
int plasma_get_n_species(plasma_data *pls_data)
Get the number of plasma species.
const real * plasma_get_species_charge(plasma_data *pls_data)
Get charge of all plasma species.
a5err plasma_eval_densandtemp(real *dens, real *temp, real rho, real r, real phi, real z, real t, plasma_data *pls_data)
Evaluate plasma density and temperature for all species.
Header file for plasma.c.
Header file for random.c.
Parameters and data required to evaluate Coulomb collisions.
Struct representing NSIMD particle markers.