The paper presents a mathematical model of material heating taking into account Joule heating, the Thomson effect and the Peltier effect on the sample surface, which are determined by calculating the total current. A model of current distribution in a tungsten sample and an evaporated substance when the surface is heated by an electron beam is considered. The model is based on solving the equations of electrodynamics and the two-phase Stefan problem in a cylindrical coordinate system. The two-phase Stefan problem determines the temperature in the sample area with the contribution of Joule heating and the Thomson effect, which are obtained from calculating the total current at each time step. The power density of the laser pulse and metal evaporation from the surface are set on the sample surface and the Peltier effect is taken into account. The model parameters are taken from experiments at the beam of electrons for materials test applications (BETA), Budker Institute of Nuclear Physics, Siberian Branch of the Russian Academy of Sciences (BINP SB RAS).