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
210typedef struct {
211 /* Physical coordinates and parameters */
221 int* znum;
222 int* anum;
223
224 /* Magnetic field data */
228
238
239 /* Quantities used in diagnostics */
240 int* bounces;
245
249
250 /* Meta data */
256 size_t n_mrk;
258
325
342typedef struct {
343 /* Physical coordinates and parameters */
350
351 /* Magnetic field data */
358
363 real B_phi_dphi[NSIMD] __memalign__;
368
369 /* Quantities used in diagnostics */
374
379
380 /* Meta data */
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
415
416DECLARE_TARGET_SIMD_UNIFORM(Bdata)
418 int j, B_field_data* Bdata);
419DECLARE_TARGET_SIMD_UNIFORM(Bdata)
421 B_field_data* Bdata);
422DECLARE_TARGET_SIMD_UNIFORM(Bdata)
424 int j, B_field_data* Bdata);
425DECLARE_TARGET_SIMD_UNIFORM(Bdata)
427 B_field_data* Bdata);
428DECLARE_TARGET_SIMD_UNIFORM(Bdata)
430 int j, B_field_data* Bdata);
431DECLARE_TARGET_SIMD_UNIFORM(Bdata)
433 B_field_data* Bdata);
434DECLARE_TARGET_SIMD_UNIFORM(p_fo,Bdata)
436 B_field_data* Bdata);
437GPU_DECLARE_TARGET_SIMD
438void particle_copy_fo(particle_simd_fo* p1, int i, particle_simd_fo* p2, int j);
439DECLARE_TARGET_END
440DECLARE_TARGET_SIMD
441void particle_copy_gc(particle_simd_gc* p1, int i, particle_simd_gc* p2, int j);
442DECLARE_TARGET_SIMD
443void particle_copy_ml(particle_simd_ml* p1, int i, particle_simd_ml* p2, int j);
444
445#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_onload_fo(particle_simd_fo *p)
Onload particle struct from the GPU.
Definition particle.c:1772
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:41
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 r[NSIMD] __memalign__
Definition particle.h:277
Struct representing NSIMD field line markers.
Definition particle.h:342
real r[NSIMD] __memalign__
Definition particle.h:344
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