The shape, size and location of the stagnation zone between flat non-parallel walls that make up the corner of a tube with non-circular cross-section through which a phase change material of the Bingham plastic type flows is investigated. We show that the stagnant area is bounded by a convex meniscus whose size depends on the degree of plasticity and the vertex angle. The maximum and minimum energy dissipation occurs at the wall and at the bisectrix, respectively. The stagnant zone can be altogether avoided by modifying the shape of the wall in the corner area. A new design of the cross-section of the tube that allows reducing or eliminating this area to optimize the mass transport is developed. Two optimal solutions a vertex with a straight cut and a concavely curved vertex are proposed.