r'''Calculates the two-phase non-boiling laminar heat transfer coefficient  
    of a liquid and gas flowing inside a tube of any inclination, as in [1]_  
    and reviewed in [2]_.

    .. math::
        \frac{h_{TP} D}{k_l} = 1.75(1-\alpha)^{-0.5}\left(\frac{m_l C_{p,l}}
        {(1-\alpha)k_l L}\right)^{1/3}\left(\frac{\mu_b}{\mu_w}\right)^{0.14}
    
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval []
    alpha : float
        Void fraction in the tube, []
    D : float
        Diameter of the tube [m]
    L : float
        Length of the tube, [m]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mu_b : float
        Viscosity of liquid at bulk conditions (average of inlet/outlet 
        temperature) [Pa*s]
    mu_w : float, optional
        Viscosity of liquid at wall temperature [Pa*s]

    Returns
    -------
    h : float
        Heat transfer coefficient [W/m^2/K]

    Notes
    -----
    This model is based on a laminar entry length correlation - for a 
    sufficiently long tube, this will predict unrealistically low heat transfer
    coefficients.
    
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.

    Developed for horizontal pipes in laminar slug flow. Data consisted of the 
    systems air-water, air-SAE 10 oil, gas-oil, air-diethylene glycol, and
    air-aqueous glycerine.
    
    Examples
    --------
    >>> Hughmark(m=1, x=.9, alpha=.9, D=.3, L=.5, Cpl=2300, kl=0.6, mu_b=1E-3, 
    ... mu_w=1.2E-3)
    212.7411636127175

    References
    ----------
    .. [1] Hughmark, G. A. "Holdup and Heat Transfer in Horizontal Slug Gas-
       Liquid Flow." Chemical Engineering Science 20, no. 12 (December 1, 
       1965): 1007-10. doi:10.1016/0009-2509(65)80101-4.
    .. [2] Dongwoo Kim, Venkata K. Ryali, Afshin J. Ghajar, Ronald L. 
       Dougherty. "Comparison of 20 Two-Phase Heat Transfer Correlations with 
       Seven Sets of Experimental Data, Including Flow Pattern and Tube 
       Inclination Effects." Heat Transfer Engineering 20, no. 1 (February 1, 
       1999): 15-40. doi:10.1080/014576399271691.

def Hughmark(m, x, alpha, D, L, Cpl, kl, mu_b=None, mu_w=None):
    r'''Calculates the two-phase non-boiling laminar heat transfer coefficient  
    of a liquid and gas flowing inside a tube of any inclination, as in [1]_  
    and reviewed in [2]_.

    .. math::
        \frac{h_{TP} D}{k_l} = 1.75(1-\alpha)^{-0.5}\left(\frac{m_l C_{p,l}}
        {(1-\alpha)k_l L}\right)^{1/3}\left(\frac{\mu_b}{\mu_w}\right)^{0.14}
    
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval []
    alpha : float
        Void fraction in the tube, []
    D : float
        Diameter of the tube [m]
    L : float
        Length of the tube, [m]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mu_b : float
        Viscosity of liquid at bulk conditions (average of inlet/outlet 
        temperature) [Pa*s]
    mu_w : float, optional
        Viscosity of liquid at wall temperature [Pa*s]

    Returns
    -------
    h : float
        Heat transfer coefficient [W/m^2/K]

    Notes
    -----
    This model is based on a laminar entry length correlation - for a 
    sufficiently long tube, this will predict unrealistically low heat transfer
    coefficients.
    
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.

    Developed for horizontal pipes in laminar slug flow. Data consisted of the 
    systems air-water, air-SAE 10 oil, gas-oil, air-diethylene glycol, and
    air-aqueous glycerine.
    
    Examples
    --------
    >>> Hughmark(m=1, x=.9, alpha=.9, D=.3, L=.5, Cpl=2300, kl=0.6, mu_b=1E-3, 
    ... mu_w=1.2E-3)
    212.7411636127175

    References
    ----------
    .. [1] Hughmark, G. A. "Holdup and Heat Transfer in Horizontal Slug Gas-
       Liquid Flow." Chemical Engineering Science 20, no. 12 (December 1, 
       1965): 1007-10. doi:10.1016/0009-2509(65)80101-4.
    .. [2] Dongwoo Kim, Venkata K. Ryali, Afshin J. Ghajar, Ronald L. 
       Dougherty. "Comparison of 20 Two-Phase Heat Transfer Correlations with 
       Seven Sets of Experimental Data, Including Flow Pattern and Tube 
       Inclination Effects." Heat Transfer Engineering 20, no. 1 (February 1, 
       1999): 15-40. doi:10.1080/014576399271691.
    '''
    ml = m*(1-x)
    RL = 1-alpha
    Nu_TP = 1.75*(RL)**-0.5*(ml*Cpl/RL/kl/L)**(1/3.)
    if mu_b and mu_w:
        Nu_TP *= (mu_b/mu_w)**0.14
    return Nu_TP*kl/D