  We recently developed a new general relativistic magnetohydrodynamic code
with adaptive mesh refinement that evolves the electromagnetic (EM) vector
potential (A) instead of the magnetic fields directly. Evolving A enables one
to use any interpolation scheme on refinement level boundaries and still
guarantee that the magnetic field remains divergenceless. As in classical EM, a
gauge choice must be made when evolving A, and we chose a straightforward
"algebraic" gauge condition to simplify the A evolution equation. However,
magnetized black hole-neutron star (BHNS) simulations in this gauge exhibit
unphysical behavior, including the spurious appearance of strong magnetic
fields on refinement level boundaries. This spurious behavior is exacerbated
when matter crosses refinement boundaries during tidal disruption of the NS.
Applying Kreiss-Oliger dissipation to the evolution of the magnetic vector
potential A slightly weakens this spurious magnetic effect, but with undesired
consequences. We demonstrate via an eigenvalue analysis and a numerical study
that zero-speed modes in the algebraic gauge, coupled with the frequency
filtering that occurs on refinement level boundaries, are responsible for the
creation of spurious magnetic fields. We show that the EM Lorenz gauge exhibits
no zero-speed modes, and as a consequence, spurious magnetic effects are
quickly propagated away, allowing for long-term, stable magnetized BHNS
evolutions. Our study demonstrates how the EM gauge degree of freedom can be
chosen to one's advantage, and that for magnetized BHNS simulations the Lorenz
gauge constitutes a major improvement over the algebraic gauge.
