Numerical simulation of reconnection in an emerging magnetic flux region