12. Physical Constants Unit

Figure 12.1: The PhysicalConstants unit directory tree.
Image PhysicalConstants_pic

The Physical Constants unit provides a set of common constants, such as Pi and the gravitational constant, in various systems of measurement units. The default system of units is CGS, so named for having a length unit in centimeters, a mass unit in grams, and a time unit in seconds. In CGS, the charge unit is the esu, and the temperature unit is the Kelvin. The constants can also be obtained in the standard MKS system of units, where length is in meters, mass in kilograms, and time in seconds. For MKS units, charge is in Coloumbs, and temperature in Kelvin.

FLASH3 Transition: For ease of usage, the constant PI=3.14159.... is defined in the header file constants.h. Including this file with #include “constants.h” is an alternate way to access the value of $ \pi$, rather than needing to include the PhysicalConstants unit.

Any constant can optionally be converted from the standard units into any other available units. This facility makes it easy to ensure that all parts of the code are using a consistent set of physical constant values and unit conversions.

For example, a program using this unit might obtain the value of Newton's gravitational constant $ G$ in units of Mpc$ ^3$ Gyr $ ^{-2}M_\odot^{-1}$ by calling

 
call PhysicalConstants_get ("Newton", G, len_unit="Mpc",
                       time_unit="Gyr", mass_unit="Msun")
In this example, the local variable G is set equal to the result, $ 4.4983\times 10^{-15}$ (to five significant figures).

Physical constants are taken from K. Nahamura et al. (Particle Data Group), J. Phys. G 37, 075021 (2010).



Subsections