Mathematics Of Partially Miscible Three-Phase Flow