  We develop a new second-order unstaggered path-conservative central-upwind
(PCCU) scheme for ideal and shallow water magnetohydrodynamics (MHD) equations.
The new scheme possesses several important properties: it locally preserves the
divergence-free constraint, it does not rely on any (approximate) Riemann
problem solver, and it robustly produces high-resolution and non-oscillatory
results. The derivation of the scheme is based on the Godunov-Powell
nonconservative modifications of the studied MHD systems. The local
divergence-free property is enforced by augmenting the modified systems with
the evolution equations for the corresponding derivatives of the magnetic field
components. These derivatives are then used to design a special piecewise
linear reconstruction of the magnetic field, which guarantees a non-oscillatory
nature of the resulting scheme. In addition, the proposed PCCU discretization
accounts for the jump of the nonconservative product terms across cell
interfaces, thereby ensuring stability. We test the proposed PCCU scheme on
several benchmarks for both ideal and shallow water MHD systems. The obtained
numerical results illustrate the performance of the new scheme, its robustness,
and its ability not only to achieve high resolution, but also preserve the
positivity of computed quantities such as density, pressure, and water depth.
