A finite element model of EDM based on the Joule effect