def Mandhane_Gregory_Aziz_regime(m, x, rhol, rhog, mul, mug, sigma, D, 
                                 full_output=False):
    r'''Classifies the regime of a two-phase flow according to Mandhane, 
    Gregory, and Azis  (1974) flow map.
    
    The flow regimes in this method are 'elongated bubble', 'stratified', 
    'annular mist', 'slug', 'dispersed bubble', and 'wave'.
    
    The parameters used are just the superficial liquid and gas velocity (i.e.
    if only the mass flow of that phase were flowing in the pipe).

    Parameters
    ----------
    m : float
        Mass flow rate of fluid, [kg/s]
    x : float
        Mass quality of fluid, [-]
    rhol : float
        Liquid density, [kg/m^3]
    rhog : float
        Gas density, [kg/m^3]
    mul : float
        Viscosity of liquid, [Pa*s]
    mug : float
        Viscosity of gas, [Pa*s]
    sigma : float
        Surface tension, [N/m]
    D : float
        Diameter of pipe, [m]
    full_output : bool, optional
        When True, returns a dictionary with the values 'v_gs', 'v_ls',
        - the parameters used internally to determine where on the plot the
        regime occurs, [-]
    
    Returns
    -------
    regime : str
        One of 'elongated bubble', 'stratified', 'annular mist', 'slug', 
        'dispersed bubble', or 'wave', [-]

    Notes
    -----
    [1]_ contains a Fortran implementation of this model, which this has been 
    validated against. This is a very fast flow map as all transitions were
    spelled out with clean transitions.

    Examples
    --------
    >>> Mandhane_Gregory_Aziz_regime(m=0.6, x=0.112, rhol=915.12, rhog=2.67, 
    ... mul=180E-6, mug=14E-6, sigma=0.065, D=0.05)
    'slug'
    
    References
    ----------
    .. [1] Mandhane, J. M., G. A. Gregory, and K. Aziz. "A Flow Pattern Map for
       Gas-liquid Flow in Horizontal Pipes."  International Journal of 
       Multiphase Flow 1, no. 4 (October 30, 1974): 537-53. 
       doi:10.1016/0301-9322(74)90006-8.
    '''
    A = 0.25*pi*D*D
    Vsl =  m*(1.0 - x)/(rhol*A)
    Vsg = m*x/(rhog*A)
    
    # Convert to imperial units
    Vsl, Vsg = Vsl/0.3048, Vsg/0.3048
#    X1 = (rhog/0.0808)**0.333 * (rhol*72.4/62.4/sigma)**0.25 * (mug/0.018)**0.2
#    Y1 = (rhol*72.4/62.4/sigma)**0.25 * (mul/1.)**0.2
    X1 = (rhog/1.294292)**0.333 * (rhol*0.0724/999.552/sigma)**0.25 * (mug/1.8E-5)**0.2
    Y1 = (rhol*0.0724/999.552/sigma)**0.25 * (mul/1E-3)**0.2

    if Vsl < 14.0*Y1:
        if Vsl <= 0.1:
            Y1345 = 14.0*(Vsl/0.1)**-0.368
        elif Vsl <= 0.2:
            Y1345 = 14.0*(Vsl/0.1)**-0.415
        elif Vsl <= 1.15:
            Y1345 = 10.5*(Vsl/0.2)**-0.816
        elif Vsl <= 4.8:
            Y1345 = 2.5
        else:
            Y1345 = 2.5*(Vsl/4.8)**0.248

        if Vsl <= 0.1:
            Y456 = 70.0*(Vsl/0.01)**-0.0675
        elif Vsl <= 0.3:
            Y456 = 60.0*(Vsl/0.1)**-0.415
        elif Vsl <= 0.56:
            Y456 = 38.0*(Vsl/0.3)**0.0813
        elif Vsl <= 1.0:
            Y456 = 40.0*(Vsl/0.56)**0.385
        elif Vsl <= 2.5:
            Y456 = 50.0*(Vsl/1.)**0.756
        else:
            Y456 = 100.0*(Vsl/2.5)**0.463

        Y45 = 0.3*Y1
        Y31 = 0.5/Y1
        Y1345 = Y1345*X1
        Y456 = Y456*X1

        if Vsg <= Y1345 and Vsl >= Y31:
            regime = 'elongated bubble'
        elif Vsg <= Y1345 and Vsl <= Y31:
            regime = 'stratified'
        elif Vsg >= Y1345 and Vsg <= Y456 and Vsl > Y45:
            regime = 'slug'
        elif Vsg >= Y1345 and Vsg <= Y456 and Vsl <= Y45:
            regime = 'wave'
        else:
            regime = 'annular mist'
    elif Vsg <= (230.*(Vsl/14.)**0.206)*X1:
        regime = 'dispersed bubble'
    else:
        regime = 'annular mist'
    if full_output:
        return regime, {'v_ls': Vsl, 'v_gs': Vsg}
    return regime
r'''Classifies the regime of a two-phase flow according to Mandhane, 
    Gregory, and Azis  (1974) flow map.
    
    The flow regimes in this method are 'elongated bubble', 'stratified', 
    'annular mist', 'slug', 'dispersed bubble', and 'wave'.
    
    The parameters used are just the superficial liquid and gas velocity (i.e.
    if only the mass flow of that phase were flowing in the pipe).

    Parameters
    ----------
    m : float
        Mass flow rate of fluid, [kg/s]
    x : float
        Mass quality of fluid, [-]
    rhol : float
        Liquid density, [kg/m^3]
    rhog : float
        Gas density, [kg/m^3]
    mul : float
        Viscosity of liquid, [Pa*s]
    mug : float
        Viscosity of gas, [Pa*s]
    sigma : float
        Surface tension, [N/m]
    D : float
        Diameter of pipe, [m]
    full_output : bool, optional
        When True, returns a dictionary with the values 'v_gs', 'v_ls',
        - the parameters used internally to determine where on the plot the
        regime occurs, [-]
    
    Returns
    -------
    regime : str
        One of 'elongated bubble', 'stratified', 'annular mist', 'slug', 
        'dispersed bubble', or 'wave', [-]

    Notes
    -----
    [1]_ contains a Fortran implementation of this model, which this has been 
    validated against. This is a very fast flow map as all transitions were
    spelled out with clean transitions.

    Examples
    --------
    >>> Mandhane_Gregory_Aziz_regime(m=0.6, x=0.112, rhol=915.12, rhog=2.67, 
    ... mul=180E-6, mug=14E-6, sigma=0.065, D=0.05)
    'slug'
    
    References
    ----------
    .. [1] Mandhane, J. M., G. A. Gregory, and K. Aziz. "A Flow Pattern Map for
       Gas-liquid Flow in Horizontal Pipes."  International Journal of 
       Multiphase Flow 1, no. 4 (October 30, 1974): 537-53. 
       doi:10.1016/0301-9322(74)90006-8.