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.

In[76]:=

  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

In[77]:=

  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}];

In[78]:=

  grad3[g][x,y,z]

Out[78]=

  {2 x, 2 y, 2 z}

In[79]:=

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

Out[79]=

             2 x                       2 y
  {------------------------, ------------------------, 
           2      2      2           2      2      2
   Sqrt[4 x  + 4 y  + 4 z ]  Sqrt[4 x  + 4 y  + 4 z ]
   
              2 z
    ------------------------}
            2      2      2
    Sqrt[4 x  + 4 y  + 4 z ]

In[80]:=

  Simplify[n]

Out[80]=

           x                   y
  {------------------, ------------------, 
         2    2    2         2    2    2
   Sqrt[x  + y  + z ]  Sqrt[x  + y  + z ]
   
            z
    ------------------}
          2    2    2
    Sqrt[x  + y  + z ]

In[81]:=

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

Out[81]=

   2    2             2    2
  x  + y  + Sqrt[4 - x  - y ] z
  -----------------------------
             2    2    2
       Sqrt[x  + y  + z ]

In[82]:=

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

Out[82]=

            x
  -(-----------------)
              2    2
    Sqrt[4 - x  - y ]

Out[83]=

            y
  -(-----------------)
              2    2
    Sqrt[4 - x  - y ]

In[84]:=

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

Out[84]=

                2             2
               x             y
  Sqrt[1 + ----------- + -----------]
                2    2        2    2
           4 - x  - y    4 - x  - y

In[85]:=

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

Out[85]=

              1         2    2             2    2
  2 Sqrt[-----------] (x  + y  + Sqrt[4 - x  - y ] z)
              2    2
         4 - x  - y
  ---------------------------------------------------
                        2    2    2
                  Sqrt[x  + y  + z ]

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

In[86]:=

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

Out[86]=

                        2    2
              1        x    y
  2 Sqrt[-----------] (-- + -- + 
              2    2   2    2
         4 - x  - y
   
                2    2         2    2
      Sqrt[4 - x  - y ] (-9 + x  + y )
      --------------------------------)
                     2

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

In[87]:=

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

Out[87]=

  -115 Pi
  -------
     6

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

Up to Flow Across a Surface (Flux)