def rhosat(phi, sw, rhomin, rhow, rhohc):
    """
    Density of partially saturated rock.
    """
    a = rhomin * (1 - phi)
    b = rhow * sw * phi
    c = rhohc * (1 - sw) * phi
    return a + b + c
