how does temperature affect the formation of magma