A numerical code for the simulation of magma-rocks dynamics