Analysis and optimization of viscous dense gas flows