ASCOT5
Loading...
Searching...
No Matches
Enumerations | Functions
hdf5_interface.h File Reference

Header file for hdf5_interface.c. More...

#include <hdf5.h>
#include "ascot5.h"
#include "simulate.h"
#include "particle.h"

Go to the source code of this file.

Enumerations

enum  input_group {
  hdf5_input_options = 0x1 , hdf5_input_bfield = 0x2 , hdf5_input_efield = 0x4 , hdf5_input_plasma = 0x8 ,
  hdf5_input_neutral = 0x10 , hdf5_input_wall = 0x20 , hdf5_input_marker = 0x40 , hdf5_input_boozer = 0x80 ,
  hdf5_input_mhd = 0x100 , hdf5_input_asigma = 0x200 , hdf5_input_nbi = 0x400
}
 Enum to represent different input groups for HDF5 file reading. More...
 

Functions

int hdf5_interface_read_input (sim_offload_data *sim, int input_active, real **B_offload_array, real **E_offload_array, real **plasma_offload_array, real **neutral_offload_array, real **wall_offload_array, int **wall_int_offload_array, real **boozer_offload_array, real **mhd_offload_array, real **asigma_offload_array, real **nbi_offload_array, input_particle **p, int *n_markers)
 Read and initialize input data.
 
int hdf5_interface_init_results (sim_offload_data *sim, char *qid, char *run)
 Initialize run group.
 
int hdf5_interface_write_state (char *fn, char *state, integer n, particle_state *p)
 Write marker state to HDF5 output.
 
int hdf5_interface_write_diagnostics (sim_offload_data *sim, real *diag_offload_array, char *out)
 Write diagnostics to HDF5 output.
 
void hdf5_generate_qid (char *qid)
 Generate an identification number for a run.
 

Detailed Description

Header file for hdf5_interface.c.

Definition in file hdf5_interface.h.

Enumeration Type Documentation

◆ input_group

Enum to represent different input groups for HDF5 file reading.

This enum is used to specify which input groups should be read from the HDF5 file. Each group corresponds to a specific data type in the simulationa.

Enumerator
hdf5_input_options 

Input group for simulation options

hdf5_input_bfield 

Input group for magnetic field data

hdf5_input_efield 

Input group for electric field data

hdf5_input_plasma 

Input group for plasma data

hdf5_input_neutral 

Input group for neutral gas data

hdf5_input_wall 

Input group for wall data

hdf5_input_marker 

Input group for marker data

hdf5_input_boozer 

Input group for boozer coordinates data

hdf5_input_mhd 

Input group for MHD data

hdf5_input_asigma 

Input group for atomic data

hdf5_input_nbi 

Input group for injector data

Definition at line 20 of file hdf5_interface.h.

Function Documentation

◆ hdf5_interface_read_input()

int hdf5_interface_read_input ( sim_offload_data * sim,
int input_active,
real ** B_offload_array,
real ** E_offload_array,
real ** plasma_offload_array,
real ** neutral_offload_array,
real ** wall_offload_array,
int ** wall_int_offload_array,
real ** boozer_offload_array,
real ** mhd_offload_array,
real ** asigma_offload_array,
real ** nbi_offload_array,
input_particle ** p,
int * n_markers )

Read and initialize input data.

This function reads input from HDF5 file, initializes it, and allocates offload arrays and returns the pointers to them.

Parameters
simpointer to simulation offload struct
input_activebitflags for input types to read
B_offload_arraypointer to magnetic field offload array
E_offload_arraypointer to electric field offload array
plasma_offload_arraypointer to plasma data offload array
neutral_offload_arraypointer to neutral data offload array
wall_offload_arraypointer to wall offload array
wall_int_offload_arraypointer to wall integer offload array
boozer_offload_arraypointer to boozer offload array
mhd_offload_arraypointer to mhd offload array
asigma_offload_arraypointer to atomic offload array
nbi_offload_arraypointer to neutral beam injector data offload array
ppointer to marker offload data
n_markerspointer to integer notating how many markers were read
Returns
zero if reading and initialization succeeded

Definition at line 62 of file hdf5_interface.c.

◆ hdf5_interface_init_results()

int hdf5_interface_init_results ( sim_offload_data * sim,
char * qid,
char * run )

Initialize run group.

This functions creates results group (if one does not already exist) and creates run group corresponding to this run. Run group is named as /results/<run>_XXXXXXXXXX/ where X's are the qid of current run and <run> is the type of the run: "run" for ascot5_main and "bbnbi" for bbnbi5.

The group is initialized by writing qids of all used inputs as string attributes in the run group. Also the date and empty "details" fields are written.

Parameters
simpointer to simulation offload struct
qidqid of this run
runtype of this run
Returns
Zero if initialization succeeded

Definition at line 374 of file hdf5_interface.c.

◆ hdf5_interface_write_state()

int hdf5_interface_write_state ( char * fn,
char * state,
integer n,
particle_state * p )

Write marker state to HDF5 output.

Parameters
fnHDF5 output filename
statename of the state to be written
nnumber of markers in marker array
parray of markers to be written
Returns
Zero if state was written succesfully

Definition at line 517 of file hdf5_interface.c.

◆ hdf5_interface_write_diagnostics()

int hdf5_interface_write_diagnostics ( sim_offload_data * sim,
real * diag_offload_array,
char * out )

Write diagnostics to HDF5 output.

Parameters
simpointer to simulation offload data
diag_offload_arraydiagnostics offload array
outHDF5 output filename
Returns
Zero if diagnostics were written succesfully

Definition at line 577 of file hdf5_interface.c.

◆ hdf5_generate_qid()

void hdf5_generate_qid ( char * qid)

Generate an identification number for a run.

The identification number (QID) is a 32 bit unsigned integer represented in a string format, i.e., by ten characters. QID is a random integer between 0 and 4 294 967 295, and it is padded with leading zeroes in string representation.

Parameters
qida pointer to 11 chars wide array where generated QID is stored

Definition at line 730 of file hdf5_interface.c.