-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpymrst_units.py
38 lines (38 loc) · 1.07 KB
/
pymrst_units.py
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
# All units are conversion to metric
atm = lambda: 101325
barrel = lambda: 1/6.29
barsa = lambda: 1e5
btu = lambda: 1054.3503
centi = lambda: 0.01
darcy = lambda: 9.869232667160130e-13 # to m2
second = lambda: 1
minute = lambda: 60 * second()
hour = lambda: 60 * minute()
day = lambda: 24 * hour()
deci = lambda: .1
year = lambda: 365 * day()
ft = lambda: 0.3048
gallon = lambda: 231 * inch()**3
giga = lambda: 1e9
gram = lambda: 1e-3 * kilogram()
inch = lambda: 2.54 * centi() * meter()
kelvin = lambda: 1
kilo = lambda: 1e3
kilogram = lambda: 1
lbf = lambda: pound() * 9.80665 * meter() / (second()**2)
litre = lambda: (deci()*meter())**3
mega = lambda: 1e6
meter = lambda: 1
micro = lambda: 1e-6
milli = lambda: 1e-3
nano = lambda: 1e-9
Newton = lambda: 1
Pascal = lambda: 1
pico = lambda: 1e-12
poise = lambda: 0.1 * Pascal()*second()
pound = lambda: 0.45359237 * kilogram()
psia = lambda: lbf() / inch()**2
stb = lambda: 42 * gallon() # same as barrel()
rankine = lambda: 5/9
fahrenheit = lambda x: (x - 32) * (5/9) + 273.15 # use fahrenheit(x) instead of
celsius = lambda x: x + 273.15