ASCOT5
|
Interface for simulation diagnostics. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ascot5.h"
#include "simulate.h"
#include "B_field.h"
#include "diag.h"
#include "diag/diag_orb.h"
#include "diag/dist_5D.h"
#include "diag/dist_6D.h"
#include "diag/dist_rho5D.h"
#include "diag/dist_rho6D.h"
#include "diag/dist_com.h"
#include "diag/diag_transcoef.h"
#include "particle.h"
Go to the source code of this file.
Functions | |
void | diag_arraysum (size_t start, size_t stop, real *array1, real *array2) |
Simple helper function for summing elements of two arrays of same size. | |
int | diag_init_offload (diag_offload_data *data, real **offload_array, int Nmrk) |
Initializes offload array from offload data. | |
void | diag_free_offload (diag_offload_data *data, real **offload_array) |
Frees the offload array. | |
void | diag_init (diag_data *data, diag_offload_data *offload_data, real *offload_array) |
Initializes diagnostics from offload data. | |
void | diag_free (diag_data *data) |
Free diagnostics data. | |
void | diag_update_fo (diag_data *data, B_field_data *Bdata, particle_simd_fo *p_f, particle_simd_fo *p_i) |
Collects diagnostics when marker represents a particle. | |
void | diag_update_gc (diag_data *data, B_field_data *Bdata, particle_simd_gc *p_f, particle_simd_gc *p_i) |
Collects diagnostics when marker represents a guiding center. | |
void | diag_update_ml (diag_data *data, particle_simd_ml *p_f, particle_simd_ml *p_i) |
Collects diagnostics when marker represents a magnetic field line. | |
void | diag_sum (diag_offload_data *data, real *array1, real *array2) |
Sum offload data arrays as one. | |
Interface for simulation diagnostics.
Ascot standard output consists of inistate and endstate. Any other output is generated by "diagnostics" that are updated during the simulation. All diagnostics are accessed via this interface. To implement a new diagnostics, it is enough that one add calls to that diagnostics routines here.
One limitation for diagnostic data is that the size of the data must be known before simulation begins so that offloading of that data is possible.
Definition in file diag.c.
Simple helper function for summing elements of two arrays of same size.
This function is indented for summing distribution ordinates. Indexing starts from 1 and indices given as arguments are inclusive.
start | index to array element where summation begins |
stop | index to array element where summation ends |
array1 | pointer to array where array2 is summed to |
array2 | pointer to array which is to be summed |
int diag_init_offload | ( | diag_offload_data * | data, |
real ** | offload_array, | ||
int | Nmrk ) |
void diag_free_offload | ( | diag_offload_data * | data, |
real ** | offload_array ) |
void diag_init | ( | diag_data * | data, |
diag_offload_data * | offload_data, | ||
real * | offload_array ) |
void diag_free | ( | diag_data * | data | ) |
void diag_update_fo | ( | diag_data * | data, |
B_field_data * | Bdata, | ||
particle_simd_fo * | p_f, | ||
particle_simd_fo * | p_i ) |
Collects diagnostics when marker represents a particle.
data | diagnostics data struct |
Bdata | pointer to magnetic field data |
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
void diag_update_gc | ( | diag_data * | data, |
B_field_data * | Bdata, | ||
particle_simd_gc * | p_f, | ||
particle_simd_gc * | p_i ) |
Collects diagnostics when marker represents a guiding center.
data | pointer to diagnostics data struct |
Bdata | pointer to magnetic field data |
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
void diag_update_ml | ( | diag_data * | data, |
particle_simd_ml * | p_f, | ||
particle_simd_ml * | p_i ) |
Collects diagnostics when marker represents a magnetic field line.
Distributions are not updated for magnetic field lines.
data | pointer to diagnostics data struct |
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
void diag_sum | ( | diag_offload_data * | data, |
real * | array1, | ||
real * | array2 ) |
Sum offload data arrays as one.
The data in both arrays have identical order so distributions can be summed trivially. For orbits and transport coefficients the first array already have space for appending the orbit data from the second array, so we only need to move those elements.
data | pointer to diagnostics data struct |
array1 | the array to which array2 is summed |
array2 | the array which is to be summed |