A finite element thermally coupled flow formulation for phase-change problems