ASCOT5
Loading...
Searching...
No Matches
copytogpu.c
Go to the documentation of this file.
1
5#include "simulate.h"
6#include "particle.h"
7#include "B_field.h"
8#include "E_field.h"
9#include "copytogpu.h"
10
15 GPU_MAP_TO_DEVICE(sim[0:1])
16
17 switch(sim->wall_data.type) {
18 case wall_type_2D:
19 GPU_MAP_TO_DEVICE(
20 sim->wall_data.w2d.wall_r[0:sim->wall_data.w2d.n],sim->wall_data.w2d.wall_z[0:sim->wall_data.w2d.n] )
21 break;
22 case wall_type_3D:
23 GPU_MAP_TO_DEVICE(
25 break;
26 default:
27 break;
28 }
29
30 if(sim->diag_data.dist5D_collect) {
31 GPU_MAP_TO_DEVICE(
33 }
34
35 if(sim->diag_data.dist6D_collect) {
36 GPU_MAP_TO_DEVICE(
38 }
39
41 GPU_MAP_TO_DEVICE(
43 }
44
46 GPU_MAP_TO_DEVICE(
48 }
49
50 if(sim->diag_data.distCOM_collect) {
51 GPU_MAP_TO_DEVICE(
53 }
54
55
56 switch(sim->E_data.type) {
57
59 GPU_MAP_TO_DEVICE(
60 sim->E_data.E1DS,sim->E_data.E1DS.dV,sim->E_data.E1DS.dV.c[0:sim->E_data.E1DS.dV.n_x*NSIZE_COMP1D] )
61 break;
62 case E_field_type_TC:
63 GPU_MAP_TO_DEVICE(
64 sim->E_data.ETC,sim->E_data.ETC.Exyz[0:1] )
65 break;
66 default:
67 break;
68 }
69
70 switch(sim->plasma_data.type) {
71
72 case plasma_type_1D:
73 GPU_MAP_TO_DEVICE(
81 break;
82
83 case plasma_type_1Dt:
84 GPU_MAP_TO_DEVICE(
93 break;
94
95 case plasma_type_1DS:
96 GPU_MAP_TO_DEVICE(
101 sim->plasma_data.plasma_1DS.temp [0:2],\
103 sim->plasma_data.plasma_1DS.temp[0].c [0:sim->plasma_data.plasma_1DS.temp[0].n_x*NSIZE_COMP1D],\
104 sim->plasma_data.plasma_1DS.temp[1].c [0:sim->plasma_data.plasma_1DS.temp[1].n_x*NSIZE_COMP1D] )
105 for (int i=0;i<MAX_SPECIES;i++) {
106 GPU_MAP_TO_DEVICE(
107 sim->plasma_data.plasma_1DS.dens[i].c[0:sim->plasma_data.plasma_1DS.dens[i].n_x*NSIZE_COMP1D] )
108 }
109 break;
110
111 default:
112 break;
113 }
114
115 switch(sim->B_data.type) {
116
117 case B_field_type_GS:
118 GPU_MAP_TO_DEVICE(
119 sim->B_data.BGS.psi_coeff[0:13] )
120 break;
121 case B_field_type_2DS:
122 GPU_MAP_TO_DEVICE(
123 sim->B_data.B2DS.psi, sim->B_data.B2DS.psi.c [0:sim->B_data.B2DS.psi.n_x *sim->B_data.B2DS.psi.n_y *NSIZE_COMP2D],\
124 sim->B_data.B2DS.B_r, sim->B_data.B2DS.B_r.c [0:sim->B_data.B2DS.B_r.n_x *sim->B_data.B2DS.B_r.n_y *NSIZE_COMP2D],\
125 sim->B_data.B2DS.B_phi, sim->B_data.B2DS.B_phi.c [0:sim->B_data.B2DS.B_phi.n_x *sim->B_data.B2DS.B_phi.n_y *NSIZE_COMP2D],\
126 sim->B_data.B2DS.B_z, sim->B_data.B2DS.B_z.c [0:sim->B_data.B2DS.B_z.n_x *sim->B_data.B2DS.B_z.n_y *NSIZE_COMP2D] )
127 break;
128 case B_field_type_3DS:
129 GPU_MAP_TO_DEVICE(
130 sim->B_data.B3DS.psi, sim->B_data.B3DS.psi.c [0:sim->B_data.B3DS.psi.n_x *sim->B_data.B3DS.psi.n_y *NSIZE_COMP2D], \
131 sim->B_data.B3DS.B_r, sim->B_data.B3DS.B_r.c [0:sim->B_data.B3DS.B_r.n_x *sim->B_data.B3DS.B_r.n_y *sim->B_data.B3DS.B_r.n_z *NSIZE_COMP3D], \
132 sim->B_data.B3DS.B_phi, sim->B_data.B3DS.B_phi.c [0:sim->B_data.B3DS.B_phi.n_x *sim->B_data.B3DS.B_phi.n_y *sim->B_data.B3DS.B_phi.n_z *NSIZE_COMP3D], \
133 sim->B_data.B3DS.B_z, sim->B_data.B3DS.B_z.c [0:sim->B_data.B3DS.B_z.n_x *sim->B_data.B3DS.B_z.n_y *sim->B_data.B3DS.B_z.n_z *NSIZE_COMP3D] )
134
135 break;
136 case B_field_type_STS:
137 GPU_MAP_TO_DEVICE(
138 sim->B_data.BSTS.axis_r, sim->B_data.BSTS.axis_r.c [0:sim->B_data.BSTS.axis_r.n_x ], \
139 sim->B_data.BSTS.axis_z, sim->B_data.BSTS.axis_z.c [0:sim->B_data.BSTS.axis_z.n_x ], \
140 sim->B_data.BSTS.psi, sim->B_data.BSTS.psi.c [0:sim->B_data.BSTS.psi.n_x *sim->B_data.BSTS.psi.n_y *sim->B_data.BSTS.psi.n_z *NSIZE_COMP3D], \
141 sim->B_data.BSTS.B_r, sim->B_data.BSTS.B_r.c [0:sim->B_data.BSTS.B_r.n_x *sim->B_data.BSTS.B_r.n_y *sim->B_data.BSTS.B_r.n_z *NSIZE_COMP3D], \
142 sim->B_data.BSTS.B_z, sim->B_data.BSTS.B_z.c [0:sim->B_data.BSTS.B_z.n_x *sim->B_data.BSTS.B_z.n_y *sim->B_data.BSTS.B_z.n_z *NSIZE_COMP3D], \
143 sim->B_data.BSTS.B_phi, sim->B_data.BSTS.B_phi.c [0:sim->B_data.BSTS.B_phi.n_x *sim->B_data.BSTS.B_phi.n_y *sim->B_data.BSTS.B_phi.n_z *NSIZE_COMP3D] )
144 break;
145 case B_field_type_TC:
146 GPU_MAP_TO_DEVICE(
147 sim->B_data.BTC.B[0:3],sim->B_data.BTC.dB[0:9] )
148 break;
149 default:
150 break;
151 }
152}
153
158
159 GPU_UPDATE_FROM_DEVICE(
160 p_ptr->running[0:p_ptr->n_mrk],p_ptr->r[0:p_ptr->n_mrk],p_ptr->phi[0:p_ptr->n_mrk],p_ptr->p_r[0:p_ptr->n_mrk],p_ptr->p_phi[0:p_ptr->n_mrk],p_ptr->p_z[0:p_ptr->n_mrk],p_ptr->mileage[0:p_ptr->n_mrk], \
161 p_ptr->z[0:p_ptr->n_mrk],p_ptr->charge[0:p_ptr->n_mrk],p_ptr->mass[0:p_ptr->n_mrk],p_ptr->B_r[0:p_ptr->n_mrk],p_ptr->B_r_dr[0:p_ptr->n_mrk],p_ptr->B_r_dphi[0:p_ptr->n_mrk],p_ptr->B_r_dz[0:p_ptr->n_mrk], \
162 p_ptr->B_phi[0:p_ptr->n_mrk],p_ptr->B_phi_dr[0:p_ptr->n_mrk],p_ptr->B_phi_dphi[0:p_ptr->n_mrk],p_ptr->B_phi_dz[0:p_ptr->n_mrk],p_ptr->B_z[0:p_ptr->n_mrk],p_ptr->B_z_dr[0:p_ptr->n_mrk],p_ptr->B_z_dphi[0:p_ptr->n_mrk], \
163 p_ptr->B_z_dz[0:p_ptr->n_mrk],p_ptr->rho[0:p_ptr->n_mrk],p_ptr->theta[0:p_ptr->n_mrk],p_ptr->err[0:p_ptr->n_mrk],p_ptr->time[0:p_ptr->n_mrk],p_ptr->weight[0:p_ptr->n_mrk],p_ptr->cputime[0:p_ptr->n_mrk], \
164 p_ptr->id[0:p_ptr->n_mrk],p_ptr->endcond[0:p_ptr->n_mrk],p_ptr->walltile[0:p_ptr->n_mrk],p_ptr->index[0:p_ptr->n_mrk],p_ptr->znum[0:p_ptr->n_mrk],p_ptr->anum[0:p_ptr->n_mrk],p_ptr->bounces[0:p_ptr->n_mrk] )
165
166 GPU_MAP_FROM_DEVICE(
167 sim[0:1] )
168}
Header file for B_field.c.
@ B_field_type_2DS
Definition B_field.h:29
@ B_field_type_TC
Definition B_field.h:32
@ B_field_type_3DS
Definition B_field.h:30
@ B_field_type_STS
Definition B_field.h:31
@ B_field_type_GS
Definition B_field.h:28
Header file for E_field.c.
@ E_field_type_TC
Definition E_field.h:26
@ E_field_type_1DS
Definition E_field.h:27
#define MAX_SPECIES
Maximum number of plasma species.
Definition ascot5.h:95
void simulate_fo_fixed_copy_from_gpu(sim_data *sim, particle_simd_fo *p_ptr)
Copy data from GPU to CPU.
Definition copytogpu.c:157
void simulate_copy_to_gpu(sim_data *sim)
Copy data from CPU to GPU.
Definition copytogpu.c:14
Header file for copytogpu.c.
Header file for particle.c.
@ plasma_type_1D
Definition plasma.h:25
@ plasma_type_1Dt
Definition plasma.h:26
@ plasma_type_1DS
Definition plasma.h:27
Header file for simulate.c.
interp2D_data psi
Definition B_2DS.h:39
interp2D_data B_phi
Definition B_2DS.h:41
interp2D_data B_z
Definition B_2DS.h:42
interp2D_data B_r
Definition B_2DS.h:40
interp2D_data psi
Definition B_3DS.h:48
interp3D_data B_r
Definition B_3DS.h:49
interp3D_data B_phi
Definition B_3DS.h:50
interp3D_data B_z
Definition B_3DS.h:51
real * psi_coeff
Definition B_GS.h:44
interp3D_data psi
Definition B_STS.h:54
interp3D_data B_z
Definition B_STS.h:57
interp3D_data B_phi
Definition B_STS.h:56
linint1D_data axis_z
Definition B_STS.h:53
interp3D_data B_r
Definition B_STS.h:55
linint1D_data axis_r
Definition B_STS.h:52
real * dB
Definition B_TC.h:47
real * B
Definition B_TC.h:46
B_STS_data BSTS
Definition B_field.h:68
B_TC_data BTC
Definition B_field.h:69
B_2DS_data B2DS
Definition B_field.h:66
B_field_type type
Definition B_field.h:64
B_GS_data BGS
Definition B_field.h:65
B_3DS_data B3DS
Definition B_field.h:67
interp1D_data dV
Definition E_1DS.h:31
real * Exyz
Definition E_TC.h:28
E_TC_data ETC
Definition E_field.h:57
E_field_type type
Definition E_field.h:56
E_1DS_data E1DS
Definition E_field.h:58
dist_COM_data distCOM
Definition diag.h:68
int distrho5D_collect
Definition diag.h:58
int distrho6D_collect
Definition diag.h:59
dist_rho6D_data distrho6D
Definition diag.h:67
dist_5D_data dist5D
Definition diag.h:64
int dist5D_collect
Definition diag.h:56
int dist6D_collect
Definition diag.h:57
int distCOM_collect
Definition diag.h:60
dist_6D_data dist6D
Definition diag.h:65
dist_rho5D_data distrho5D
Definition diag.h:66
int n_ppara
Definition dist_5D.h:61
int n_pperp
Definition dist_5D.h:65
real * histogram
Definition dist_5D.h:84
real * histogram
Definition dist_6D.h:93
real * histogram
Definition dist_com.h:49
real * c
Definition interp.h:62
real * c
Definition interp.h:79
real * c
Definition interp.h:101
real * c
Definition linint.h:27
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
real mass[MAX_SPECIES]
Definition plasma_1DS.h:33
interp1D_data dens[MAX_SPECIES]
Definition plasma_1DS.h:39
real charge[MAX_SPECIES]
Definition plasma_1DS.h:34
interp1D_data temp[2]
Definition plasma_1DS.h:37
int anum[MAX_SPECIES]
Definition plasma_1DS.h:35
int znum[MAX_SPECIES]
Definition plasma_1DS.h:36
real charge[MAX_SPECIES]
Definition plasma_1D.h:32
int anum[MAX_SPECIES]
Definition plasma_1D.h:33
real mass[MAX_SPECIES]
Definition plasma_1D.h:31
int znum[MAX_SPECIES]
Definition plasma_1D.h:34
real charge[MAX_SPECIES]
Definition plasma_1Dt.h:34
int znum[MAX_SPECIES]
Definition plasma_1Dt.h:36
int anum[MAX_SPECIES]
Definition plasma_1Dt.h:35
real mass[MAX_SPECIES]
Definition plasma_1Dt.h:33
plasma_1D_data plasma_1D
Definition plasma.h:59
plasma_1Dt_data plasma_1Dt
Definition plasma.h:60
plasma_1DS_data plasma_1DS
Definition plasma.h:61
plasma_type type
Definition plasma.h:58
Simulation data struct.
Definition simulate.h:154
plasma_data plasma_data
Definition simulate.h:158
E_field_data E_data
Definition simulate.h:157
B_field_data B_data
Definition simulate.h:156
wall_data wall_data
Definition simulate.h:160
diag_data diag_data
Definition simulate.h:165
real * wall_z
Definition wall_2d.h:26
real * wall_r
Definition wall_2d.h:25
int * tree_array
Array storing information what triangles given octree cell stores.
Definition wall_3d.h:63
int tree_array_size
Definition wall_3d.h:53
real * wall_tris
Definition wall_3d.h:52
wall_type type
Definition wall.h:56
wall_3d_data w3d
Definition wall.h:58
wall_2d_data w2d
Definition wall.h:57
@ wall_type_2D
Definition wall.h:25
@ wall_type_3D
Definition wall.h:26