ASCOT5
Loading...
Searching...
No Matches
physlib.h
Go to the documentation of this file.
1
5#ifndef PHYSLIB_H
6#define PHYSLIB_H
7
8#include <math.h>
9#include "math.h"
10#include "consts.h"
11
21#define physlib_gamma_vnorm(v) ( \
22 sqrt( 1.0 / ( (1.0 - v / CONST_C) * (1.0 + v / CONST_C) ) ) )
23
33#define physlib_vnorm_gamma(gamma) ( \
34 sqrt( 1.0 - 1.0 / ( gamma * gamma ) ) * CONST_C )
35
46#define physlib_gamma_pnorm(m, p) ( \
47 sqrt(1.0 + ( p * p ) / ( m * m * CONST_C2 ) ) )
48
61#define physlib_gamma_vpar(m, mu, vpar, B) ( \
62 sqrt( ( 1.0 + (2.0 * mu * B) / ( m * CONST_C2 ) ) / \
63 ( (1.0 - vpar / CONST_C) * (1.0 + vpar / CONST_C) ) ) )
64
77#define physlib_gamma_ppar(m, mu, ppar, B) ( \
78 sqrt( 1.0 + 2 * mu * B / ( m * CONST_C2 ) + \
79 ppar * ppar / ( m * m * CONST_C2 ) ) )
80
91#define physlib_Ekin_gamma(m, gamma) ( ( gamma - 1.0 ) * m * CONST_C2 )
92
103#define physlib_gamma_Ekin(m, ekin) ( ekin / ( m * CONST_C2 ) + 1.0 )
104
115#define physlib_Ekin_pnorm(m, p) ( \
116 ( physlib_gamma_pnorm(m, p) - 1.0 ) * m * CONST_C2 )
117
128#define physlib_Ekin_ppar(m, mu, ppar, B) ( \
129 ( physlib_gamma_ppar(m, mu, ppar, B) - 1.0 ) * m * CONST_C2 )
130
141#define physlib_vnorm_pnorm(m, p) ( \
142 p / sqrt(m * m + ( p * p ) / CONST_C2 ) )
143
154#define physlib_pnorm_vnorm(m, v) ( m * v * physlib_gamma_vnorm(v) )
155
166#define physlib_gc_ppar(p, xi) ( p * xi )
167
180#define physlib_gc_mu(m, p, xi, B) ( \
181 p * p * ( 1.0 - xi * xi ) / ( 2 * B * m ) )
182
195#define physlib_gc_p(m, mu, ppar, B) ( \
196 m * CONST_C * sqrt( pow( physlib_gamma_ppar(m, mu, ppar, B), 2) - 1 ) )
197
210#define physlib_gc_xi(m, mu, ppar, B) ( \
211 ppar / physlib_gc_p(m, mu, ppar, B) )
212
224#define physlib_gyrolength_p(q, p, B) ( \
225 math_dot(p, B) / ( fabs(q) * math_dot(B, B) ) )
226
241#define phys_gyrolength_ppar(m, q, mu, ppar, B) ( \
242 sqrt( 2 * m * mu * \
243 physlib_gamma_ppar(m, mu, ppar, B) / B ) / fabs(q) )
244
257#define phys_gyrofreq_pnorm(m, q, p, B) ( \
258 fabs(q) * B / ( m * physlib_gamma_pnorm(m, p) ) )
259
273#define phys_gyrofreq_ppar(m, q, mu, ppar, B) ( \
274 fabs(q) * B / ( m * physlib_gamma_ppar(m, mu, ppar, B) ) )
275
280#define phys_ptoroid_fo(q, R, pphi, psi) ( \
281 R * pphi + q * psi )
282
287#define phys_ptoroid_gc(q, R, ppar, psi, B, Bphi) ( \
288 ppar * R * (Bphi / B) + q * psi )
289
290#endif
Header file containing physical and mathematical constants.
Header file for math.c.