First-principles study of the effect of water on the phase transitions in Mg2SiO4 forsterite