Simulation of phase transitions in multiphase systems: peritectic solidification of (RE)Ba2Cu3O7-x superconductors