That's not the way to calculate D, D is a Capex vs Opex competition. In the practice is way more simple: Keep velocity in between 1~6 m/s for liquids, clean liquids 1~3, slurries or suspensions 3~6 m/s. On Gases is 10~30 m/s. Decision on taking the average, close to min or Max, has to take care of other considerations, like sanding , max conditions, revamps, etc.