ASCOT5
Loading...
Searching...
No Matches
particle.h
Go to the documentation of this file.
1
19#ifndef PARTICLE_H
20#define PARTICLE_H
21
22#include "ascot5.h"
23#include "B_field.h"
24#include "E_field.h"
25#include "error.h"
26
81
103
125
141
154typedef struct {
155 int n;
158 volatile int next;
159 volatile int finished;
162
174
195
258
325
388
389
390void particle_allocate_fo(particle_simd_fo* p_fo, int nmrk);
391void particle_to_fo_dummy(particle_simd_fo* p_fo, int j);
392void particle_to_gc_dummy(particle_simd_gc* p_gc, int j);
393void particle_to_fo_dummy(particle_simd_fo* p_fo, int j);
394void particle_to_gc_dummy(particle_simd_gc* p_gc, int j);
395void particle_to_ml_dummy(particle_simd_ml* p_ml, int j);
396
398 B_field_data* Bdata, int* cycle);
400 B_field_data* Bdata, int* cycle);
402 B_field_data* Bdata, int* cycle);
403
405 B_field_data* Bdata);
407 B_field_data* Bdata);
409 B_field_data* Bdata);
411 B_field_data* Bdata);
412
414
415DECLARE_TARGET_SIMD_UNIFORM(Bdata)
417 int j, B_field_data* Bdata);
418DECLARE_TARGET_SIMD_UNIFORM(Bdata)
420 B_field_data* Bdata);
421DECLARE_TARGET_SIMD_UNIFORM(Bdata)
423 int j, B_field_data* Bdata);
424DECLARE_TARGET_SIMD_UNIFORM(Bdata)
426 B_field_data* Bdata);
427DECLARE_TARGET_SIMD_UNIFORM(Bdata)
429 int j, B_field_data* Bdata);
430DECLARE_TARGET_SIMD_UNIFORM(Bdata)
432 B_field_data* Bdata);
433DECLARE_TARGET_SIMD_UNIFORM(p_fo,Bdata)
435 B_field_data* Bdata);
436GPU_DECLARE_TARGET_SIMD
437void particle_copy_fo(particle_simd_fo* p1, int i, particle_simd_fo* p2, int j);
438DECLARE_TARGET_END
439DECLARE_TARGET_SIMD
440void particle_copy_gc(particle_simd_gc* p1, int i, particle_simd_gc* p2, int j);
441DECLARE_TARGET_SIMD
442void particle_copy_ml(particle_simd_ml* p1, int i, particle_simd_ml* p2, int j);
443
444#endif
Header file for B_field.c.
Header file for E_field.c.
Main header file for ASCOT5.
double real
Definition ascot5.h:85
#define NSIMD
Number of particles simulated simultaneously in a particle group operations.
Definition ascot5.h:91
long integer
Definition ascot5.h:84
Error module for ASCOT5.
unsigned long int a5err
Simulation error flag.
Definition error.h:17
void particle_to_ml_dummy(particle_simd_ml *p_ml, int j)
Makes a dummy ML simulation marker.
Definition particle.c:218
void particle_gc_to_state(particle_simd_gc *p_gc, int j, particle_state *p, B_field_data *Bdata)
Convert GC to state.
Definition particle.c:936
a5err particle_input_gc_to_state(particle_gc *p, particle_state *ps, B_field_data *Bdata)
Convert an input guiding center marker to particle state.
Definition particle.c:1540
a5err particle_state_to_gc(particle_state *p, int i, particle_simd_gc *p_gc, int j, B_field_data *Bdata)
Convert state into a GC SIMD marker.
Definition particle.c:871
a5err particle_state_to_fo(particle_state *p, int i, particle_simd_fo *p_fo, int j, B_field_data *Bdata)
Convert state into a FO SIMD marker.
Definition particle.c:659
void particle_fo_to_state(particle_simd_fo *p_fo, int j, particle_state *p, B_field_data *Bdata)
Convert FO to state.
Definition particle.c:744
void particle_to_fo_dummy(particle_simd_fo *p_fo, int j)
Makes a dummy FO simulation marker.
Definition particle.c:132
int particle_fo_to_gc(particle_simd_fo *p_fo, int j, particle_simd_gc *p_gc, B_field_data *Bdata)
Convert FO struct into a GC struct.
Definition particle.c:1185
a5err particle_input_ml_to_state(particle_ml *p, particle_state *ps, B_field_data *Bdata)
Convert an input field line marker to particle state.
Definition particle.c:1656
void particle_input_to_state(input_particle *p, particle_state *ps, B_field_data *Bdata)
Converts input marker to a marker state.
Definition particle.c:550
void particle_to_gc_dummy(particle_simd_gc *p_gc, int j)
Makes a dummy GC simulation marker.
Definition particle.c:172
DECLARE_TARGET_SIMD void particle_copy_ml(particle_simd_ml *p1, int i, particle_simd_ml *p2, int j)
Copy ML struct.
Definition particle.c:1404
void particle_allocate_fo(particle_simd_fo *p_fo, int nmrk)
Allocates struct representing particle markers.
Definition particle.c:69
a5err particle_state_to_ml(particle_state *p, int i, particle_simd_ml *p_ml, int j, B_field_data *Bdata)
Convert state to a ML SIMD marker.
Definition particle.c:1052
a5err particle_input_p_to_state(particle *p, particle_state *ps, B_field_data *Bdata)
Convert an input particle marker to particle state.
Definition particle.c:1449
DECLARE_TARGET_END DECLARE_TARGET_SIMD void particle_copy_gc(particle_simd_gc *p1, int i, particle_simd_gc *p2, int j)
Copy GC struct.
Definition particle.c:1355
void particle_offload_fo(particle_simd_fo *p)
Offload particle struct to GPU.
Definition particle.c:1726
int particle_cycle_ml(particle_queue *q, particle_simd_ml *p, B_field_data *Bdata, int *cycle)
Replace finished ML markers with new ones or dummies.
Definition particle.c:461
input_particle_type
Marker types enum.
Definition particle.h:168
@ input_particle_type_gc
Definition particle.h:170
@ input_particle_type_p
Definition particle.h:169
@ input_particle_type_ml
Definition particle.h:171
@ input_particle_type_s
Definition particle.h:172
void particle_ml_to_state(particle_simd_ml *p_ml, int j, particle_state *p, B_field_data *Bdata)
Convert ML to state.
Definition particle.c:1117
GPU_DECLARE_TARGET_SIMD void particle_copy_fo(particle_simd_fo *p1, int i, particle_simd_fo *p2, int j)
Copy FO struct.
Definition particle.c:1302
int particle_cycle_gc(particle_queue *q, particle_simd_gc *p, B_field_data *Bdata, int *cycle)
Replace finished GC markers with new ones or dummies.
Definition particle.c:367
int particle_cycle_fo(particle_queue *q, particle_simd_fo *p, B_field_data *Bdata, int *cycle)
Replace finished FO markers with new ones or dummies.
Definition particle.c:268
Magnetic field simulation data.
Definition B_field.h:63
Wrapper for marker structs.
Definition particle.h:186
particle_ml p_ml
Definition particle.h:191
input_particle_type type
Definition particle.h:187
particle_state p_s
Definition particle.h:192
particle p
Definition particle.h:189
particle_gc p_gc
Definition particle.h:190
Guiding center input.
Definition particle.h:110
real weight
Definition particle.h:121
real energy
Definition particle.h:114
integer id
Definition particle.h:123
real charge
Definition particle.h:118
Field line input.
Definition particle.h:132
real weight
Definition particle.h:137
integer id
Definition particle.h:139
Marker queue.
Definition particle.h:154
particle_state ** p
Definition particle.h:156
volatile int next
Definition particle.h:158
volatile int finished
Definition particle.h:159
Struct representing NSIMD particle markers.
Definition particle.h:210
real * B_phi_dphi
Definition particle.h:233
integer * id
Definition particle.h:246
integer * endcond
Definition particle.h:247
integer * index
Definition particle.h:255
integer * walltile
Definition particle.h:248
integer * running
Definition particle.h:252
Struct representing NSIMD guiding center markers.
Definition particle.h:275
real charge[NSIMD] __memalign__
Definition particle.h:284
real B_r_dr[NSIMD] __memalign__
Definition particle.h:295
real rho[NSIMD] __memalign__
Definition particle.h:309
real mass[NSIMD] __memalign__
Definition particle.h:283
integer walltile[NSIMD] __memalign__
Definition particle.h:314
real z[NSIMD] __memalign__
Definition particle.h:279
real time[NSIMD] __memalign__
Definition particle.h:285
real mu[NSIMD] __memalign__
Definition particle.h:281
real r[NSIMD] __memalign__
Definition particle.h:277
real B_phi[NSIMD] __memalign__
Definition particle.h:290
real B_z_dphi[NSIMD] __memalign__
Definition particle.h:300
real mileage[NSIMD] __memalign__
Definition particle.h:318
real B_r_dphi[NSIMD] __memalign__
Definition particle.h:298
real B_r_dz[NSIMD] __memalign__
Definition particle.h:301
real B_r[NSIMD] __memalign__
Definition particle.h:288
real B_z[NSIMD] __memalign__
Definition particle.h:292
integer endcond[NSIMD] __memalign__
Definition particle.h:313
real cputime[NSIMD] __memalign__
Definition particle.h:308
real B_phi_dz[NSIMD] __memalign__
Definition particle.h:302
real zeta[NSIMD] __memalign__
Definition particle.h:282
integer index[NSIMD] __memalign__
Definition particle.h:323
real B_phi_dr[NSIMD] __memalign__
Definition particle.h:296
integer running[NSIMD] __memalign__
Definition particle.h:320
a5err err[NSIMD] __memalign__
Definition particle.h:322
real B_z_dr[NSIMD] __memalign__
Definition particle.h:297
real theta[NSIMD] __memalign__
Definition particle.h:310
real ppar[NSIMD] __memalign__
Definition particle.h:280
integer id[NSIMD] __memalign__
Definition particle.h:312
real B_z_dz[NSIMD] __memalign__
Definition particle.h:303
real weight[NSIMD] __memalign__
Definition particle.h:307
real phi[NSIMD] __memalign__
Definition particle.h:278
real B_phi_dphi[NSIMD] __memalign__
Definition particle.h:299
int bounces[NSIMD] __memalign__
Definition particle.h:306
Struct representing NSIMD field line markers.
Definition particle.h:342
real r[NSIMD] __memalign__
Definition particle.h:344
real B_r_dz[NSIMD] __memalign__
Definition particle.h:365
real cputime[NSIMD] __memalign__
Definition particle.h:371
real pitch[NSIMD] __memalign__
Definition particle.h:347
real rho[NSIMD] __memalign__
Definition particle.h:372
real B_z_dr[NSIMD] __memalign__
Definition particle.h:361
real B_phi_dphi[NSIMD] __memalign__
Definition particle.h:363
real mileage[NSIMD] __memalign__
Definition particle.h:381
real phi[NSIMD] __memalign__
Definition particle.h:345
real B_phi_dz[NSIMD] __memalign__
Definition particle.h:366
real B_r_dphi[NSIMD] __memalign__
Definition particle.h:362
real weight[NSIMD] __memalign__
Definition particle.h:370
real z[NSIMD] __memalign__
Definition particle.h:346
real theta[NSIMD] __memalign__
Definition particle.h:373
integer walltile[NSIMD] __memalign__
Definition particle.h:377
real B_z_dphi[NSIMD] __memalign__
Definition particle.h:364
integer running[NSIMD] __memalign__
Definition particle.h:383
real time[NSIMD] __memalign__
Definition particle.h:349
real B_phi[NSIMD] __memalign__
Definition particle.h:354
integer id[NSIMD] __memalign__
Definition particle.h:375
real B_z_dz[NSIMD] __memalign__
Definition particle.h:367
integer index[NSIMD] __memalign__
Definition particle.h:386
real B_phi_dr[NSIMD] __memalign__
Definition particle.h:360
real B_r_dr[NSIMD] __memalign__
Definition particle.h:359
real B_r[NSIMD] __memalign__
Definition particle.h:352
a5err err[NSIMD] __memalign__
Definition particle.h:385
integer endcond[NSIMD] __memalign__
Definition particle.h:376
real B_z[NSIMD] __memalign__
Definition particle.h:356
General representation of a marker.
Definition particle.h:40
integer id
Definition particle.h:63
integer walltile
Definition particle.h:65
real B_phi_dphi
Definition particle.h:73
integer endcond
Definition particle.h:64
Particle input.
Definition particle.h:88
real charge
Definition particle.h:96
int anum
Definition particle.h:97
real z
Definition particle.h:91
real weight
Definition particle.h:99
real phi
Definition particle.h:90
real p_phi
Definition particle.h:93
real time
Definition particle.h:100
int znum
Definition particle.h:98
real r
Definition particle.h:89
real mass
Definition particle.h:95
real p_z
Definition particle.h:94
integer id
Definition particle.h:101
real p_r
Definition particle.h:92