In [15]:
from fluids import *
import matplotlib.pyplot as plt
from math import *
% matplotlib inline
import numpy as np
from scipy.interpolate import *
from scipy.constants import *

In [4]:
%timeit size_control_valve_l(rho=965.4, Psat=70.1E3, Pc=22120E3, mu=3.1472E-4,P1=680E3, P2=220E3, Q=0.1, D1=0.1, D2=0.09, d=0.08, FL=0.9, Fd=0.46)
%timeit size_control_valve_l(rho=965.4, Psat=70.1E3, Pc=22120E3, mu=3.1472E-4, P1=680E3, P2=220E3, Q=0.1, D1=0.1, D2=0.1, d=0.95, FL=0.6, Fd=0.98)
%timeit size_control_valve_l(rho=965.4, Psat=70.1E3, Pc=22120E3, mu=3.1472E-2, P1=680E3, P2=220E3, Q=0.001, D1=0.01, D2=0.01, d=0.01, FL=0.6, Fd=0.98)


The slowest run took 7.24 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 14.6 µs per loop
100000 loops, best of 3: 10 µs per loop
100000 loops, best of 3: 8.97 µs per loop

In [5]:
%timeit size_control_valve_g(T=433., MW=44.01, mu=1.4665E-4, gamma=1.30, Z=0.988, P1=680E3, P2=310E3, Q=38/36., D1=0.08, D2=0.1, d=0.05, FL=0.85, Fd=0.42, xT=0.60)
%timeit size_control_valve_g(T=320., MW=39.95, mu=5.625E-5, gamma=1.67, Z=1.0, P1=2.8E5, P2=1.3E5, Q=0.46/3600., D1=0.015, D2=0.015, d=0.015, FL=0.98, Fd=0.07, xT=0.8)


The slowest run took 5.17 times longer than the fastest. This could mean that an intermediate result is being cached 
10000 loops, best of 3: 18.6 µs per loop
100000 loops, best of 3: 9.61 µs per loop

In [6]:
%timeit gravity(55, 1E4)


The slowest run took 48.59 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 824 ns per loop

In [5]:
print 'General'
%timeit entrance_rounded(Di=0.1, rc=0.0235)
%timeit spiral(Di=0.01, rmax=.1, rmin=.02, pitch=.01, fd=0.0185)
%timeit contraction_conical(Di1=0.1, Di2=0.04, l=0.04, fd=0.0185)
%timeit diffuser_conical(Di1=2/3., Di2=1, angle=120, fd=0.0185)
%timeit diffuser_conical_staged(Di1=1., Di2=10., DEs=[2,3,4,5,6,7,8,9], ls=[1,1,1,1,1,1,1,1,1], fd=0.01)
print 'Darby'
%timeit Darby3K(NPS=2., Re=10000., name='Valve, Angle valve, 45°, full line size, β = 1')
%timeit Darby3K(NPS=12., Re=10000., K1=950,  Ki=0.25,  Kd=4)
print 'Hooper'
%timeit Hooper2K(Di=2., Re=10000., name='Valve, Globe, Standard')


General
The slowest run took 13.76 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 1.25 µs per loop
The slowest run took 8.43 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 820 ns per loop
The slowest run took 7.09 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 2.25 µs per loop
The slowest run took 13.90 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 1.8 µs per loop
10000 loops, best of 3: 30.9 µs per loop
Darby
The slowest run took 16.22 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 691 ns per loop
The slowest run took 14.48 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 560 ns per loop
Hooper
The slowest run took 10.39 times longer than the fastest. This could mean that an intermediate result is being cached 
1000000 loops, best of 3: 574 ns per loop

In [11]:
%timeit TANK(D=1.2, L=4, horizontal=False).V_total
%timeit TANK(D=1.2, L=4, horizontal=False).V_from_h(.5)
%timeit TANK(V=10, L_over_D=0.7, sideB='conical', sideB_a=0.5)
%timeit TANK(D=8., L=10., horizontal=False, sideA='torispherical', sideB='torispherical', sideA_a=1.3547, sideB_a=1.3547, sideA_f=1., sideA_k=0.06, sideB_f=1., sideB_k=0.06).h_from_V(.5)


The slowest run took 8.49 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 7.66 µs per loop
100000 loops, best of 3: 9.66 µs per loop
1000 loops, best of 3: 233 µs per loop
1000 loops, best of 3: 1.11 ms per loop

In [12]:
%timeit dP_packed_bed(dp=8E-4, voidage=0.4, vs=1E-3, rho=1E3, mu=1E-3)
%timeit dP_packed_bed(dp=8E-4, voidage=0.4, vs=1E-3, rho=1E3, mu=1E-3, Dt=0.01)


The slowest run took 7.81 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 6.41 µs per loop
100000 loops, best of 3: 7.27 µs per loop

In [14]:
%timeit nearest_pipe(Do=.273, schedule='5S')
%timeit gauge_from_t(.5, False, 'BWG'), gauge_from_t(0.005588, True)


The slowest run took 4.14 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 4.55 µs per loop
The slowest run took 6.74 times longer than the fastest. This could mean that an intermediate result is being cached 
100000 loops, best of 3: 2.8 µs per loop

In [17]:
%timeit VFD_efficiency(100*hp, load=0.5)
%timeit CSA_motor_efficiency(100*hp, closed=True, poles=6, high_efficiency=True)
# TODO FIX THIS


The slowest run took 4.86 times longer than the fastest. This could mean that an intermediate result is being cached 
10000 loops, best of 3: 31.7 µs per loop
10000 loops, best of 3: 31.3 µs per loop

In [ ]:


In [20]:
from fluids.safety_valve import API520_SH
%timeit API520_SH(593+273.15, 1066.325E3)


The slowest run took 5.30 times longer than the fastest. This could mean that an intermediate result is being cached 
10000 loops, best of 3: 38.1 µs per loop