A numerical solution to the two-phase direct Stefan problem is considered. The position of the phase boundary depends on discontinuous nonlinear coefficients. The aim of the study is to provide a detailed resolution of the heat flow deep into the material with a fine spatial grid step. As compared with the size of the tungsten plate, the heating depth is very small. The problem statement under consideration is multiscale. Further expansion of the model involves gas dynamics equations to simulate the dynamics of the liquid and gaseous phases of the metal. The effect of discontinuous time- and space-nonlinear coefficients and boundary conditions on the nature of the solution is shown. The thermal conductivity function has a great influence on the solution. Surface melting of tungsten under exposure to a pulsed electron beam was simulated numerically, the evaporation process taken into account. The calculation is based on the experimental time dependence of the absorbed power density. The results of the calculations correlate with the experimental data obtained on the experimental test facility BETA at BINP SB RAS.