ASCOT5
Loading...
Searching...
No Matches
Functions
asigma_loc.c File Reference

Atomic reaction data from local files. More...

#include <stdio.h>
#include <stdlib.h>
#include "../ascot5.h"
#include "../print.h"
#include "../error.h"
#include "../spline/interp.h"
#include "../consts.h"
#include "../math.h"
#include "../physlib.h"
#include "../suzuki.h"
#include "../asigma.h"
#include "asigma_loc.h"

Go to the source code of this file.

Functions

int asigma_loc_init_offload (asigma_loc_offload_data *offload_data, real **offload_array)
 Initialize local file atomic data and check inputs.
 
void asigma_loc_free_offload (asigma_loc_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
void asigma_loc_init (asigma_loc_data *asigma_data, asigma_loc_offload_data *offload_data, real *offload_array)
 Initialize atomic reaction data struct on target.
 
a5err asigma_loc_eval_sigma (real *sigma, int z_1, int a_1, int z_2, int a_2, real E_coll_per_amu, int reac_type, int extrapolate, asigma_loc_data *asigma_data)
 Evaluate atomic reaction cross-section.
 
a5err asigma_loc_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, int reac_type, int extrapolate, asigma_loc_data *asigma_data)
 Evaluate atomic reaction rate coefficient.
 
a5err asigma_loc_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, int extrapolate, asigma_loc_data *asigma_data)
 Evaluate atomic reaction rate coefficient.
 
a5err asigma_loc_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, int extrapolate, asigma_loc_data *asigma_data)
 Evaluate beam stopping rate coefficient.
 

Detailed Description

Atomic reaction data from local files.

Atomic reaction data (sigmas) originating from local files and interpolated using splines. If the data for a reaction is missing, a corresponding analytical model implemented in ASCOT5 might be used.

Definition in file asigma_loc.c.

Function Documentation

◆ asigma_loc_init_offload()

int asigma_loc_init_offload ( asigma_loc_offload_data * offload_data,
real ** offload_array )

Initialize local file atomic data and check inputs.

Before calling this function, the offload struct is expected to be fully initialized.

The offload array is expected to hold atomic data as

[0*N_reac] = min value of energy abscissa [eV] [1*N_reac] = max value of energy abscissa [eV] [2*N_reac] = min value of density abscissa [m^-3] [3*N_reac] = max value of density abscissa [m^-3] [4*N_reac] = min value of temperature abscissa [eV] [5*N_reac] = max value of temperature abscissa [eV] [6*N_reac] = reaction probability data [(depends on reaction data type)]

Each piece of data listed above is repeated for each reaction included. Hence the N_reac interval between the 6 first pieces of data. The memory space required for the last, reaction probability data, depends on the dimensionality of the abscissae. The memory requirement for the reaction data of the i_reac:th reaction is N_E[i_reac]*N_n[i_reac]*N_T[i_reac].

This function initializes splines to atomic reaction data, thus increasing the length of the offload array, and prints some values as sanity checks.

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

Definition at line 52 of file asigma_loc.c.

◆ asigma_loc_free_offload()

void asigma_loc_free_offload ( asigma_loc_offload_data * offload_data,
real ** offload_array )

Free offload array and reset parameters.

This function deallocates the offload_array.

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

Definition at line 197 of file asigma_loc.c.

◆ asigma_loc_init()

void asigma_loc_init ( asigma_loc_data * asigma_data,
asigma_loc_offload_data * offload_data,
real * offload_array )

Initialize atomic reaction data struct on target.

This function copies atomic reaction data from the offload struct and the offload array to the struct on the target, and uses interp?Dcomp_init_spline() functions to initialize the precalculated spline parameters of the reaction data in the spline structs within the data struct on the target.

Parameters
asigma_datapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array

Definition at line 216 of file asigma_loc.c.

◆ asigma_loc_eval_sigma()

a5err asigma_loc_eval_sigma ( real * sigma,
int z_1,
int a_1,
int z_2,
int a_2,
real E_coll_per_amu,
int reac_type,
int extrapolate,
asigma_loc_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
extrapolatedon't raise error but set values outside abscissae to zero
asigma_datapointer to atomic data struct
Returns
zero if evaluation succeeded

Definition at line 309 of file asigma_loc.c.

◆ asigma_loc_eval_sigmav()

a5err asigma_loc_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,
int reac_type,
int extrapolate,
asigma_loc_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
extrapolatedon't raise error but set values outside abscissae to zero
asigma_datapointer to atomic data struct
Returns
zero if evaluation succeeded

Definition at line 384 of file asigma_loc.c.

◆ asigma_loc_eval_cx()

a5err asigma_loc_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,
int extrapolate,
asigma_loc_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
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
znumatomic numbers of bulk neutrals
anumatomic mass numbers of bulk neutrals
T_0temperature of bulk neutrals
n_0neutral densities
extrapolatedon't raise error but set values outside abscissae to zero
asigma_datapointer to atomic data struct
Returns
zero if evaluation succeeded

Definition at line 477 of file asigma_loc.c.

◆ asigma_loc_eval_bms()

a5err asigma_loc_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,
int extrapolate,
asigma_loc_data * asigma_data )

Evaluate beam stopping rate coefficient.

This function first tries to evaluate BMS with ADAS data. If not present, the Suzuki model is used instead.

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
extrapolatedon't raise error but set values outside abscissae to zero
asigma_datapointer to atomic data struct
Returns
zero if evaluation succeeded

Definition at line 549 of file asigma_loc.c.