forked from ascot4fusion/ascot5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathascot5.h
118 lines (102 loc) · 3.79 KB
/
ascot5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* @mainpage ASCOT5
*
* @section intro Introduction
*
* ASCOT5 is a test-particle Monte Carlo orbit-following code for solving the
* Fokker-Planck equation in toroidal plasmas.
*
* @section compilation Compilation
*
* Currently only Intel's compiler version
* 14.0 and up support all the OpenMP features used, but gcc can be used to
* compile some test programs and the full code with limited features.
*
* Before compilation the necessary compiler modules need to be loaded.
* The command on CSC Bull and Helios is "module load intel/<version>".
* Available versions can be checked with "module avail".
*
* Due to the use of compiler flags to define code functionality, the code
* should always be fully recompiled by calling <pre>make clean</pre> first if the
* parameters are changed.
*
* Syntax for compilation:
*
* make clean && make \<program_name\> \<parameters\>
*
* Available parameters:
*
* - NSIMD=n number of particles in a group (default 16); these are
* processed simultaneously by each thread
* - CC=... compiler (default icc)
* - TARGET=1 Offload computation to Xeon Phi accelerator
* - VERBOSE=n print increasing amounts of progress information:
* 0: No information except bare essentials
* 1: Standard information; everything happening outside
* simulation loops is printed
* 2: Extensive information; a record of simulation progress
* is written process-specific *.stdout files
* - MPI=1 enable MPI
* - NOGIT=1 disable recording of repository status which is printed in
* runtime (disable if Git is not available)
*
* Available programs:
*
* - ascot5_main : The stand-alone ASCOT5 main program
*
* Example:
*
* make clean && make ascot5_main CC=icc NSIMD=16
*/
/**
* @file ascot5.h
* @brief Main header file for ASCOT5
*
* This header file defines general types and structs used widely by the program
* as well as any features dependent on compiler defined macros.
*/
#ifndef ASCOT5_H
#define ASCOT5_H
#define stringify(...) #__VA_ARGS__
#define str_macro(c) stringify(c)
#include <omp.h>
#include <time.h>
/** This is used to tell the compiler that we want a variable aligned to
* 64 bits for Xeon Phi; may not be always necessary */
#define __memalign__ __attribute__((aligned(64)))
/** We use a custom type real to represent floating point numbers; precision
* can be defined compile-time. */
#if defined SINGLEPRECISION
typedef int integer; /**< Single precision integer */
typedef float real; /**< Singe precision float */
#else
typedef long integer; /**< Double precision integer */
typedef double real; /**< Double precision float */
#endif
/** @brief Number of particles simulated simultaneously in a particle group
* operations */
#ifndef NSIMD
#define NSIMD 16
#endif
/** @brief Maximum number of plasma species */
#define MAX_SPECIES 8
/** @brief Maximum number of MHD modes */
#define MHD_MODES_MAX_NUM 512
/** @brief Maximum number of Wiener processes stored (effectively number
* of time step reductions) */
#define WIENERSLOTS 20
/** @brief Determine whether to use geometric method of Box-Muller to
* to generate normal random numbers */
#define A5_CCOL_USE_GEOBM 1
/** @brief If adaptive time step falls below this value, produce an error */
#define A5_EXTREMELY_SMALL_TIMESTEP 1e-12
/** @brief How often progress is being written (s) in the stdout file */
#define A5_PRINTPROGRESSINTERVAL 20
/** @brief Wall time */
#define A5_WTIME omp_get_wtime()
/** @brief Choose whether magnetic field spline interpolation is done
* with an explicit (1) or compact (0) way */
#define INTERP_SPL_EXPL 0
/** @brief Choose whether to use tabulated values for collision coefficients */
#define A5_CCOL_USE_TABULATED 0
#endif