Modelling melting and melt segregation by two-phase flow: new insights into the dynamics of magmatic systems in the continental crust