def Lockhart_Martinelli_Xtt(x, rhol, rhog, mul, mug, pow_x=0.9, pow_rho=0.5,
                            pow_mu=0.1, n=None):
    r'''Calculates the Lockhart-Martinelli Xtt two-phase flow parameter in a
    general way according to [2]_. [1]_ is said to describe this. However,
    very different definitions of this parameter have been used elsewhere.
    Accordingly, the powers of each of the terms can be set. Alternatively, if
    the parameter `n` is provided, the powers for viscosity and phase fraction
    will be calculated from it as shown below.
    
    .. math::
        X_{tt} = \left(\frac{1-x}{x}\right)^{0.9} \left(\frac{\rho_g}{\rho_l}
        \right)^{0.5}\left(\frac{\mu_l}{\mu_g}\right)^{0.1}
        
    .. math::
        X_{tt} = \left(\frac{1-x}{x}\right)^{(2-n)/2} \left(\frac{\rho_g}
        {\rho_l}\right)^{0.5}\left(\frac{\mu_l}{\mu_g}\right)^{n/2}
        
    Parameters
    ----------
    x : float
        Quality at the specific tube interval [-]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    mul : float
        Viscosity of liquid [Pa*s]
    mug : float
        Viscosity of gas [Pa*s]
    pow_x : float, optional
        Power for the phase ratio (1-x)/x, [-]
    pow_rho : float, optional
        Power for the density ratio rhog/rhol, [-]
    pow_mu : float, optional
        Power for the viscosity ratio mul/mug, [-]
    n : float, optional
        Number to be used for calculating pow_x and pow_mu if provided, [-]

    Returns
    -------
    Xtt : float
        Xtt Lockhart-Martinelli two-phase flow parameter [-]

    Notes
    -----
    Xtt is best regarded as an empirical parameter.
    If used, n is often 0.2 or 0.25.

    Examples
    --------
    >>> Lockhart_Martinelli_Xtt(0.4, 800, 2.5, 1E-3, 1E-5)
    0.12761659240532292

    References
    ----------
    .. [1] Lockhart, R. W. & Martinelli, R. C. (1949), "Proposed correlation of
       data for isothermal two-phase, two-component flow in pipes", Chemical 
       Engineering Progress 45 (1), 39-48.
    .. [2] Woldesemayat, Melkamu A., and Afshin J. Ghajar. "Comparison of Void 
       Fraction Correlations for Different Flow Patterns in Horizontal and 
       Upward Inclined Pipes." International Journal of Multiphase Flow 33, 
       no. 4 (April 2007): 347-370. doi:10.1016/j.ijmultiphaseflow.2006.09.004.
    '''
    if n:
        pow_x = (2-n)/2.
        pow_mu = n/2.
    return ((1-x)/x)**pow_x * (rhog/rhol)**pow_rho * (mul/mug)**pow_mu
def Lockhart_Martinelli_Xtt ( x , rhol , rhog , mul , mug , pow_x = 0.9 , pow_rho = 0.5 , pow_mu = 0.1 , n = None ) : if n : pow_x = ( 2 - n ) / 2. pow_mu = n / 2. return ( ( 1 - x ) / x ) ** pow_x * ( rhog / rhol ) ** pow_rho * ( mul / mug ) ** pow_mu
r'''Calculates the Lockhart-Martinelli Xtt two-phase flow parameter in a
    general way according to [2]_. [1]_ is said to describe this. However,
    very different definitions of this parameter have been used elsewhere.
    Accordingly, the powers of each of the terms can be set. Alternatively, if
    the parameter `n` is provided, the powers for viscosity and phase fraction
    will be calculated from it as shown below.
    
    .. math::
        X_{tt} = \left(\frac{1-x}{x}\right)^{0.9} \left(\frac{\rho_g}{\rho_l}
        \right)^{0.5}\left(\frac{\mu_l}{\mu_g}\right)^{0.1}
        
    .. math::
        X_{tt} = \left(\frac{1-x}{x}\right)^{(2-n)/2} \left(\frac{\rho_g}
        {\rho_l}\right)^{0.5}\left(\frac{\mu_l}{\mu_g}\right)^{n/2}
        
    Parameters
    ----------
    x : float
        Quality at the specific tube interval [-]
    rhol : float
        Density of the liquid [kg/m^3]
    rhog : float
        Density of the gas [kg/m^3]
    mul : float
        Viscosity of liquid [Pa*s]
    mug : float
        Viscosity of gas [Pa*s]
    pow_x : float, optional
        Power for the phase ratio (1-x)/x, [-]
    pow_rho : float, optional
        Power for the density ratio rhog/rhol, [-]
    pow_mu : float, optional
        Power for the viscosity ratio mul/mug, [-]
    n : float, optional
        Number to be used for calculating pow_x and pow_mu if provided, [-]

    Returns
    -------
    Xtt : float
        Xtt Lockhart-Martinelli two-phase flow parameter [-]

    Notes
    -----
    Xtt is best regarded as an empirical parameter.
    If used, n is often 0.2 or 0.25.

    Examples
    --------
    >>> Lockhart_Martinelli_Xtt(0.4, 800, 2.5, 1E-3, 1E-5)
    0.12761659240532292

    References
    ----------
    .. [1] Lockhart, R. W. & Martinelli, R. C. (1949), "Proposed correlation of
       data for isothermal two-phase, two-component flow in pipes", Chemical 
       Engineering Progress 45 (1), 39-48.
    .. [2] Woldesemayat, Melkamu A., and Afshin J. Ghajar. "Comparison of Void 
       Fraction Correlations for Different Flow Patterns in Horizontal and 
       Upward Inclined Pipes." International Journal of Multiphase Flow 33, 
       no. 4 (April 2007): 347-370. doi:10.1016/j.ijmultiphaseflow.2006.09.004.