-
Notifications
You must be signed in to change notification settings - Fork 0
/
coulomb_utils.h
129 lines (110 loc) · 2.99 KB
/
coulomb_utils.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
119
120
121
122
123
124
125
126
127
128
129
#ifndef COULOMB_UTILS_H
#define COULOMB_UTILS_H
typedef double real; /**< Double precision float */
#include <math.h>
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <stdio.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef INTELLISENSE
#include <eigen3/Eigen/Dense> // global installation
#else
#include "Eigen/Dense" // local installation in same folder. FIX this
// Aalto workstation has Eigen as module but it's slightly outdated and has compile warnings
// CSC has no Eigen module at all
// #include <eigen3/Eigen/Dense> // global installation
#endif
using namespace std;
using namespace Eigen;
#define CONST_PI 3.1415926535897932384626
#define CONST_2PI 6.2831853071795862319959
#define PI2E0_5 2.50662827463
#define CONST_KB 1.3807e-23
#define CONST_E 1.602176565e-19
#define CONST_ME 9.1093837E-31
#define CONST_MD 3.3435837724E-27 // deuteron mass
/** @brief Electric constant [m^-3*kg^-1*s^4*A^2] */
#define CONST_E0 8.8542e-12
enum {
VERBOSE_SILLY = 3,
VERBOSE_DEBUG = 2,
VERBOSE_NORMAL = 1,
VERBOSE_MINIMAL = 0,
VERBOSE_IO = 1
};
/**
* @brief Print to standard output
*/
#define print_out(v,...) { if(VERBOSE_LEVEL >= (v)) printf(__VA_ARGS__); }
namespace Coulomb {
typedef struct {
double weight;
Vector2d z;
} Particle2d;
typedef struct {
int npeaks;
Vector2d* peaks;
double Tx;
double Ty;
double m;
double* nu;
double q;
double n;
double xmin;
double xmax;
double ymin;
double ymax;
char name[20];
double eps;
} Specie;
typedef enum {
MESH,
UNIFORM,
MESH_SHIFT,
MESH_PEAK_CENTERED
} DistributionType;
typedef struct {
int nx;
int ny;
int nmarkers;
DistributionType distributionType;
double dt;
double dx;
double t1;
double newtonTolerance;
int useNewton;
int maxEOMIterations;
double* kHermite;
double* wHermite;
int nHermite;
int cudaThreadsPerBlock;
// print to file parameters
int recordAtStep; // print state every n-th step
int recordMeshAtStep; // print mesh every n-th step
int highResolutionMesh; // flag, use the highest resolution for building the output plot mesh
int writeMarkersPositions; // write markers position in addition to histogram
// normalization constants
int normalize; // normalize flag. Recommended to be set
double n0;
double v0;
double t0;
double T0;
double nu0;
double m0;
// benchmark times
double time_dsdv;
double time_eqmotion;
double time_total;
int nspecies;
Specie* species;
// internal variables
int* _nmarkers_outputmesh;
int backupStates;
int restoreStates;
} Config;
}
#endif