An immersed boundary method for compressible flows using local grid refinement