Nematic liquid crystals in a spatially step-wise magnetic field