Single-phase and two-phase magnetohydrodynamic pipe flow