def unf_gas_density_kgm3(t_K, p_MPaa, gamma_gas, z):
    """
    Equation for gas density

    :param t_K: temperature
    :param p_MPaa: pressure
    :param gamma_gas: specific gas density by air
    :param z: z-factor
    :return: gas density
    """
    m = gamma_gas * 0.029
    p_Pa = 10 ** 6 * p_MPaa
    rho_gas = p_Pa * m / (z * 8.31 * t_K)
    return rho_gas