ASCOT5
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
asigma.h File Reference

Header file for asigma.c. More...

#include "ascot5.h"
#include "error.h"
#include "asigma/asigma_loc.h"

Go to the source code of this file.

Data Structures

struct  asigma_offload_data
 Atomic reaction offload data. More...
 
struct  asigma_data
 Atomic reaction simulation data. More...
 

Typedefs

typedef enum asigma_type asigma_type
 Atomic reaction data types.
 
typedef enum asigma_reac_type asigma_reac_type
 Reaction types for atomic reaction data.
 

Enumerations

enum  asigma_type { asigma_type_loc }
 Atomic reaction data types. More...
 
enum  asigma_reac_type {
  sigma_ioniz = 1 , sigma_recomb = 2 , sigma_CX = 3 , sigmav_ioniz = 4 ,
  sigmav_recomb = 5 , sigmav_CX = 6 , sigmav_BMS = 7 , sigmaveff_ioniz = 8 ,
  sigmaveff_recomb = 9 , sigmaveff_CX = 10
}
 Reaction types for atomic reaction data. More...
 

Functions

int asigma_init_offload (asigma_offload_data *offload_data, real **offload_array)
 Load atomic reaction data and prepare parameters.
 
void asigma_free_offload (asigma_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
void asigma_extrapolate (int extrapolate)
 Toggle extrapolation when evaluating cross sections.
 
int asigma_init (asigma_data *asigma_data, asigma_offload_data *offload_data, real *offload_array)
 Initializes atomic reaction data struct on target.
 
a5err asigma_eval_sigma (real *sigma, int z_1, int a_1, int z_2, int a_2, real E_coll_per_amu, asigma_reac_type reac_type, asigma_data *asigmadata)
 Evaluate atomic reaction cross-section.
 
a5err asigma_eval_sigmav (real *sigmav, int z_1, int a_1, real m_1, int z_2, int a_2, real E, real T_e, real T_0, real n_i, asigma_reac_type reac_type, asigma_data *asigmadata)
 Evaluate atomic reaction rate coefficient.
 
a5err asigma_eval_cx (real *ratecoeff, int z_1, int a_1, real E, real mass, int nspec, const int *znum, const int *anum, real T_0, real *n_0, asigma_data *asigmadata)
 Evaluate charge exchange rate coefficient.
 
a5err asigma_eval_bms (real *ratecoeff, int z_1, int a_1, real E, real mass, int nion, const int *znum, const int *anum, real T_e, real *n_i, asigma_data *asigmadata)
 Evaluate beam stopping rate coefficient.
 

Detailed Description

Header file for asigma.c.

Contains a list declaring all atomic reaction data types, and declaration of asigma_offload_data and asigma_data structs.

Definition in file asigma.h.

Typedef Documentation

◆ asigma_type

typedef enum asigma_type asigma_type

Atomic reaction data types.

Atomic reaction data types are used in the atomic reaction data interface (asigma.c) to direct function calls to correct atomic reaction data instances. Each atomic reaction data instance must have a corresponding type.

◆ asigma_reac_type

Reaction types for atomic reaction data.

The reaction type of atomic reactions is one of the reaction indentifier parameters. It specifies the nature of the reaction and the form of the reaction probability data.

Enumeration Type Documentation

◆ asigma_type

Atomic reaction data types.

Atomic reaction data types are used in the atomic reaction data interface (asigma.c) to direct function calls to correct atomic reaction data instances. Each atomic reaction data instance must have a corresponding type.

Enumerator
asigma_type_loc 

Atomic reaction data from local files

Definition at line 23 of file asigma.h.

◆ asigma_reac_type

Reaction types for atomic reaction data.

The reaction type of atomic reactions is one of the reaction indentifier parameters. It specifies the nature of the reaction and the form of the reaction probability data.

Definition at line 34 of file asigma.h.

Function Documentation

◆ asigma_init_offload()

int asigma_init_offload ( asigma_offload_data * offload_data,
real ** offload_array )

Load atomic reaction data and prepare parameters.

This function fills the relevant atomic sigma offload struct with parameters and allocates and fills the offload array. Sets offload array length in the offload struct.

The offload data has to have a type when this function is called as it should be set when the offload data is constructed from inputs.

This function is host only.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array
Returns
zero if initialization succeeded

Definition at line 66 of file asigma.c.

◆ asigma_free_offload()

void asigma_free_offload ( asigma_offload_data * offload_data,
real ** offload_array )

Free offload array and reset parameters.

This function deallocates the offload_array.

This function is host only.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array

Definition at line 104 of file asigma.c.

◆ asigma_extrapolate()

void asigma_extrapolate ( int extrapolate)

Toggle extrapolation when evaluating cross sections.

In this context the extrapolation means values outside the abscissae are set to zero instead of raising an error.

Parameters
extrapolateflag whether to extrapolate

Definition at line 45 of file asigma.c.

◆ asigma_init()

int asigma_init ( asigma_data * asigma_data,
asigma_offload_data * offload_data,
real * offload_array )

Initializes atomic reaction data struct on target.

This function copies some atomic reaction parameters from the offload struct to the struct on target and sets the atomic reaction data pointers to correct offsets in the offload array.

Parameters
asigma_datapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array
Returns
zero if initialization succeeded

Definition at line 126 of file asigma.c.

◆ asigma_eval_sigma()

a5err asigma_eval_sigma ( real * sigma,
int z_1,
int a_1,
int z_2,
int a_2,
real E_coll_per_amu,
asigma_reac_type reac_type,
asigma_data * asigma_data )

Evaluate atomic reaction cross-section.

This function evaluates the cross-section (sigma) for the atomic reaction corresponding to the reaction identifiers given as parameters at the given mass-normalized collision energy.

This is a SIMD function.

Parameters
sigmapointer to evaluated cross-section
z_1atomic number of fast particle
a_1atomic mass number of fast particle
z_2atomic number of bulk particle
a_2atomic mass number of bulk particle
E_coll_per_amuenergy per amu corresponding to collision speed
reac_typereaction type
asigma_datapointer to atomic data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 166 of file asigma.c.

◆ asigma_eval_sigmav()

a5err asigma_eval_sigmav ( real * sigmav,
int z_1,
int a_1,
real m_1,
int z_2,
int a_2,
real E,
real T_e,
real T_0,
real n_i,
asigma_reac_type reac_type,
asigma_data * asigma_data )

Evaluate atomic reaction rate coefficient.

This function evaluates the rate coefficient (<sigma*v>) for the atomic reaction corresponding to the reaction identifiers given as parameters at the given fast particle energy and bulk plasma conditions.

This is a SIMD function.

Parameters
sigmavpointer to evaluated rate coefficient
z_1atomic number of fast particle
a_1atomic mass number of fast particle
m_1mass of fast particle
z_2atomic number of bulk particle
a_2atomic mass number of bulk particle
Eenergy of fast particle
T_eelectron temperature of bulk plasma
T_0temperature of bulk neutrals
n_iion density of bulk plasma
reac_typereaction type
asigma_datapointer to atomic data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 216 of file asigma.c.

◆ asigma_eval_cx()

a5err asigma_eval_cx ( real * ratecoeff,
int z_1,
int a_1,
real E,
real mass,
int nspec,
const int * znum,
const int * anum,
real T_0,
real * n_0,
asigma_data * asigma_data )

Evaluate charge exchange rate coefficient.

This is a SIMD function.

Parameters
ratecoeffpointer to evaluated rate coefficient
z_1atomic number of fast particle
a_1atomic mass number of fast particle
Eenergy of fast particle
massmass of fast particle
nspecnumber of bulk neutral species
znumatomic numbers of bulk particles
anumatomic mass numbers of bulk particles
T_0temperature of bulk neutrals
n_0densities of bulk neutrals
asigma_datapointer to atomic data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 262 of file asigma.c.

◆ asigma_eval_bms()

a5err asigma_eval_bms ( real * ratecoeff,
int z_1,
int a_1,
real E,
real mass,
int nion,
const int * znum,
const int * anum,
real T_e,
real * n_i,
asigma_data * asigma_data )

Evaluate beam stopping rate coefficient.

This is a SIMD function.

Parameters
ratecoeffpointer to evaluated rate coefficient
z_1atomic number of fast particle
a_1atomic mass number of fast particle
Eenergy of fast particle
massmass of fast particle
nionnumber of bulk ion species
znumatomic numbers of bulk particles
anumatomic mass numbers of bulk particles
T_eelectron temperature of bulk plasma
n_idensities of bulk ions
asigma_datapointer to atomic data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 308 of file asigma.c.