A mathematical model for nanoparticle melting with density change