# Path: fluids/drag.py
# def Stokes(Re):
# def Barati(Re):
# def Barati_high(Re):
# def Rouse(Re):
# def Engelund_Hansen(Re):
# def Clift_Gauvin(Re):
# def Morsi_Alexander(Re):
# def Graf(Re):
# def Flemmer_Banks(Re):
# def Khan_Richardson(Re):
# def Swamee_Ojha(Re):
# def Yen(Re):
# def Haider_Levenspiel(Re):
# def Cheng(Re):
# def Terfous(Re):
# def Mikhailov_Freire(Re):
# def Clift(Re):
# def Ceylan(Re):
# def Almedeij(Re):
# def Morrison(Re):
# def Song_Xu(Re, sphericity=1., S=1.):
# def drag_sphere_methods(Re, check_ranges=True):
# def drag_sphere(Re, Method=None):
# def _v_terminal_err(V, Method, Re_almost, main):
# def v_terminal(D, rhop, rho, mu, Method=None):
# def time_v_terminal_Stokes(D, rhop, rho, mu, V0, tol=1e-14):
# def integrate_drag_sphere(D, rhop, rho, mu, t, V=0, Method=None,
#                           distance=False):
#     def dv_dt(V, t):
#     E = 0.383*Re**0.356 - 0.207*Re**0.396 - 0.143/(1 + (log10(Re))**2)


from fluids.drag import drag_sphere, drag_sphere_methods, v_terminal, integrate_drag_sphere, time_v_terminal_Stokes, drag_sphere_correlations
from fluids.drag import *
from fluids.numerics import assert_close1d, assert_close
import pytest
    assert_close(Cd, 0.21254574397767056)

    Cd = drag_sphere(0.001)
    assert_close(Cd, 24000.0)

    Cd = drag_sphere(0.05)
    assert_close(Cd, 481.23769162684573)

    with pytest.raises(Exception):
        drag_sphere(200, Method='BADMETHOD')

    with pytest.raises(Exception):
        drag_sphere(1E7)


    methods = drag_sphere_methods(3E5, True)
    method_known = ['Barati_high', 'Ceylan', 'Morrison', 'Clift', 'Almedeij']
    assert sorted(method_known) == sorted(methods)
    assert 20 == len(drag_sphere_methods(200))
    assert 21 == len(drag_sphere_methods(200000, check_ranges=False))
    assert 5 == len(drag_sphere_methods(200000, check_ranges=True))

def test_v_terminal():
    v_t = v_terminal(D=70E-6, rhop=2600., rho=1000., mu=1E-3)
    assert_close(v_t, 0.00414249724453)

    v_t = v_terminal(D=70E-9, rhop=2600., rho=1000., mu=1E-3)
    assert_close(v_t, 4.271340888888889e-09)

    # [2] has a good example

# Path: fluids/drag.py
# def Stokes(Re):
# def Barati(Re):
# def Barati_high(Re):
# def Rouse(Re):
# def Engelund_Hansen(Re):
# def Clift_Gauvin(Re):
# def Morsi_Alexander(Re):
# def Graf(Re):
# def Flemmer_Banks(Re):
# def Khan_Richardson(Re):
# def Swamee_Ojha(Re):
# def Yen(Re):
# def Haider_Levenspiel(Re):
# def Cheng(Re):
# def Terfous(Re):
# def Mikhailov_Freire(Re):
# def Clift(Re):
# def Ceylan(Re):
# def Almedeij(Re):
# def Morrison(Re):
# def Song_Xu(Re, sphericity=1., S=1.):
# def drag_sphere_methods(Re, check_ranges=True):
# def drag_sphere(Re, Method=None):
# def _v_terminal_err(V, Method, Re_almost, main):
# def v_terminal(D, rhop, rho, mu, Method=None):
# def time_v_terminal_Stokes(D, rhop, rho, mu, V0, tol=1e-14):
# def integrate_drag_sphere(D, rhop, rho, mu, t, V=0, Method=None,
#                           distance=False):
#     def dv_dt(V, t):
#     E = 0.383*Re**0.356 - 0.207*Re**0.396 - 0.143/(1 + (log10(Re))**2)


# Path: tests/test_drag.py
from fluids.drag import drag_sphere, drag_sphere_methods, v_terminal, integrate_drag_sphere, time_v_terminal_Stokes, drag_sphere_correlations
from fluids.drag import *
from fluids.numerics import assert_close1d, assert_close
import pytest

    assert_close(Cd, 0.21254574397767056)

    Cd = drag_sphere(0.001)
    assert_close(Cd, 24000.0)

    Cd = drag_sphere(0.05)
    assert_close(Cd, 481.23769162684573)

    with pytest.raises(Exception):
        drag_sphere(200, Method='BADMETHOD')

    with pytest.raises(Exception):
        drag_sphere(1E7)


    methods = drag_sphere_methods(3E5, True)
    method_known = ['Barati_high', 'Ceylan', 'Morrison', 'Clift', 'Almedeij']
    assert sorted(method_known) == sorted(methods)
    assert 20 == len(drag_sphere_methods(200))
    assert 21 == len(drag_sphere_methods(200000, check_ranges=False))
    assert 5 == len(drag_sphere_methods(200000, check_ranges=True))

def test_v_terminal():
    v_t = v_terminal(D=70E-6, rhop=2600., rho=1000., mu=1E-3)
    assert_close(v_t, 0.00414249724453)

    v_t = v_terminal(D=70E-9, rhop=2600., rho=1000., mu=1E-3)
    assert_close(v_t, 4.271340888888889e-09)

    # [2] has a good example

    v_t = v_terminal(D=70E-6, rhop=2.6E3, rho=1000., mu=1E-3)