A compressible flow with wall friction has been predicted in a constant cross section duct by means of a barotropic modeling approach, and new analytical formulas have been proposed that also allow any possible heat transfer to the walls to be taken into account. A comparison between the distributions of the steady-state flow properties, pertaining to the new formulas, and those of a classic Fanno analysis has been performed. In order to better understand the limits of the polytropic approach in nearly chocked flow applications, a numerical code, which adopts a variable polytropic coefficient along the duct, has been developed. The steady-state numerical distributions along the pipe, obtained for either a viscous adiabatic or an inviscid diabatic flow by means of this approach, coincide with those of the Fanno and Rayleigh models for Mach numbers up to 1. A constant polytropic exponent can be adopted for a Fanno flow that is far from choking conditions, while it cannot be adopted for the simulation of a Rayleigh flow, even when the flow is not close to choking conditions. Finally, under the assumption of diabatic flows with wall friction, the polytropic approach, with a constant polytropic exponent, is shown to be able to accurately approximate cases in which no local maximum is present for the temperature along the duct. The Mach number value at the location where the local maximum temperature possibly occurs has been obtained by means of a new analytical formula.