forked from ComputationalRadiationPhysics/picongpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphysicalConstants.param
85 lines (73 loc) · 3.08 KB
/
physicalConstants.param
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
/**
* Copyright 2013 Axel Huebl, Heiko Burau, Rene Widera
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace picongpu
{
const float_64 PI = 3.141592653589793238462643383279502884197169399;
/** Threshold used for calculations that want to separate between
* high-precision formulas for relativistic and non-relativistic
* use-cases, e.g. energy-binning algorithms. */
const float_X GAMMA_THRESH = float_X(1.005);
namespace SI
{
/** unit: m / s */
const float_64 SPEED_OF_LIGHT_SI = 2.99792458e8;
/** unit: N / A^2 */
const float_64 MUE0_SI = PI * 4.e-7;
/** unit: C / (V m) */
const float_64 EPS0_SI = 1.0 / MUE0_SI / SPEED_OF_LIGHT_SI
/ SPEED_OF_LIGHT_SI;
// Electron properties
/** unit: kg */
const float_64 ELECTRON_MASS_SI = 9.109382e-31;
/** unit: C */
const float_64 ELECTRON_CHARGE_SI = -1.602176e-19;
// Ion / Proton / Positron properties
/** unit: kg */
const float_64 ION_MASS_SI = 1.6726217e-27;
const float_64 ION_MASS_C_SI = 1.660538921-27;
}
// converts
//
// UNIT_A to UNIT_B
//
// CONVENTION: WE DO NOT CONVERT FROM ANY STRANGE UNIT TO UNITLESS UNITS DIRECTLY!
// convert steps: INPUT -> float_64_convert to SI -> float_64_convert to unitless
// -> cast to float
// WE DO NOT define "UNIT_ENERGY_keV" or something similar! Never!
// Stay SI, stay free ;-)
//
// example:
// // some particle physicist beloved input:
// const float_64 An_Arbitrary_Energy_Input_keV = 30.0; // unit: keV
//
// // first convert to SI (because SI stays our standard Unit System!)
// const float_64 An_Arbitrary_Energy_Input_SI = An_Arbitrary_Energy_Input_keV * UNITCONV_keV_to_Joule // unit: Joule
//
// // now the "real" convert to our internal unitless system
// const float_X An_Arbitrary_Energy_Input = float_X(An_Arbitrary_Energy_Input_SI / UNIT_ENERGY) // unit: none
//
// As a convention, we DO NOT use the short track:
// const float_64 An_Arbitrary_Energy_Input_keV = 30.0; // unit: keV
// const float_X An_Arbitrary_Energy_Input = float_X(An_Arbitrary_Energy_Input_SI * UNITCONV_keV_to_Joule / UNIT_ENERGY) // unit: none
//
const float_64 UNITCONV_keV_to_Joule = 1.60217646e-16;
const float_64 UNITCONV_Joule_to_keV = (1.0 / UNITCONV_keV_to_Joule);
}