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) {
160 p_f->
z[i], p_f->
time[i], 1,
165 p_f->
err[i] = errflag;
170 if( active_emin && (ekin < sim->endcond_min_ekin) ) {
205 else if( p_f->
bounces[i] - 1 >=
277 for(i = 0; i <
NSIMD; i++) {
278 if(p_f->running[i]) {
280 if( p_i->ppar[i] * p_f->ppar[i] < 0 ) {
281 if(p_f->bounces[i] > 0) {
283 p_f->bounces[i] *= -1;
285 else if(p_f->bounces[i] < 0) {
287 p_f->bounces[i] *= -1;
288 p_f->bounces[i] += 1;
292 p_f->bounces[i] += 1;
317 p_f->r[i], p_f->phi[i], p_f->z[i],
320 p_f->walltile[i] = tile;
328 if(active_emin || active_therm) {
330 p_f->B_r[i], p_f->B_phi[i], p_f->B_z[i]);
332 p_f->ppar[i], Bnorm);
338 p_f->z[i], p_f->time[i], 1,
343 p_f->err[i] = errflag;
348 if(active_emin && (ekin < sim->endcond_min_ekin) ) {
383 else if(p_f->bounces[i] - 1 >=
390 p_f->endcond[i] |= maxorb;
394 p_f->endcond[i] |= maxorb;
448 for(i = 0; i <
NSIMD; i++) {
449 if(p_f->running[i]) {
471 p_f->r[i], p_f->phi[i], p_f->z[i],
474 p_f->walltile[i] = tile;
508 p_f->endcond[i] |= maxorb;
512 p_f->endcond[i] |= maxorb;
570 sprintf(str,
"Sim time limit");
573 sprintf(str,
"Min energy");
576 sprintf(str,
"Thermalization");
579 sprintf(str,
"Wall collision");
582 sprintf(str,
"Min rho");
585 sprintf(str,
"Max rho");
588 sprintf(str,
"Max poloidal orbits");
591 sprintf(str,
"Max toroidal orbits");
594 sprintf(str,
"CPU time exceeded");
597 sprintf(str,
"Hybrid condition");
600 sprintf(str,
"Neutralization");
603 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.
Header file for particle.c.
Methods to evaluate elementary physical quantities.
#define physlib_Ekin_ppar(m, mu, ppar, B)
Evaluate kinetic energy [J] from parallel momentum.
#define physlib_Ekin_pnorm(m, p)
Evaluate kinetic energy [J] from momentum norm.
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.