Example

Find the flux for the vector field v(x,y,z)=xi+yj+zk out of the surface
z=1-x^2-y^2, z>=0.

In[63]:=

  Clear[v,S,g,n]
  v[x_,y_,z_]:={x,y,z}
  S[x_,y_]:=1-x^2-y^2
  g[x_,y_,z_]:=(1-x^2-y^2)-z

In[64]:=

  vf=Plot3D[S[x,y],{x,-1,1},{y,-1,1}];

In[65]:=

  grad3[g][x,y,z]

Out[65]=

  {-2 x, -2 y, -1}

In[66]:=

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

Out[66]=

           -2 x                   -2 y
  {---------------------, ---------------------, 
               2      2               2      2
   Sqrt[1 + 4 x  + 4 y ]  Sqrt[1 + 4 x  + 4 y ]
   
                1
    -(---------------------)}
                  2      2
      Sqrt[1 + 4 x  + 4 y ]

In[67]:=

  vp=vectorPlot[{{0,0,S[0,0]}+{0,0,0}},{{0,0,S[0,0]}+n/.{x->0,y->0,z->0}}];

In[68]:=

  Show[vf,vp];

Where's the normal?

In[69]:=

  Show[vf,vp,ViewPoint->{0,-1,-1}];

It is an inward pointing normal. We will get the flux from the outside to the inside.

In[70]:=

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

Out[70]=

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

In[71]:=

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

Out[71]=

  -2 x

Out[72]=

  -2 y

In[73]:=

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

Out[73]=

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

In[74]:=

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

Out[74]=

        2    2
  -1 - x  - y

In[75]:=

  Integrate[1+x^2+y^2,{x,-1,1},
    {y,-Sqrt[1-x^2],Sqrt[1-x^2]}]

Out[75]=

  3 Pi
  ----
   2

Up to Flow Across a Surface (Flux)