ASCOT5
|
Atomic reaction data interface. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "ascot5.h"
#include "print.h"
#include "error.h"
#include "asigma.h"
#include "asigma/asigma_loc.h"
#include "consts.h"
Go to the source code of this file.
Functions | |
void | asigma_extrapolate (int extrapolate) |
Toggle extrapolation when evaluating cross sections. | |
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. | |
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 *asigma_data) |
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 *asigma_data) |
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 *asigma_data) |
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 *asigma_data) |
Evaluate beam stopping rate coefficient. | |
Variables | |
static int | ASIGMA_EXTRAPOLATE = 0 |
Atomic reaction data interface.
This is an interface through which atomic reaction data is initialized and accessed. Reading, for example from local files, is done elsewhere.
The name asigma is short for atomicsigma. The word sigma refers to cross-section, a fundamental type of reaction probability data. Note that the data is not necessarily in the form of pure cross-sections. It might be in some derivative form, such as rate coefficients.
To add a new atomic reaction data instance, make sure the functions are implemented and called from this interface, and that asigma.h contains enum type for the new instance.
The interface checks which instance given data corresponds to from the "type"-field in asigma_offload_data or asigma_data that is given as an argument, and calls the relevant function for that instance.
Definition in file asigma.c.
void asigma_extrapolate | ( | int | extrapolate | ) |
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.
offload_data | pointer to offload data struct |
offload_array | pointer to pointer to offload array |
void asigma_free_offload | ( | asigma_offload_data * | offload_data, |
real ** | offload_array ) |
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.
asigma_data | pointer to data struct on target |
offload_data | pointer to offload data struct |
offload_array | pointer to offload array |
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.
sigma | pointer to evaluated cross-section |
z_1 | atomic number of fast particle |
a_1 | atomic mass number of fast particle |
z_2 | atomic number of bulk particle |
a_2 | atomic mass number of bulk particle |
E_coll_per_amu | energy per amu corresponding to collision speed |
reac_type | reaction type |
asigma_data | pointer to atomic data struct |
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.
sigmav | pointer to evaluated rate coefficient |
z_1 | atomic number of fast particle |
a_1 | atomic mass number of fast particle |
m_1 | mass of fast particle |
z_2 | atomic number of bulk particle |
a_2 | atomic mass number of bulk particle |
E | energy of fast particle |
T_e | electron temperature of bulk plasma |
T_0 | temperature of bulk neutrals |
n_i | ion density of bulk plasma |
reac_type | reaction type |
asigma_data | pointer to atomic data struct |
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.
ratecoeff | pointer to evaluated rate coefficient |
z_1 | atomic number of fast particle |
a_1 | atomic mass number of fast particle |
E | energy of fast particle |
mass | mass of fast particle |
nspec | number of bulk neutral species |
znum | atomic numbers of bulk particles |
anum | atomic mass numbers of bulk particles |
T_0 | temperature of bulk neutrals |
n_0 | densities of bulk neutrals |
asigma_data | pointer to atomic data struct |
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.
ratecoeff | pointer to evaluated rate coefficient |
z_1 | atomic number of fast particle |
a_1 | atomic mass number of fast particle |
E | energy of fast particle |
mass | mass of fast particle |
nion | number of bulk ion species |
znum | atomic numbers of bulk particles |
anum | atomic mass numbers of bulk particles |
T_e | electron temperature of bulk plasma |
n_i | densities of bulk ions |
asigma_data | pointer to atomic data struct |