Thermodynamic aspects of particle engulfment by solidifying melts