Which among the following processes allows magma to change its state when it rises to the Earth's surface?