root/trunk/units/constants.d

Revision 515, 2.3 kB (checked in by BCS, 5 years ago)

added some values, units, types and operators/function

Line 
1 /**
2  * Constant values with units
3  */
4 module constants;
5
6 import si;
7 import unit;
8 import types;
9
10 /// math constants
11 struct Math
12 {
13     /// Euler's constant
14     static const Types.Value gamma = { value : 0.577215664901532 };
15     /// good old pi
16     static const Types.Value pi    = { value : 3.14159265359};
17     /// natural log base
18     static const Types.Value e     = { value : 2.718281828459 };
19     /// golden ratio
20     static const Types.Value phi   = { value : 1.6180339887498948482045868 };
21 }
22
23 /// atomic physics constants
24 struct Atomic
25 {
26     /// unified atomic mass
27     static const Types.Mass   u  = { value : 1.66053873e-27 };
28     /// electron mass
29     static const Types.Mass   me = { value : 9.109373815276e-31 };
30     /// electron charge
31     static const Types.Charge e  = { value : 1.602176462e-16 };
32     /// Proton mass
33     static const Types.Mass   mp = { value : 1.67262158e-27 };
34     /// Neutron mass
35     static const Types.Mass   mn = { value : 1.67492716e-27 };
36    
37 }
38
39 /// bulk physics constants
40 struct Physical
41 {
42     /// standard gravity
43     static const Types.Acceleration g    = { value : 9.81 };
44     /// Boltzmann constant
45     static const Lit!(2,1,-2,-1,0) k     = { value : 1.3806503e-23 };
46     /// electric field constant / permittivity of free space
47     static const Lit!(-3,-1,4,0,2) e     = { value : 8.854187817e-12};
48     /// Gravitational Constant
49     static const Lit!(3,-1,-2,0,0) G     = { value : 6.67259 };
50     /// Impedance of free space
51     static const Lit!(2,1,-3,0,-2) Z     = { value : 376.731};
52     /// speed of light
53     static const Types.Speed       c     = { value : 2.99792458e8 };
54     /// magnetic field constant / Permeability of a vacuum
55     static const Lit!(1,1,-2,0,-1) mu    = { value : 1.2566370614 };
56     /// Planck constant
57     static const Lit!(2,1,-1,0,0)  h     = { value : 6.62606876e-34 };
58     /// Stefan-Boltzmann constant
59     static const Lit!(4,-3,1,-4,0) sigma = { value : 5.670400e-8 };
60 }
61
62 /// astronomy constants
63 struct Astronomical
64 {
65     /// Astronomical unit
66     static const Types.Distance AU = { value :149.59787e11 };
67 }
68
69 ///
70 struct Chemistry
71 {
72     /// MassDensity of water (used for specific gravity)
73     static const Types.MassDensity rhoH2O = { value : 1000 };
74     /// Viscosity of water
75     static const Types.Viscosity muH2O = { value : 0.89e-3 };
76     /// Vapor pressure of Water at 80F
77     static const Types.Pressure PvH2O_80F = { value : 2827 };
78    
79 }
Note: See TracBrowser for help on using the browser.