# Path: fluids/core.py
# def F2K(F):
#     """Convert Fahrenheit to Kelvin.
# 
#     Parameters
#     ----------
#     F : float
#         Fahrenheit temperature to be converted.
# 
#     Returns
#     -------
#     K : float
#         Equivalent Kelvin temperature.
# 
#     Notes
#     -----
#     Computes ``K = (F - 32)/1.8 + zero_Celsius`` where `zero_Celsius` =
#     273.15, i.e., (the absolute value of) temperature "absolute zero" as
#     measured in Celsius.
# 
#     Examples
#     --------
#     >>> F2K(-40)
#     233.14999999999998
#     """
#     return (F - 32.0)/1.8 + zero_Celsius


from fluids.compressible import *
from fluids.constants import *
from fluids.core import F2K
from fluids.numerics import assert_close, assert_close1d
from math import log, pi
import pytest
def test_compressible():
    T = T_critical_flow(473., 1.289)
    assert_close(T, 413.2809086937528)

    P = P_critical_flow(1400000., 1.289)
    assert_close(P, 766812.9022792266)

    assert not is_critical_flow(670E3, 532E3, 1.11)
    assert is_critical_flow(670E3, 101E3, 1.11)

    SE = stagnation_energy(125.)
    assert_close(SE, 7812.5)

    PST = P_stagnation(54050., 255.7, 286.8, 1.4)
    assert_close(PST, 80772.80495900588)

    Tst = T_stagnation(286.8, 54050., 54050*8., 1.4)
    assert_close(Tst, 519.5230938217768)

    Tstid = T_stagnation_ideal(255.7, 250., 1005.)
    assert_close(Tstid, 286.79452736318405)


def test_Panhandle_A():
    # Example 7-18 Gas of Crane TP 410M
    D = 0.340
    P1 = 90E5
    P2 = 20E5
    L = 160E3
    SG=0.693

# Path: fluids/core.py
# def F2K(F):
#     """Convert Fahrenheit to Kelvin.
# 
#     Parameters
#     ----------
#     F : float
#         Fahrenheit temperature to be converted.
# 
#     Returns
#     -------
#     K : float
#         Equivalent Kelvin temperature.
# 
#     Notes
#     -----
#     Computes ``K = (F - 32)/1.8 + zero_Celsius`` where `zero_Celsius` =
#     273.15, i.e., (the absolute value of) temperature "absolute zero" as
#     measured in Celsius.
# 
#     Examples
#     --------
#     >>> F2K(-40)
#     233.14999999999998
#     """
#     return (F - 32.0)/1.8 + zero_Celsius


# Path: tests/test_compressible.py
from fluids.compressible import *
from fluids.constants import *
from fluids.core import F2K
from fluids.numerics import assert_close, assert_close1d
from math import log, pi
import pytest

def test_compressible():
    T = T_critical_flow(473., 1.289)
    assert_close(T, 413.2809086937528)

    P = P_critical_flow(1400000., 1.289)
    assert_close(P, 766812.9022792266)

    assert not is_critical_flow(670E3, 532E3, 1.11)
    assert is_critical_flow(670E3, 101E3, 1.11)

    SE = stagnation_energy(125.)
    assert_close(SE, 7812.5)

    PST = P_stagnation(54050., 255.7, 286.8, 1.4)
    assert_close(PST, 80772.80495900588)

    Tst = T_stagnation(286.8, 54050., 54050*8., 1.4)
    assert_close(Tst, 519.5230938217768)

    Tstid = T_stagnation_ideal(255.7, 250., 1005.)
    assert_close(Tstid, 286.79452736318405)


def test_Panhandle_A():
    # Example 7-18 Gas of Crane TP 410M
    D = 0.340
    P1 = 90E5
    P2 = 20E5
    L = 160E3
    SG=0.693

    Tavg = 277.15