ASCOT5
Loading...
Searching...
No Matches
afsi.c
Go to the documentation of this file.
1
5#include <string.h>
6#include <math.h>
7#include <hdf5_hl.h>
8#include "ascot5.h"
9#include "print.h"
10#include "gitver.h"
11#include "consts.h"
12#include "random.h"
13#include "simulate.h"
14#include "boschhale.h"
15#include "diag/dist_5D.h"
16#include "hdf5_interface.h"
17#include "hdf5io/hdf5_helpers.h"
18#include "hdf5io/hdf5_dist.h"
19#include "afsi.h"
20
23
25 afsi_data* react1, afsi_data* react2, real m1, real m2, int n, int iR,
26 int iphi, int iz, real* ppara1, real* pperp1, real* ppara2, real* pperp2);
28 int i, real m1, real m2, real mprod1, real mprod2, real Q,
29 real* ppara1, real* pperp1, real* ppara2, real* pperp2, real* vcom2,
30 real* pparaprod1, real* pperpprod1, real* pparaprod2, real* pperpprod2);
31void afsi_sample_5D(dist_5D_data* dist, int n, int iR, int iphi, int iz,
32 real* ppara, real* pperp);
33void afsi_sample_thermal(afsi_thermal_data* data, real mass, int n, int iR,
34 int iphi, int iz, real* ppara, real* pperp);
35real afsi_get_density(afsi_data* dist, int iR, int iphi, int iz);
36real afsi_get_volume(afsi_data* dist, int iR);
37
55void afsi_run(sim_offload_data* sim, Reaction reaction, int n,
56 afsi_data* react1, afsi_data* react2, real mult,
57 dist_5D_offload_data* prod1_offload_data,
58 dist_5D_offload_data* prod2_offload_data,
59 real* prod1_offload_array, real* prod2_offload_array) {
60 /* QID for this run */
61 char qid[11];
63 strcpy(sim->qid, qid);
64
65 int mpi_rank = 0, mpi_root = 0; /* AFSI does not support MPI */
66 print_out0(VERBOSE_MINIMAL, mpi_rank, mpi_root, "AFSI5\n");
67 print_out0(VERBOSE_MINIMAL, mpi_rank, mpi_root,
68 "Tag %s\nBranch %s\n\n", GIT_VERSION, GIT_BRANCH);
69
70 dist_5D_data prod1, prod2;
71 dist_5D_init(&prod1, prod1_offload_data, prod1_offload_array);
72 dist_5D_init(&prod2, prod2_offload_data, prod2_offload_array);
73
75 random_init(&rdata, time((NULL)));
77 strcpy(sim->hdf5_out, sim->hdf5_in);
78 sim_init(&sim_data, sim);
79
80 if( hdf5_interface_init_results(sim, qid, "afsi") ) {
81 print_out0(VERBOSE_MINIMAL, mpi_rank, mpi_root,
82 "\nInitializing output failed.\n"
83 "See stderr for details.\n");
84 /* Free offload data and terminate */
85 abort();
86 }
87
88 real m1, q1, m2, q2, mprod1, qprod1, mprod2, qprod2, Q;
90 reaction, &m1, &q1, &m2, &q2, &mprod1, &qprod1, &mprod2, &qprod2, &Q);
91
92 int n_r=0, n_phi=0, n_z=0;
93 if(react1->type == 1) {
94 n_r = react1->dist_5D->n_r;
95 n_phi = react1->dist_5D->n_phi;
96 n_z = react1->dist_5D->n_z;
97 }
98 else if(react1->type == 2) {
99 n_r = react1->dist_thermal->n_r;
100 n_phi = react1->dist_thermal->n_phi;
101 n_z = react1->dist_thermal->n_z;
102 }
103
104 #pragma omp parallel for
105 for(int iR = 0; iR < n_r; iR++) {
106 real* ppara1 = (real*) malloc(n*sizeof(real));
107 real* pperp1 = (real*) malloc(n*sizeof(real));
108 real* ppara2 = (real*) malloc(n*sizeof(real));
109 real* pperp2 = (real*) malloc(n*sizeof(real));
110 real* pparaprod1 = (real*) malloc(n*sizeof(real));
111 real* pperpprod1 = (real*) malloc(n*sizeof(real));
112 real* pparaprod2 = (real*) malloc(n*sizeof(real));
113 real* pperpprod2 = (real*) malloc(n*sizeof(real));
114
115 real vol = afsi_get_volume(react1, iR);
116 for(int iphi = 0; iphi < n_phi; iphi++) {
117 for(int iz = 0; iz < n_z; iz++) {
118 real density1 = afsi_get_density(react1, iR, iphi, iz);
119 real density2 = afsi_get_density(react2, iR, iphi, iz);
120 if(density1 > 0 && density2 > 0) {
122 react1, react2, m1, m2, n, iR, iphi, iz,
123 ppara1, pperp1, ppara2, pperp2);
124 for(int i = 0; i < n; i++) {
125 real vcom2;
127 i, m1, m2, mprod1, mprod2, Q,
128 ppara1, pperp1, ppara2, pperp2, &vcom2,
129 pparaprod1, pperpprod1, pparaprod2, pperpprod2);
130 real E = 0.5 * ( m1 * m2 ) / ( m1 + m2 ) * vcom2;
131
132 real weight = density1 * density2 * sqrt(vcom2)
133 * boschhale_sigma(reaction, E)/n*vol;
134
135 int ippara = floor(
136 (pparaprod1[i] - prod1.min_ppara) * prod1.n_ppara
137 / ( prod1.max_ppara - prod1.min_ppara ) );
138 int ipperp = floor(
139 (pperpprod1[i] - prod1.min_pperp) * prod1.n_pperp
140 / ( prod1.max_pperp - prod1.min_pperp ) );
141 if( 0 <= ippara && ippara < prod1.n_ppara &&
142 0 <= ipperp && ipperp < prod1.n_pperp) {
144 iR, iphi, iz, ippara, ipperp, 0, 0,
145 prod1.step_6, prod1.step_5, prod1.step_4,
146 prod1.step_3, prod1.step_2, prod1.step_1)]
147 += weight * mult;
148 }
149
150 ippara = floor(
151 (pparaprod2[i] - prod2.min_ppara) * prod2.n_ppara
152 / ( prod2.max_ppara - prod2.min_ppara ) );
153 ipperp = floor(
154 (pperpprod2[i] - prod2.min_pperp) * prod2.n_pperp
155 / ( prod2.max_pperp - prod2.min_pperp ) );
156 if( 0 <= ippara && ippara < prod2.n_ppara &&
157 0 <= ipperp && ipperp < prod2.n_pperp) {
159 iR, iphi, iz, ippara, ipperp, 0, 0,
160 prod2.step_6, prod2.step_5, prod2.step_4,
161 prod2.step_3, prod2.step_2, prod2.step_1)]
162 += weight * mult;
163 }
164 }
165 }
166 else {
167 /* Do nothing */
168 }
169 }
170 }
171 free(ppara1);
172 free(ppara2);
173 free(pperp1);
174 free(pperp2);
175 free(pparaprod1);
176 free(pparaprod2);
177 free(pperpprod1);
178 free(pperpprod2);
179 }
180
181 m1 = m1 / CONST_U;
182 m2 = m2 / CONST_U;
183 mprod1 = mprod1 / CONST_U;
184 mprod2 = mprod2 / CONST_U;
185 int c1 = (int)rint(q1 / CONST_E);
186 int c2 = (int)rint(q2 / CONST_E);
187 int cprod1 = (int)rint(qprod1 / CONST_E);
188 int cprod2 = (int)rint(qprod2 / CONST_E);
189
190 hid_t f = hdf5_open(sim->hdf5_out);
191 if(f < 0) {
192 print_err("Error: File not found.\n");
193 abort();
194 }
195 char path[300];
196 sprintf(path, "/results/afsi_%s/reaction", sim->qid);
197 hid_t reactiondata = H5Gcreate2(f, path, H5P_DEFAULT, H5P_DEFAULT,
198 H5P_DEFAULT);
199 if(reactiondata < 0) {
200 print_err("Failed to write reaction data.\n");
201 abort();
202 }
203 hsize_t size = 1;
204 real q = Q / CONST_E;
205 if(H5LTmake_dataset_double(reactiondata, "m1", 1, &size, &m1)) {
206 print_err("Failed to write reaction data.\n");
207 abort();
208 }
209 if(H5LTmake_dataset_double(reactiondata, "m2", 1, &size, &m2)) {
210 print_err("Failed to write reaction data.\n");
211 abort();
212 }
213 if(H5LTmake_dataset_double(reactiondata, "mprod1", 1, &size, &mprod1)) {
214 print_err("Failed to write reaction data.\n");
215 abort();
216 }
217 if(H5LTmake_dataset_double(reactiondata, "mprod2", 1, &size, &mprod2)) {
218 print_err("Failed to write reaction data.\n");
219 abort();
220 }
221 if(H5LTmake_dataset_double(reactiondata, "q", 1, &size, &q)) {
222 print_err("Failed to write reaction data.\n");
223 abort();
224 }
225 if(H5LTmake_dataset_int(reactiondata, "q1", 1, &size, &c1)) {
226 print_err("Failed to write reaction data.\n");
227 abort();
228 }
229 if(H5LTmake_dataset_int(reactiondata, "q2", 1, &size, &c2)) {
230 print_err("Failed to write reaction data.\n");
231 abort();
232 }
233 if(H5LTmake_dataset_int(reactiondata, "qprod1", 1, &size, &cprod1)) {
234 print_err("Failed to write reaction data.\n");
235 abort();
236 }
237 if(H5LTmake_dataset_int(reactiondata, "qprod2", 1, &size, &cprod2)) {
238 print_err("Failed to write reaction data.\n");
239 abort();
240 }
241 if(H5Gclose(reactiondata)) {
242 print_err("Failed to write reaction data.\n");
243 abort();
244 }
245
246 sprintf(path, "/results/afsi_%s/prod1dist5d", sim->qid);
247 if( hdf5_dist_write_5D(f, path, prod1_offload_data, prod1_offload_array) ) {
248 print_err("Warning: 5D distribution could not be written.\n");
249 }
250 sprintf(path, "/results/afsi_%s/prod2dist5d", sim->qid);
251 if( hdf5_dist_write_5D(f, path, prod2_offload_data, prod2_offload_array) ) {
252 print_err("Warning: 5D distribution could not be written.\n");
253 }
254 if(hdf5_close(f)) {
255 print_err("Failed to close the file.\n");
256 abort();
257 }
258
259 print_out0(VERBOSE_MINIMAL, mpi_rank, mpi_root, "\nDone\n");
260}
261
279 afsi_data* react1, afsi_data* react2, real m1, real m2, int n, int iR,
280 int iphi, int iz, real* ppara1, real* pperp1, real* ppara2, real* pperp2) {
281
282 if(react1->type == 1) {
283 afsi_sample_5D(react1->dist_5D, n, iR, iphi, iz, ppara1, pperp1);
284 }
285 else if(react1->type == 2) {
287 react1->dist_thermal, m1, n, iR, iphi, iz, ppara1, pperp1);
288 }
289
290 if(react2->type == 1) {
291 afsi_sample_5D(react2->dist_5D, n, iR, iphi, iz, ppara2, pperp2);
292 }
293 else if(react2->type == 2) {
295 react2->dist_thermal, m2, n, iR, iphi, iz, ppara2, pperp2);
296 }
297}
298
319 int i, real m1, real m2, real mprod1, real mprod2, real Q,
320 real* ppara1, real* pperp1, real* ppara2, real* pperp2, real* vcom2,
321 real* pparaprod1, real* pperpprod1, real* pparaprod2, real* pperpprod2) {
322
325
326 real v1x = cos(rn1) * pperp1[i] / m1;
327 real v1y = sin(rn1) * pperp1[i] / m1;
328 real v1z = ppara1[i] / m1;
329
330 real v2x = cos(rn2) * pperp2[i] / m2;
331 real v2y = sin(rn2) * pperp2[i] / m2;
332 real v2z = ppara2[i] / m2;
333
334 *vcom2 = (v1x - v2x) * (v1x - v2x)
335 + (v1y - v2y) * (v1y - v2y)
336 + (v1z - v2z) * (v1z - v2z);
337
338 // Velocity of the system's center of mass
339 real v_cm[3];
340 v_cm[0] = ( m1 * v1x + m2 * v2x ) / ( m1 + m2 );
341 v_cm[1] = ( m1 * v1y + m2 * v2y ) / ( m1 + m2 );
342 v_cm[2] = ( m1 * v1z + m2 * v2z ) / ( m1 + m2 );
343
344 // Total kinetic energy after the reaction in CM frame
345 real ekin = Q
346 + 0.5 * m1 * ( (v1x - v_cm[0])*(v1x - v_cm[0])
347 + (v1y - v_cm[1])*(v1y - v_cm[1])
348 + (v1z - v_cm[2])*(v1z - v_cm[2]) )
349 + 0.5 * m2 * ( (v2x - v_cm[0])*(v2x - v_cm[0])
350 + (v2y - v_cm[1])*(v2y - v_cm[1])
351 + (v2z - v_cm[2])*(v2z - v_cm[2]) );
352
353 // Speed and velocity of product 2 in CM frame
354 rn1 = random_uniform(rdata);
355 rn2 = random_uniform(rdata);
356 real phi = CONST_2PI * rn1;
357 real theta = acos( 2 * ( rn2 - 0.5 ) );
358 real vnorm = sqrt( 2.0 * ekin / ( mprod2 * ( 1.0 + mprod2 / mprod1 ) ) );
359
360 real v2_cm[3];
361 v2_cm[0] = vnorm * sin(theta) * cos(phi);
362 v2_cm[1] = vnorm * sin(theta) * sin(phi);
363 v2_cm[2] = vnorm * cos(theta);
364
365 // Products' velocities in lab frame
366 real vprod1[3], vprod2[3];
367 vprod1[0] = -(mprod2/mprod1) * v2_cm[0] + v_cm[0];
368 vprod1[1] = -(mprod2/mprod1) * v2_cm[1] + v_cm[1];
369 vprod1[2] = -(mprod2/mprod1) * v2_cm[2] + v_cm[2];
370 vprod2[0] = v2_cm[0] + v_cm[0];
371 vprod2[1] = v2_cm[1] + v_cm[1];
372 vprod2[2] = v2_cm[2] + v_cm[2];
373
374 // ppara and pperp
375 pparaprod1[i] = vprod1[2] * mprod1;
376 pperpprod1[i] = sqrt( vprod1[0]*vprod1[0] + vprod1[1]*vprod1[1] ) * mprod1;
377 pparaprod2[i] = vprod2[2] * mprod2;
378 pperpprod2[i] = sqrt( vprod2[0]*vprod2[0] + vprod2[1]*vprod2[1] ) * mprod2;
379}
380
392void afsi_sample_5D(dist_5D_data* dist, int n, int iR, int iphi, int iz,
393 real* ppara, real* pperp) {
394 real* cumdist = (real*) malloc(dist->n_ppara*dist->n_pperp*sizeof(real));
395
396 for(int ippara = 0; ippara < dist->n_ppara; ippara++) {
397 for(int ipperp = 0; ipperp < dist->n_pperp; ipperp++) {
398 if(ippara == 0 && ipperp == 0) {
399 cumdist[0] = dist->histogram[dist_5D_index(
400 iR, iphi, iz, 0, 0, 0, 0, dist->step_6, dist->step_5,
401 dist->step_4, dist->step_3, dist->step_2,
402 dist->step_1)];
403 } else {
404 cumdist[ippara*dist->n_pperp+ipperp] =
405 cumdist[ippara*dist->n_pperp+ipperp-1]
406 + dist->histogram[dist_5D_index(
407 iR, iphi, iz, ippara, ipperp, 0, 0, dist->step_6,
408 dist->step_5, dist->step_4, dist->step_3, dist->step_2,
409 dist->step_1)];
410 }
411 }
412 }
413 for(int ippara = 0; ippara < dist->n_ppara; ippara++) {
414 for(int ipperp = 0; ipperp < dist->n_pperp; ipperp++) {
415 cumdist[ippara*dist->n_pperp+ipperp] /=
416 cumdist[dist->n_ppara*dist->n_pperp-1];
417 }
418 }
419
420 for(int i = 0; i < n; i++) {
422 for(int j = 0; j < dist->n_ppara*dist->n_pperp; j++) {
423 if(cumdist[j] > r) {
424 pperp[i] = dist->min_pperp + (j % dist->n_pperp + 0.5)
425 * (dist->max_pperp - dist->min_pperp) / dist->n_pperp;
426 ppara[i] = dist->min_ppara + (j / dist->n_pperp + 0.5)
427 * (dist->max_ppara - dist->min_ppara) / dist->n_ppara;
428 break;
429 }
430 }
431 }
432 free(cumdist);
433}
434
451void afsi_sample_thermal(afsi_thermal_data* data, real mass, int n, int iR,
452 int iphi, int iz, real* ppara, real* pperp) {
453 int ind = iR * (data->n_phi * data->n_z) + iphi * data->n_z + iz;
454 real temp = data->temperature[ind];
455
456 for(int i = 0; i < n; i++) {
457 real r1, r2, r3, r4, E;
458
459 r1 = random_uniform(rdata);
460 r2 = random_uniform(rdata);
461 r3 = cos( 0.5 * random_uniform(rdata) * CONST_PI );
462 E = -temp * ( log(r1) + log(r2) * r3 * r3 );
463
464 r4 = 1.0 - 2 * random_uniform(rdata);
465 pperp[i] = sqrt( ( 1 - r4*r4 ) * 2 * E * mass);
466 ppara[i] = r4 * sqrt(2 * E * mass);
467 }
468}
469
479real afsi_get_density(afsi_data* dist, int iR, int iphi, int iz) {
480 if(dist->type == 1) {
481 real vol = afsi_get_volume(dist, iR);
482
483 real density = 0.0;
484 for(int ippara = 0; ippara < dist->dist_5D->n_ppara; ippara++) {
485 for(int ipperp = 0; ipperp < dist->dist_5D->n_pperp; ipperp++) {
486 density += dist->dist_5D->histogram[dist_5D_index(
487 iR, iphi, iz, ippara, ipperp, 0, 0,
488 dist->dist_5D->step_6, dist->dist_5D->step_5,
489 dist->dist_5D->step_4, dist->dist_5D->step_3,
490 dist->dist_5D->step_2, dist->dist_5D->step_1)] / vol;
491 }
492 }
493 return density;
494 }
495
496 else if(dist->type == 2) {
497 return dist->dist_thermal->density[
498 iR * dist->dist_thermal->n_phi * dist->dist_thermal->n_z
499 + iphi * dist->dist_thermal->n_z + iz];
500 }
501
502 else {
503 return 0;
504 }
505}
506
515 real dR, dz;
516
517 if(dist->type == 1) {
518 dR = (dist->dist_5D->max_r - dist->dist_5D->min_r) / dist->dist_5D->n_r;
519 dz = (dist->dist_5D->max_z - dist->dist_5D->min_z) / dist->dist_5D->n_z;
520 return CONST_2PI*(dist->dist_5D->min_r + iR * dR + 0.5*dR)*dR*dz;
521 }
522
523 else if(dist->type == 2) {
524 dR = (dist->dist_thermal->max_r - dist->dist_thermal->min_r)
525 / dist->dist_thermal->n_r;
526 dz = (dist->dist_thermal->max_z - dist->dist_thermal->min_z)
527 / dist->dist_thermal->n_z;
528 return CONST_2PI*(dist->dist_thermal->min_r + iR * dR + 0.5*dR)*dR*dz;
529 }
530 return 0;
531}
532
539 printf("%d %le %le\n", dist1->n_r, dist1->min_r, dist1->max_r);
540 printf("%d %le %le\n", dist1->n_phi, dist1->min_phi, dist1->max_phi);
541 printf("%d %le %le\n", dist1->n_z, dist1->min_z, dist1->max_z);
542 printf("%d %le %le\n", dist1->n_ppara, dist1->min_ppara, dist1->max_ppara);
543 printf("%d %le %le\n", dist1->n_pperp, dist1->min_pperp, dist1->max_pperp);
544 printf("%d %le %le\n", dist1->n_time, dist1->min_time, dist1->max_time);
545 printf("%d %le %le\n", dist1->n_q, dist1->min_q, dist1->max_q);
546
547 real sum = 0.0;
548
549 int ncell = dist1->n_r * dist1->n_phi * dist1->n_z * dist1->n_ppara
550 * dist1->n_pperp * dist1->n_time * dist1->n_q;
551 for(int i = 0; i < ncell; i++) {
552 sum += dist1->histogram[i];
553 }
554
555 printf("%le\n", sum);
556}
557
563
564 data.n_r = 1;
565 data.min_r = 0.1;
566 data.max_r = 1;
567 data.n_phi = 1;
568 data.min_phi = 0;
569 data.max_phi = 360;
570 data.n_z = 1;
571 data.min_z = -1;
572 data.max_z = 1;
573
574 real temperature = 1e3;
575 real density = 1e19;
576
577 data.temperature = &temperature;
578 data.density = &density;
579
580 int n = 100000;
581 real* ppara = (real*) malloc(n*sizeof(real));
582 real* pperp = (real*) malloc(n*sizeof(real));
583
584 afsi_sample_thermal(&data, 3.343e-27, n, 0, 0, 0, ppara, pperp);
585
586 for(int i = 0; i < n; i++) {
587 printf("%le %le\n", ppara[i], pperp[i]);
588 }
589}
random_data rdata
Definition afsi.c:22
void afsi_sample_thermal(afsi_thermal_data *data, real mass, int n, int iR, int iphi, int iz, real *ppara, real *pperp)
Sample ppara and pperp from a thermal (Maxwellian) population.
Definition afsi.c:451
void afsi_test_thermal()
Test thermal source.
Definition afsi.c:561
real afsi_get_volume(afsi_data *dist, int iR)
Get physical volume of a distribution cell.
Definition afsi.c:514
void afsi_sample_5D(dist_5D_data *dist, int n, int iR, int iphi, int iz, real *ppara, real *pperp)
Sample ppara and pperp from a 5D distribution.
Definition afsi.c:392
void afsi_compute_product_momenta(int i, real m1, real m2, real mprod1, real mprod2, real Q, real *ppara1, real *pperp1, real *ppara2, real *pperp2, real *vcom2, real *pparaprod1, real *pperpprod1, real *pparaprod2, real *pperpprod2)
Compute momenta of reaction products.
Definition afsi.c:318
real afsi_get_density(afsi_data *dist, int iR, int iphi, int iz)
Get particle density.
Definition afsi.c:479
void afsi_sample_reactant_momenta(afsi_data *react1, afsi_data *react2, real m1, real m2, int n, int iR, int iphi, int iz, real *ppara1, real *pperp1, real *ppara2, real *pperp2)
Sample velocities from reactant distributions.
Definition afsi.c:278
void afsi_run(sim_offload_data *sim, Reaction reaction, int n, afsi_data *react1, afsi_data *react2, real mult, dist_5D_offload_data *prod1_offload_data, dist_5D_offload_data *prod2_offload_data, real *prod1_offload_array, real *prod2_offload_array)
Calculate fusion source from two arbitrary ion distributions.
Definition afsi.c:55
void afsi_test_dist(dist_5D_data *dist1)
Test distribution.
Definition afsi.c:538
Main header file for ASCOT5.
double real
Definition ascot5.h:85
void boschhale_reaction(Reaction reaction, real *m1, real *q1, real *m2, real *q2, real *mprod1, real *qprod1, real *mprod2, real *qprod2, real *Q)
Get masses and charges of particles participating in the reaction and the released energy.
Definition boschhale.c:28
real boschhale_sigma(Reaction reaction, real E)
Estimate cross-section for a given fusion reaction.
Definition boschhale.c:87
Header file for boschdale.c.
Reaction
Available reactions.
Definition boschhale.h:13
Header file containing physical and mathematical constants.
#define CONST_U
Atomic mass unit in kilograms [kg]
Definition consts.h:29
#define CONST_PI
pi
Definition consts.h:11
#define CONST_2PI
2*pi
Definition consts.h:14
#define CONST_E
Elementary charge [C]
Definition consts.h:32
void dist_5D_init(dist_5D_data *dist_data, dist_5D_offload_data *offload_data, real *offload_array)
Initializes distribution from offload data.
Definition dist_5D.c:60
size_t dist_5D_index(int i_r, int i_phi, int i_z, int i_ppara, int i_pperp, int i_time, int i_q, size_t step_6, size_t step_5, size_t step_4, size_t step_3, size_t step_2, size_t step_1)
Function for calculating the index in the histogram array.
Definition dist_5D.c:17
Header file for dist_5D.c.
int hdf5_dist_write_5D(hid_t f, char *path, dist_5D_offload_data *dist, real *hist)
Write 5D distribution to an existing result group.
Definition hdf5_dist.c:27
herr_t hdf5_close(hid_t file_id)
Close access to given hdf5 file identifier. A negative value is returned on failure.
hid_t hdf5_open(const char *filename)
Open a hdf5 file for reading and writing. A negative value is returned on failure.
Header file for hdf5_helpers.h.
int hdf5_interface_init_results(sim_offload_data *sim, char *qid, char *run)
Initialize run group.
void hdf5_generate_qid(char *qid)
Generate an identification number for a run.
Header file for hdf5_interface.c.
Header file for math.c.
Macros for printing console output.
@ VERBOSE_MINIMAL
Definition print.h:19
#define print_out0(v, rank, root,...)
Print to standard output only for root process.
Definition print.h:36
#define print_err(...)
Print to standard error.
Definition print.h:42
Header file for random.c.
void * random_data
Definition random.h:87
#define random_uniform(data)
Definition random.h:96
#define random_init(data, seed)
Definition random.h:94
void simulate_init_offload(sim_offload_data *sim)
Initializes simulation settings.
Definition simulate.c:349
void sim_init(sim_data *sim, sim_offload_data *offload_data)
Initialize simulation data struct on target.
Definition simulate.c:365
Header file for simulate.c.
Wrapper around input data structures.
Definition afsi.h:39
dist_5D_data * dist_5D
Definition afsi.h:41
afsi_thermal_data * dist_thermal
Definition afsi.h:42
int type
Definition afsi.h:40
Structure for passing in 2D thermal temperature and density.
Definition afsi.h:19
real * density
Definition afsi.h:33
real * temperature
Definition afsi.h:32
Histogram parameters on target.
Definition dist_5D.h:48
real min_time
Definition dist_5D.h:70
real max_r
Definition dist_5D.h:51
real max_pperp
Definition dist_5D.h:67
size_t step_5
Definition dist_5D.h:81
real min_phi
Definition dist_5D.h:54
size_t step_3
Definition dist_5D.h:79
real max_phi
Definition dist_5D.h:55
real min_ppara
Definition dist_5D.h:62
size_t step_1
Definition dist_5D.h:77
real max_z
Definition dist_5D.h:59
real max_time
Definition dist_5D.h:71
size_t step_2
Definition dist_5D.h:78
int n_ppara
Definition dist_5D.h:61
size_t step_6
Definition dist_5D.h:82
int n_pperp
Definition dist_5D.h:65
real min_z
Definition dist_5D.h:58
real max_ppara
Definition dist_5D.h:63
real min_r
Definition dist_5D.h:50
real max_q
Definition dist_5D.h:75
real * histogram
Definition dist_5D.h:84
real min_pperp
Definition dist_5D.h:66
size_t step_4
Definition dist_5D.h:80
real min_q
Definition dist_5D.h:74
Histogram parameters that will be offloaded to target.
Definition dist_5D.h:15
Simulation data struct.
Definition simulate.h:154
Simulation offload struct.
Definition simulate.h:55
char hdf5_in[256]
Definition simulate.h:120
char qid[256]
Definition simulate.h:122
char hdf5_out[256]
Definition simulate.h:121