Two small Divergence Theorem questions $1)$Use the divergence theorem to evaluate the flux $\int_S \underline{F} \cdot \underline{dS} $where the vector field $\underline{F} = xz\, e_1 + 3x\, e_2 - 2z \,e_3$
i)$S$ is the closed cylinder bounded by the surface $x^2 + y^2 = 1$ and the planes $z=0$ and $z=3$.
ii)$S$ is the open curved cylindrical surface $x^2 + y^2 = 1,\,\, 0 \leq z \leq 3$
i) is fine, but I am unsure about how top use the div theorem for ii).  What I did was compute $\int_V \nabla \cdot F\,dV$ for both the top and bottom circles and subtract their contributions from i).  This gives an answer of $3 \pi/2$.  My worry is that when I do the actual surface integral I get something completely different.
My working for the surface integral: On the curved surface; $\underline{dS} = cos \phi\, e_1 + sin \phi\,e_2\,d\phi dz $ 
So, $F \cdot dS = (cos^2 \phi z + 3 cos\phi sin \phi)d \phi dz.  $ Integrating with $z \in [0,3]$ and $\phi \in [0,2\pi]$ gives $9\pi/2.$  
Similarly, on top surface I get $F \cdot dS = -6 d\phi d\rho$ which gives $-12 \pi$ and $0$ contribution from the bottom surface. Adding these do not give the $-3\pi/2$ attained in i)
Many thanks.
 A: The divergence theorem applies to a body $B\subset{\mathbb R}^3$ and its outward oriented boundary $\partial B=:S$. It says that for any field ${\bf F}$ defined in a neighborhood of $B$ one has
$$\int_S {\bf F}\cdot d\vec \omega=\int_B{\rm div}({\bf F})\ dV\ .$$
(i) Computing the divergence we obtain
$${\rm div}({\bf F}(x,y,z)=z-2\ .$$
Here $S=\partial B$ and therefore
$$\int_S {\bf F}\cdot d\vec \omega=\int_B{\rm div}({\bf F})\ dV=\left({3\over2}-2\right){\rm vol}(B)=-{3\pi\over2}\ .$$
(ii) The boundary $\partial B$ of $B$ consists of three pieces: The bottom surface $S_1$, the top surface $S_2$, and the cylindrical surface $S_3$. We are told to compute the flow integral $\int_S {\bf F}\cdot d\vec \omega$ for $S:=S_3$. 
According to the divergence theorem
$$\int_{S_3} {\bf F}\cdot d\vec \omega= \int_B{\rm div}({\bf F})\ dV-\int_{S_1} {\bf F}\cdot d\vec \omega-\int_{S_2} {\bf F}\cdot d\vec \omega\ .$$
On the bottom surface $S_1$ the outward normal is $(0,0,-1)$, and the scalar surface element is ${\rm d}\omega={\rm d}(x,y)$, i.e., the area element on the unit disk $D$. Therefore
$$\int_{S_1}{\bf F}\cdot d\vec \omega=\int_D(0,3x,0)\cdot(0,0,-1)\ {\rm d}(x,y)=0\ .$$
On the top surface $S_2$ the outward normal is $(0,0,1)$,  Therefore
$$\int_{S_2}{\bf F}\cdot d\vec\omega=\int_D(3x,3x,-6)\cdot(0,0,1)\ {\rm d}(x,y)=-6 \int_D {\rm d}(x,y)=-6\pi\ .$$
It follows that
$$\int_{S_3} {\bf F}\cdot d\vec \omega=-{3\pi\over2}-0-(-6\pi)={9\pi\over2}\ .$$
