ASCOT5
Loading...
Searching...
No Matches
asigma.c
Go to the documentation of this file.
1
21#include <stdlib.h>
22#include <stdio.h>
23#include <math.h>
24#include "ascot5.h"
25#include "print.h"
26#include "error.h"
27#include "math.h"
28#include "asigma.h"
29#include "asigma/asigma_loc.h"
30#include "consts.h"
31
32#pragma omp declare target
34static int ASIGMA_EXTRAPOLATE = 0;
35#pragma omp end declare target
36
45void asigma_extrapolate(int extrapolate) {
46 ASIGMA_EXTRAPOLATE = extrapolate;
47}
48
55 switch(data->type) {
56 case asigma_type_loc:
58 break;
59 }
60}
61
68 switch(data->type) {
69 case asigma_type_loc:
71 break;
72 }
73}
74
96 real* sigma, int z_1, int a_1, int z_2, int a_2, real E_coll_per_amu,
98 a5err err = 0;
99
100 switch(asigma_data->type) {
101 case asigma_type_loc:
103 sigma, z_1, a_1, z_2, a_2, E_coll_per_amu, reac_type,
105 break;
106
107 default:
108 /* Unrecognized input. Produce error. */
109 err = error_raise( ERR_UNKNOWN_INPUT, __LINE__, EF_ASIGMA );
110 break;
111 }
112 if(err || sigma[0] < 0.0) {
113 /* In case of error or unphysical negative value, return zero value
114 to avoid further complications */
115 sigma[0] = 0.0;
116 }
117
118 return err;
119}
120
146 real* sigmav, int z_1, int a_1, real m_1, int z_2, int a_2,
147 real E, real T_e, real T_0, real n_i, asigma_reac_type reac_type,
149 a5err err = 0;
150
151 switch(asigma_data->type) {
152 case asigma_type_loc:
154 sigmav, z_1, a_1, m_1, z_2, a_2, E, T_e, T_0, n_i,
156 break;
157
158 default:
159 /* Unrecognized input. Produce error. */
160 err = error_raise( ERR_UNKNOWN_INPUT, __LINE__, EF_ASIGMA );
161 break;
162 }
163 if(err || sigmav[0] < 0.0) {
164 /* In case of error or unphysical negative value, return zero value
165 to avoid further complications */
166 sigmav[0] = 0.0;
167 }
168
169 return err;
170}
171
192 real* ratecoeff, int z_1, int a_1, real E, real mass, int nspec,
193 const int* znum, const int* anum, real T_0, real* n_0,
195 a5err err = 0;
196
197 switch(asigma_data->type) {
198 case asigma_type_loc:
199 err = asigma_loc_eval_cx(
200 ratecoeff, z_1, a_1, E, mass, nspec, znum, anum, T_0, n_0,
202 break;
203
204 default:
205 /* Unrecognized input. Produce error. */
206 err = error_raise( ERR_UNKNOWN_INPUT, __LINE__, EF_ASIGMA );
207 break;
208 }
209 if(err || ratecoeff[0] < 0.0) {
210 /* In case of error or unphysical negative value, return zero value
211 to avoid further complications */
212 ratecoeff[0] = 0.0;
213 }
214
215 return err;
216}
217
238 real* ratecoeff, int z_1, int a_1, real E, real mass, int nion,
239 const int* znum, const int* anum, real T_e, real* n_i,
241 a5err err = 0;
242
243 switch(asigma_data->type) {
244 case asigma_type_loc:
246 ratecoeff, z_1, a_1, E, mass, nion, znum, anum, T_e, n_i,
248 break;
249
250 default:
251 /* Unrecognized input. Produce error. */
252 err = error_raise( ERR_UNKNOWN_INPUT, __LINE__, EF_ASIGMA );
253 break;
254 }
255 if(err || ratecoeff[0] < 0.0) {
256 /* In case of error or unphysical negative value, return zero value
257 to avoid further complications */
258 ratecoeff[0] = 0.0;
259 }
260
261 return err;
262}
Main header file for ASCOT5.
double real
Definition ascot5.h:85
static int ASIGMA_EXTRAPOLATE
Definition asigma.c:34
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.
Definition asigma.c:95
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.
Definition asigma.c:191
void asigma_extrapolate(int extrapolate)
Toggle extrapolation when evaluating cross sections.
Definition asigma.c:45
void asigma_free(asigma_data *data)
Free allocated resources.
Definition asigma.c:54
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.
Definition asigma.c:145
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.
Definition asigma.c:237
void asigma_offload(asigma_data *data)
Offload data to the accelerator.
Definition asigma.c:67
Header file for asigma.c.
asigma_reac_type
Reaction types for atomic reaction data.
Definition asigma.h:34
@ asigma_type_loc
Definition asigma.h:24
void asigma_loc_free(asigma_loc_data *data)
Free allocated resources.
Definition asigma_loc.c:114
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.
Definition asigma_loc.c:334
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.
Definition asigma_loc.c:166
void asigma_loc_offload(asigma_loc_data *data)
Offload data to the accelerator.
Definition asigma_loc.c:141
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.
Definition asigma_loc.c:241
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.
Definition asigma_loc.c:406
Header file for asigma_loc.c.
Header file containing physical and mathematical constants.
Error module for ASCOT5.
unsigned long int a5err
Simulation error flag.
Definition error.h:17
@ EF_ASIGMA
Definition error.h:51
@ ERR_UNKNOWN_INPUT
Definition error.h:64
static DECLARE_TARGET_SIMD a5err error_raise(error_type type, int line, error_file file)
Raise a new error.
Definition error.h:86
Header file for math.c.
Macros for printing console output.
Atomic reaction simulation data.
Definition asigma.h:53
asigma_type type
Definition asigma.h:54
asigma_loc_data asigma_loc
Definition asigma.h:55