If $\vec{\mathbf B}=B\vec{\mathbf a}_z$, compute the magnetic flux passing through a hemisphere of radius $R$ centered at the origin and bounded by the plane $z=0$.
Solution The hemisphere and the circular disc of radius $R$ form a closed surface, as illustrated in the figure; therefore, the flux passing through the hemisphere must be exactly equal to the flux passing through the disc. The flux passing through the disc is
$$\Phi=\int_S\vec{\mathbf B}\cdot\mathrm d\vec{\mathbf s}= \int\limits_0^R\int\limits_0^{2\pi}B\rho\,\mathrm d\rho\,\mathrm d\phi =\pi R^2B$$
The reader is encouraged to verify this result by integrating over the surface of the hemisphere.
According to Maxwell's equations the magnetic flux over a closed surface must be zero, why in this case does not happen?