These changes make it unnecessary to copy header files around during the build process, which tends to confuse IDEs and debuggers. The headers which comprise Cantera's external C++ interface are now in the 'include' directory. All of the samples and demos are now in the 'samples' subdirectory.
140 lines
5.1 KiB
Python
Executable file
140 lines
5.1 KiB
Python
Executable file
#!/bin/env python
|
|
#
|
|
#--------------------------------------------------------------------------
|
|
#
|
|
# $License$
|
|
#
|
|
#--------------------------------------------------------------------------
|
|
|
|
# $Log: SI.py,v $
|
|
# Revision 1.1.1.1 2003/04/14 17:57:49 dggoodwin
|
|
# Initial import.
|
|
#
|
|
# Revision 1.1 2002/12/20 13:23:41 dgg
|
|
# first commit
|
|
#
|
|
# Revision 1.1.1.1 2000/01/21 22:59:51 dgg
|
|
# dgg Cantera
|
|
#
|
|
# Revision 1.1 1999/11/27 17:27:35 dgg
|
|
# initial import to Cantera repository
|
|
#
|
|
# Revision 1.1 1999/11/25 19:50:58 aivazis
|
|
# Original source
|
|
#
|
|
|
|
from unit import unit, dimensionless
|
|
|
|
#
|
|
# The basic SI units
|
|
#
|
|
meter = unit(1.0, (1, 0, 0, 0, 0, 0, 0))
|
|
kilogram = unit(1.0, (0, 1, 0, 0, 0, 0, 0))
|
|
second = unit(1.0, (0, 0, 1, 0, 0, 0, 0))
|
|
ampere = unit(1.0, (0, 0, 0, 1, 0, 0, 0))
|
|
kelvin = unit(1.0, (0, 0, 0, 0, 1, 0, 0))
|
|
mole = unit(1.0, (0, 0, 0, 0, 0, 1, 0))
|
|
candela = unit(1.0, (0, 0, 0, 0, 0, 0, 1))
|
|
|
|
#
|
|
# The 21 derived SI units with special names
|
|
#
|
|
radian = dimensionless # plane angle
|
|
steradian = dimensionless # solid angle
|
|
|
|
hertz = 1/second # frequency
|
|
|
|
newton = meter*kilogram/second**2 # force
|
|
pascal = newton/meter**2 # pressure
|
|
joule = newton*meter # work, heat
|
|
watt = joule/second # power, radiant flux
|
|
|
|
coulomb = ampere*second # electric charge
|
|
volt = watt/ampere # electric potential difference
|
|
farad = coulomb/volt # capacitance
|
|
ohm = volt/ampere # electric resistance
|
|
siemens = ampere/volt # electric conductance
|
|
weber = volt*second # magnetic flux
|
|
tesla = weber/meter**2 # magnetic flux density
|
|
henry = weber/ampere # inductance
|
|
|
|
celsius = kelvin # Celsius temperature
|
|
|
|
lumen = candela*steradian # luminous flux
|
|
lux = lumen/meter**2 # illuminance
|
|
|
|
becquerel = 1/second # radioactivity
|
|
gray = joule/kilogram # absorbed dose
|
|
sievert = joule/kilogram # dose equivalent
|
|
|
|
#
|
|
# The prefixes
|
|
#
|
|
|
|
yotta = 1e24
|
|
zetta = 1e21
|
|
exa = 1e18
|
|
peta = 1e15
|
|
tera = 1e12
|
|
giga = 1e9
|
|
mega = 1e6
|
|
kilo = 1000
|
|
hecto = 100
|
|
deka = 10
|
|
deci = .1
|
|
centi = .01
|
|
milli = .001
|
|
micro = 1e-6
|
|
nano = 1e-9
|
|
pico = 1e-12
|
|
femto = 1e-15
|
|
atto = 1e-18
|
|
zepto = 1e-21
|
|
yocto = 1e-24
|
|
|
|
|
|
#
|
|
# Test
|
|
#
|
|
|
|
if __name__ == "__main__":
|
|
|
|
print "The 7 base SI units:"
|
|
print " meter: %s" % meter
|
|
print " kilogram: %s" % kilogram
|
|
print " second: %s" % second
|
|
print " ampere: %s" % ampere
|
|
print " kelvin: %s" % kelvin
|
|
print " mole: %s" % mole
|
|
print " candela: %s" % candela
|
|
print
|
|
print "The 21 SI derived units with special names:"
|
|
print " radian: %s" % radian
|
|
print " steradian: %s" % steradian
|
|
print " hertz: %s" % hertz
|
|
|
|
print " newton: %s" % newton
|
|
print " pascal: %s" % pascal
|
|
print " joule: %s" % joule
|
|
print " watt: %s" % watt
|
|
|
|
print " coulomb: %s" % coulomb
|
|
print " volt: %s" % volt
|
|
print " farad: %s" % farad
|
|
print " ohm: %s" % ohm
|
|
print " siemens: %s" % siemens
|
|
print " weber: %s" % weber
|
|
print " tesla: %s" % tesla
|
|
print " henry: %s" % henry
|
|
|
|
print " degree Celcius: %s" % celcius
|
|
|
|
print " lumen: %s" % lumen
|
|
print " lux: %s" % lux
|
|
|
|
print " becquerel: %s" % becquerel
|
|
print " gray: %s" % gray
|
|
print " sievert: %s" % sievert
|
|
|
|
#
|
|
# End of file
|