Very often we need to calculate the flux out of an enclosed region. The divergence theorem tells us that the integral of flux density over the interior of the the solid region (a three-dimensional integral) equals the flux integral through the boundary of the region.