# 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''


close = assert_close1d


def test_drag():
    Cd = Stokes(0.1)
    assert_close(Cd, 240.0)

    # All examples from [1]_, in a table of calculated values, matches.
    Cds = [Barati(200.), Barati(0.002)]
    close(Cds, [0.7682237950389874, 12008.864343802072])

    # All examples from [1]_, in a table of calculated values, matches.
    Cds = [Barati_high(i) for i in [200, 0.002, 1E6]]

# 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

in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''


close = assert_close1d


def test_drag():
    Cd = Stokes(0.1)
    assert_close(Cd, 240.0)

    # All examples from [1]_, in a table of calculated values, matches.
    Cds = [Barati(200.), Barati(0.002)]
    close(Cds, [0.7682237950389874, 12008.864343802072])

    # All examples from [1]_, in a table of calculated values, matches.
    Cds = [Barati_high(i) for i in [200, 0.002, 1E6]]

    Cd_values = [0.7730544082789523, 12034.714777630921, 0.21254574397767056]