90 GPU_PARALLEL_LOOP_ALL_LEVELS
91 for(
int i = 0; i < p_f->
n_mrk; i++) {
98 + p_f->
p_z[i]*p_f->
B_z[i]) < 0 ) {
135 p_i->
r[i], p_i->
phi[i], p_i->
z[i],
140 p_f->
r[i] = p_i->
r[i] + w*(p_f->
r[i] - p_i->
r[i]);
141 p_f->
phi[i] = p_i->
phi[i] + w*(p_f->
phi[i] - p_i->
phi[i]);
142 p_f->
z[i] = p_i->
z[i] + w*(p_f->
z[i] - p_i->
z[i]);
152 if(active_emin || active_therm) {
157 p_f->
z[i], p_f->
time[i], 1,
164 p_f->
err[i] = errflag;
174 vplasma[0] = ( p_f->
p_r[i] / ( gamma * p_f->
mass[i] )
175 - vflow * p_f->
B_r[i] / bnorm );
176 vplasma[1] = ( p_f->
p_phi[i] / ( gamma * p_f->
mass[i] )
177 - vflow * p_f->
B_phi[i] / bnorm );
178 vplasma[2] = p_f->
p_z[i] / ( gamma * p_f->
mass[i] )
179 - vflow * p_f->
B_z[i] / bnorm;
185 if( active_emin && (ekin < sim->endcond_min_ekin) ) {
220 else if( p_f->
bounces[i] - 1 >=
291 GPU_PARALLEL_LOOP_ALL_LEVELS
292 for(i = 0; i < p_f->
n_mrk; i++) {
295 if( p_i->
ppar[i] * p_f->
ppar[i] < 0 ) {
332 p_f->
r[i], p_f->
phi[i], p_f->
z[i],
343 if(active_emin || active_therm) {
351 p_f->
z[i], p_f->
time[i], 1,
358 p_f->
err[i] = errflag;
364 p_f->
mass[i], p_f->
mu[i], p_f->
ppar[i], Bnorm);
366 p_f->
mass[i], p_f->
mu[i], p_f->
ppar[i], Bnorm);
368 real vpar = xi * vnorm;
369 real vperp2 = (1 - xi * xi) * vnorm * vnorm;
370 vnorm = sqrt((vpar - vflow) * (vpar - vflow) + vperp2);
374 if(active_emin && (ekin < sim->endcond_min_ekin) ) {
474 for(i = 0; i <
NSIMD; i++) {
475 if(p_f->running[i]) {
497 p_f->r[i], p_f->phi[i], p_f->z[i],
500 p_f->walltile[i] = tile;
534 p_f->endcond[i] |= maxorb;
538 p_f->endcond[i] |= maxorb;
596 sprintf(str,
"Sim time limit");
599 sprintf(str,
"Min energy");
602 sprintf(str,
"Thermalization");
605 sprintf(str,
"Wall collision");
608 sprintf(str,
"Min rho");
611 sprintf(str,
"Max rho");
614 sprintf(str,
"Max poloidal orbits");
617 sprintf(str,
"Max toroidal orbits");
620 sprintf(str,
"CPU time exceeded");
623 sprintf(str,
"Hybrid condition");
626 sprintf(str,
"Neutralization");
629 sprintf(str,
"Ionization");
#define NSIMD
Number of particles simulated simultaneously in a particle group operations.
Header file containing physical and mathematical constants.
void endcond_parse(int endcond, int *endconds)
Split endcond to an array of end conditions.
void endcond_check_gc(particle_simd_gc *p_f, particle_simd_gc *p_i, sim_data *sim)
Check end conditions for GC markers.
void endcond_check_fo(particle_simd_fo *p_f, particle_simd_fo *p_i, sim_data *sim)
Check end conditions for FO markers.
void endcond_check_ml(particle_simd_ml *p_f, particle_simd_ml *p_i, sim_data *sim)
Check end conditions for ML markers.
void endcond_parse2str(int endcond, char *str)
Represent end condition in human-readable format.
Header file for endcond.c.
unsigned long int a5err
Simulation error flag.
#define math_normc(a1, a2, a3)
Calculate norm of 3D vector from its components a1, a2, a3.
#define math_norm(a)
Calculate norm of 3D vector a.
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_gc_xi(m, mu, ppar, B)
Evaluate guiding center pitch from parallel momentum and magnetic moment.
#define physlib_Ekin_pnorm(m, p)
Evaluate kinetic energy [J] from momentum norm.
#define physlib_pnorm_vnorm(m, v)
Evaluate momentum norm [kg m/s] from velocity norm.
#define physlib_vnorm_pnorm(m, p)
Evaluate velocity norm [m/s] from momentum norm.
#define physlib_Ekin_gamma(m, gamma)
Evaluate kinetic energy [J] from Lorentz factor.
#define physlib_gc_p(m, mu, ppar, B)
Evaluate guiding center momentum norm [kg m/s] from parallel momentum and magnetic moment.
#define physlib_gamma_vnorm(v)
Evaluate Lorentz factor from velocity norm.
a5err plasma_eval_flow(real *vflow, real rho, real r, real phi, real z, real t, plasma_data *pls_data)
Evalate plasma flow along the field lines.
a5err plasma_eval_temp(real *temp, real rho, real r, real phi, real z, real t, int species, plasma_data *pls_data)
Evaluate plasma temperature.
Header file for plasma.c.
Header file for simulate.c.
Struct representing NSIMD particle markers.
Struct representing NSIMD guiding center markers.
Struct representing NSIMD field line markers.
int wall_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_data *w, real *w_coll)
Check if a given directed line segment intersects the wall.