Example

Find the flux of v={x,y,z} across the part of the sphere x^2+y^2+z^2=4 lying between the planes z=1 and z=2.


  Clear[v,S,g,n]
  v[x_,y_,z_]:={x,y,z}
  S[x_,y_]:=Sqrt[4-x^2-y^2]
  g[x_,y_,z_]:=x^2+y^2+z^2-4


  p1=Plot3D[S[x,y],{x,-2,2},{y,-2,2},DisplayFunction->Identity];
  p2=Plot3D[1,{x,-2,2},{y,-2,2},DisplayFunction->Identity];
  p3=Plot3D[2,{x,-2,2},{y,-2,2},DisplayFunction->Identity];
  Show[p1,p2,p3,DisplayFunction->$DisplayFunction,ViewPoint->{0,1,0}];


  grad3[g][x,y,z]


  n=grad3[g][x,y,z]/norm[grad3[g][x,y,z]]


  Simplify[n]


  Simplify[v[x,y,S[x,y]].n]


  Dx=D[S[x,y],x]
  Dy=D[S[x,y],y]


  dS=Sqrt[1+Dx^2+Dy^2] 


  Simplify[(v[x,y,S[x,y]].n)*dS]

Before we go any further, let's replace z with S(x,y).


  integrand=(v[x,y,f[x,y]].n)*dS/.z->S[x,y];
  Simplify[integrand]

This is what we must integrate, but over what region? The plane z=2 intersects the sphere at the "top" (0,0,2), and z=1 intersects the sphere in the circle x^2+y^2=3. Projecting this over the x,y plane gives the region, x^2+y^2<=3


  Integrate[integrand,{x,-Sqrt[3],Sqrt[3]},
    {y,-Sqrt[3-x^2],Sqrt[3-x^2]}]

Note: If you were doing this by hand, polar coordinates would be the way to go.

Up to Flow Across a Surface (Flux)