AMNS User Interface Routines. The AMNS user routines provide services from the AMNS system to user codes
- Author
- ITM-AMNS
Documentation for the package can be found on the AMNS webpages.
Two minimal examples of using the AMNS library are given below:
Fortran example
use itm_types
implicit none
real (kind=R8) :: te=100.0_r8, ne=1e20_r8, rate
allocate(species%components(4))
species%components = (/
amns_reactant_type(6, 1, 12, 0),
amns_reactant_type(1, 0, 2, 0),
amns_reactant_type(6, 0, 12, 1),
amns_reactant_type(1, 1, 2, 1) /)
xx_rx%string='CX'
write(*,*) 'Rate = ', rate
C example
#include "amns_interface.h"
int main(
int argc,
char *argv[])
{
void* amns_handle = NULL;
void* reactants_handle = NULL;
void* amns_cx_handle;
double rate;
printf(
"error = %s: %s\n", error_stat.
flag ?
"true" :
"false", error_stat.
string);
printf(
"error = %s: %s\n", error_stat.
flag ?
"true" :
"false", error_stat.
string);
printf(
"error = %s: %s\n", error_stat.
flag ?
"true" :
"false", error_stat.
string);
printf("Rate = %25.15e\n", rate);
printf(
"error = %s: %s\n", error_stat.
flag ?
"true" :
"false", error_stat.
string);
printf(
"error = %s: %s\n", error_stat.
flag ?
"true" :
"false", error_stat.
string);
return 0;
}
Extending the AMNS Interface
Note that current interface ITM_AMNS_RX supports data that can depend on 1, 2 or 3 arguments.
Extending this to more arguments would involve:
- adding additional optional arguments to ITM_AMNS_RX_0, ITM_AMNS_RX_1, ITM_AMNS_RX_2 and ITM_AMNS_RX_3
- modifying the call to interpol in these routines
- modifying interpol in data_suport if going beyond 4 arguments
- creating additional interpolation routines if going beyond quadrilinear interpolation
- providing the equivalent routines in amns_module_isoc.F90
- providing the equivalent interfaces in amns_interface.h equivalent to ITM_AMNS_C_RX_0_A
- providing the glue code equivalent in amns_interface.h equivalent to ITM_AMNS_CC_RX_0_A
- providing the equivalent routines and interfaces for Python (in cython/)
The arguments and output all have to match in size and rank, and can be scalars, 1d, 2d or 3d arrays.
Extending this to higher rank output and arguments involves:
- providing ITM_AMNS_RX_4, ITM_AMNS_RX_5 etc. in amns_module.F90
- providing the equivalent routines in amns_module_isoc.F90
- providing the equivalent interfaces in amns_interface.h equivalent to ITM_AMNS_C_RX_0_A
- providing the glue code equivalent in amns_interface.h equivalent to ITM_AMNS_CC_RX_0_A
- providing the equivalent routines and interfaces for Python (in cython/)