Modelling phase transition in metastable liquids: application to cavitating and flashing flows | Synapse