NAME
PhysicalConstants_get
SYNOPSIS
call PhysicalConstants_get(character(len=*)(IN) :: name,
real(OUT) :: value,
real(IN,OPTIONAL) :: unitLength,
real(IN,OPTIONAL) :: unitTime,
real(IN,OPTIONAL) :: unitMass,
real(IN,OPTIONAL) :: unitTemp,
real(IN,OPTIONAL) :: unitCharge,
real(IN,OPTIONAL) :: unitSubstAmount)
DESCRIPTION
Retrieve the value of a physical constant. Returns in CGS or MKS units,
depending upon status of runtime parameter pc_unitsBase.
If called with optional unit arguments, the basic constant is converted and
returned with the requested units.
This interface can also be used to convert a know unit of length, mass, time,
temperature, charge, or substance amount to either another known unit (when
the corresponding optional unitFoo argument is present), or to the corresponding
base unit in CGS or MKS (when unitFoo is not present). This will happen if name
does not match the name of a know constant but does match the name if a known
unit.
If the constant name is not recognized, or some other error,
returns value of 0
ARGUMENTS
name: character(len=*,IN) Name of the physical constant sought, or of an input unit
to convert.
See the implementation in PhysicalConstants_init.F90 or
any typical flash.log file for a list of implemented
constant names and unit names.
value: real(OUT) returned value of the physical constant in appropriate units
unitLength: real(IN,OPTIONAL) value will be returned with this requested unit for length
unitMass: real(IN,OPTIONAL) value will be returned with this requested unit for mass
unitTime: real(IN,OPTIONAL) value will be returned with this requested unit for time
unitTemp: real(IN,OPTIONAL) value will be returned with this requested unit for temperature
unitCharge: real(IN,OPTIONAL) value will be returned with this requested unit for charge
unitSubstAmount: real(IN,OPTIONAL) value will be returned with this requested unit for
substance amount
PARAMETERS
pc_unitsBase [default "CGS"] set the default system of units, either "CGS" or "MKS"
CGS: centimeters, grams, seconds, charge=esu
MKS: meters, kilometers, seconds, charge=Coloumb
both systems have temperature in Kelvin
EXAMPLE
Example of usage:
use PhysicalConstants_interface,ONLY: PhysicalConstants_get
............
real :: newton
............
call PhysicalConstants_get("newton",newton,unitMass="kg",unitLength="cm")
! Get conversion factor from atomic mass units to kg:
call PhysicalConstants_get("amu", amu2kg, unitMass="kg")
! Get conversion factor from atomic mass units to the current base
! unit for mass, either g or kg depending on the default system of units
! in effect:
call PhysicalConstants_get("amu", atomic_mass_unit)
NOTES
Because PhysicalConstants_get has optional arguments in the interface, the interface file PhysicalConstants_interface must be used in the calling routine. The constant named "Newton" does not indicate the SI unit of force (which has dimensions LENGTH^1 * TIME^(-2) * MASS^1), but Newton's gravitational constant G.