r'''Calculates the two-phase non-boiling 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} = 0.5\left(\frac{\mu_G}{\mu_L}\right)^{0.25} 
        Re_M^{0.7} Pr^{1/3}_L (\mu_b/\mu_w)^{0.14}
        
        Re_M = \frac{D V_L \rho_L}{\mu_L} + \frac{D V_g \rho_g}{\mu_g}
        
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval [-]
    D : float
        Diameter of the tube [m]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mug : float
        Viscosity of gas [Pa*s]
    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
    -----
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.
    
    Developed for vertical flow, and flow patters of bubbly and slug.
    Gas/liquid superficial velocity ratios from 0.3 to 4.6, liquid mass fluxes 
    from 200 to 1600 kg/m^2/s, and the fluids tested were air-water and 
    air-aqueous glycerine solutions. The tube inner diameter was 1 cm, and the
    L/D ratio was 86.
    
    Examples
    --------
    >>> Elamvaluthi_Srinivas(m=1, x=.9, D=.3, rhol=1000, rhog=2.5, Cpl=2300, 
    ... kl=.6, mug=1E-5, mu_b=1E-3, mu_w=1.2E-3)
    3901.2134471578584
    
    References
    ----------
    .. [1] Elamvaluthi, G., and N. S. Srinivas. "Two-Phase Heat Transfer in Two
       Component Vertical Flows." International Journal of Multiphase Flow 10, 
       no. 2 (April 1, 1984): 237-42. doi:10.1016/0301-9322(84)90021-1.
    .. [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 Elamvaluthi_Srinivas(m, x, D, rhol, rhog, Cpl, kl, mug, mu_b, mu_w=None):
    r'''Calculates the two-phase non-boiling 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} = 0.5\left(\frac{\mu_G}{\mu_L}\right)^{0.25} 
        Re_M^{0.7} Pr^{1/3}_L (\mu_b/\mu_w)^{0.14}
        
        Re_M = \frac{D V_L \rho_L}{\mu_L} + \frac{D V_g \rho_g}{\mu_g}
        
    Parameters
    ----------
    m : float
        Mass flow rate [kg/s]
    x : float
        Quality at the specific tube interval [-]
    D : float
        Diameter of the tube [m]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    Cpl : float
        Constant-pressure heat capacity of liquid [J/kg/K]
    kl : float
        Thermal conductivity of liquid [W/m/K]
    mug : float
        Viscosity of gas [Pa*s]
    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
    -----
    If the viscosity at the wall temperature is not given, the liquid viscosity
    correction is not applied.
    
    Developed for vertical flow, and flow patters of bubbly and slug.
    Gas/liquid superficial velocity ratios from 0.3 to 4.6, liquid mass fluxes 
    from 200 to 1600 kg/m^2/s, and the fluids tested were air-water and 
    air-aqueous glycerine solutions. The tube inner diameter was 1 cm, and the
    L/D ratio was 86.
    
    Examples
    --------
    >>> Elamvaluthi_Srinivas(m=1, x=.9, D=.3, rhol=1000, rhog=2.5, Cpl=2300, 
    ... kl=.6, mug=1E-5, mu_b=1E-3, mu_w=1.2E-3)
    3901.2134471578584
    
    References
    ----------
    .. [1] Elamvaluthi, G., and N. S. Srinivas. "Two-Phase Heat Transfer in Two
       Component Vertical Flows." International Journal of Multiphase Flow 10, 
       no. 2 (April 1, 1984): 237-42. doi:10.1016/0301-9322(84)90021-1.
    .. [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.
    '''
    Vg = m*x/(rhog*pi/4*D**2)
    Vl = m*(1-x)/(rhol*pi/4*D**2)

    Prl = Prandtl(Cp=Cpl, mu=mu_b, k=kl)
    ReM = D*Vl*rhol/mu_b + D*Vg*rhog/mug
    Nu_TP = 0.5*(mug/mu_b)**0.25*ReM**0.7*Prl**(1/3.)
    if mu_w:
        Nu_TP *= (mu_b/mu_w)**0.14
    return Nu_TP*kl/D