If there are multiple sources and sinks of liquid inside "S", the flux through the surface can be calculated by adding up the volume rate of liquid added by the sources and subtracting the rate of liquid drained off by the sinks. The volume rate of flow of liquid through a source or sink (with the flow through a sink given a negative sign) is equal to the "divergence" of the velocity field at the pipe mouth, so adding up (integrating) the divergence of the liquid throughout the volume enclosed by "S" equals the volume rate of flux through "S". This is the divergence theorem.