30 int* z1,
int* a1,
int* z2,
int* a2,
int* reactype,
37 data->
z_1 = (
int*) malloc( nreac *
sizeof(
int) );
38 data->
a_1 = (
int*) malloc( nreac *
sizeof(
int) );
39 data->
z_2 = (
int*) malloc( nreac *
sizeof(
int) );
40 data->
a_2 = (
int*) malloc( nreac *
sizeof(
int) );
41 data->
reac_type = (
int*) malloc( nreac *
sizeof(
int) );
45 for(
int i_reac = 0; i_reac < nreac; i_reac++) {
46 data->
z_1[i_reac] = z1[i_reac];
47 data->
a_1[i_reac] = a1[i_reac];
48 data->
z_2[i_reac] = z2[i_reac];
49 data->
a_2[i_reac] = a2[i_reac];
50 data->
reac_type[i_reac] = reactype[i_reac];
54 int dim = (ne[i_reac] > 1) + (nn[i_reac] > 1) + (nT[i_reac] > 1);
60 emin[i_reac], emax[i_reac]);
65 ne[i_reac], nT[i_reac],
67 emin[i_reac], emax[i_reac],
68 Tmin[i_reac], Tmax[i_reac]);
69 pos += ne[i_reac] * nT[i_reac];
73 ne[i_reac], nn[i_reac], nT[i_reac],
75 emin[i_reac], emax[i_reac],
76 nmin[i_reac], nmax[i_reac],
77 Tmin[i_reac], Tmax[i_reac]);
78 pos += ne[i_reac] * nn[i_reac] * nT[i_reac];
82 print_err(
"Error: Unrecognized abscissa dimensionality\n");
90 for(
int i_reac = 0; i_reac < data->
N_reac; i_reac++) {
92 "Reaction number / Total number of reactions = %d / %d\n"
93 " Reactant species Z_1 / A_1, Z_2 / A_2 = %d / %d, %d / %d\n"
94 " Min/Max energy = %1.2le / %1.2le\n"
95 " Min/Max density = %1.2le / %1.2le\n"
96 " Min/Max temperature = %1.2le / %1.2le\n"
97 " Number of energy grid points = %d\n"
98 " Number of density grid points = %d\n"
99 " Number of temperature grid points = %d\n",
100 i_reac+1, data->
N_reac, data->
z_1[i_reac], data->
a_1[i_reac],
101 data->
z_2[i_reac], data->
a_2[i_reac], emin[i_reac], emax[i_reac],
102 nmin[i_reac], nmax[i_reac], Tmin[i_reac], Tmax[i_reac],
103 ne[i_reac], nn[i_reac], nT[i_reac]);
115 for(
int i_reac = 0; i_reac < data->
N_reac; i_reac++) {
116 if(data->
reac_type[i_reac] == sigma_CX) {
117 free(data->
sigma[i_reac].
c);
119 else if(data->
reac_type[i_reac] == sigmav_CX) {
122 else if(data->
reac_type[i_reac] == sigmav_BMS) {
167 real* sigma,
int z_1,
int a_1,
int z_2,
int a_2,
real E_coll_per_amu,
173 int reac_found = -1, i_reac;
174 for(i_reac = 0; i_reac <
asigma_data->N_reac; i_reac++) {
192 if(
asigma_data->reac_type[i_reac] == sigma_ioniz ||
242 real* sigmav,
int z_1,
int a_1,
real m_1,
int z_2,
int a_2,
254 int reac_found = -1, i_reac;
255 for(i_reac = 0; i_reac <
asigma_data->N_reac; i_reac++) {
256 if(reac_type == sigmav_BMS &&
276 if(reac_type == sigmav_ioniz ||
277 reac_type == sigmav_recomb ||
278 reac_type == sigmav_CX) {
289 }
else if(reac_type == sigmav_BMS) {
335 real* ratecoeff,
int z_1,
int a_1,
real E,
real mass,
int nspec,
336 const int* znum,
const int* anum,
real T_0,
real* n_0,
int extrapolate,
344 for(
int i_spec = 0; i_spec < nspec; i_spec++) {
347 int reac_found = -1, i_reac;
348 for(i_reac = 0; i_reac <
asigma_data->N_reac; i_reac++) {
376 *ratecoeff += sigmav*n_0[i_spec];
407 real* ratecoeff,
int z_1,
int a_1,
real E,
real mass,
int nion,
408 const int* znum,
const int* anum,
real T_e,
real* n_i,
int extrapolate,
418 int reac_found = -1;
real n_e = 0; *ratecoeff = 0;
419 for(
int i_spec = 0; i_spec < nion; i_spec++) {
420 n_e += znum[i_spec] * n_i[i_spec];
421 for(
int i_reac = 0; i_reac <
asigma_data->N_reac; i_reac++) {
430 E_eV/a_1, znum[i_spec] * n_i[i_spec], T_e);
441 *ratecoeff += sigmav * ( znum[i_spec] * n_i[i_spec]);
452 if(
suzuki_sigmav(ratecoeff, E/a_1, vnorm, n_e, T_e, nion, n_i, anum,
Main header file for ASCOT5.
Header file for asigma.c.
int asigma_loc_init(asigma_loc_data *data, int nreac, int *z1, int *a1, int *z2, int *a2, int *reactype, int *ne, real *emin, real *emax, int *nn, real *nmin, real *nmax, int *nT, real *Tmin, real *Tmax, real *sigma)
Initialize local file atomic data and check inputs.
void asigma_loc_free(asigma_loc_data *data)
Free allocated resources.
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_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.
void asigma_loc_offload(asigma_loc_data *data)
Offload data to the accelerator.
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_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.
Header file for asigma_loc.c.
Header file containing physical and mathematical constants.
#define CONST_E
Elementary charge [C]
unsigned long int a5err
Simulation error flag.
static DECLARE_TARGET_SIMD a5err error_raise(error_type type, int line, error_file file)
Raise a new error.
Spline interpolation library.
DECLARE_TARGET_END a5err interp3Dcomp_eval_f(real *f, interp3D_data *str, real x, real y, real z)
Evaluate interpolated value of 3D scalar field.
int interp3Dcomp_setup(interp3D_data *str, real *f, int n_x, int n_y, int n_z, int bc_x, int bc_y, int bc_z, real x_min, real x_max, real y_min, real y_max, real z_min, real z_max)
Set up splines to interpolate 3D scalar data.
int interp2Dcomp_setup(interp2D_data *str, real *f, int n_x, int n_y, int bc_x, int bc_y, real x_min, real x_max, real y_min, real y_max)
Set up splines to interpolate 2D scalar data.
a5err interp1Dcomp_eval_f(real *f, interp1D_data *str, real x)
Evaluate interpolated value of 1D scalar field.
int interp1Dcomp_setup(interp1D_data *str, real *f, int n_x, int bc_x, real x_min, real x_max)
Set up splines to interpolate 1D scalar data.
DECLARE_TARGET_END a5err interp2Dcomp_eval_f(real *f, interp2D_data *str, real x, real y)
Evaluate interpolated value of a 2D field.
Methods to evaluate elementary physical quantities.
#define physlib_vnorm_gamma(gamma)
Evaluate velocity norm from Lorentz factor.
#define physlib_gamma_Ekin(m, ekin)
Evaluate Lorentz factor from kinetic energy [J].
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
#define print_err(...)
Print to standard error.
Atomic reaction simulation data.
Local-files atomic reaction simulation data.
interp3D_data * BMSsigmav
Cubic interpolation struct.
Bicubic interpolation struct.
Tricubic interpolation struct.
a5err suzuki_sigmav(real *sigmav, real EperAmu, real vnorm, real ne, real te, integer nion, real *ni, const int *anum, const int *znum)
Calculate beam-stopping cross-section according to Suzuki model.
Header file for suzuki.c.