A generic algorithm for three-dimensional multiphase flows on unstructured meshes. (September 2018)