On the role of thermal processes in sputtering and composition changes due to ions or laser pulses