Let $$\vec{D} = \frac{K_1}{r}\hat{\phi} - \frac{K_2}{r\sin \theta}\hat{\theta}$$ where $K_1$ and $K_2$ are constants. Find $I =\oint \vec{D}.d\vec{S}$ where $S$ is a closed surface shown below:
My try: Using the divergence theorem, the answer is zero because $\nabla.\vec{D} = 0$ but the problem is that $\vec{D}$ is undefined when $\theta = 0$ and part of this region is contained in the volume enclosed by $S$. Therefore the divergence theorem does not apply here. Computing surface integral directly is also problematic. Because there are two points on $S$, $P_1 = (R\cos \theta_0 , 0 , 0)$ and $P_2 = (R , 0 , 0)$, that $\vec{D}$ is still undefined. So it means simply that $I$ is undefined or we can ignore that points? If a vector field is undefined on an uncountably infinite number of points belonging to some surface, is surface integral still meaningful?
Also I've calculated flux using direct surface integral(ignoring division by zero) and found that $I = -2K_2\pi R\cos \theta_0$. My main question is that when surface integral for a vector field exists and when we are allowed to apply direct method(i.e. finding normal vector, computing dot product and so on)?
Note: Here is a similar question that I've found: Vector analysis: Find the flux of the vector field through the surface
