Flow Across a Closed Curve

Consider a vector field v={v1,v2}=v1(x,y) i + v2(x,y) j. We have to deal with two dimensions here: in three dimensions a curve does not enclose a region!

Think of a small (infinitesimal) piece of curve again. The flow of v across the small piece of curve is in the direction of the unit normal to the curve and is v times the small piece of arc length (the bigger the piece of curve, the more flow!). Adding these infinitesimal pieces up (integrating!) yields flow across the curve:

Integral of v.nds

How do we get the unit normal? Remember the gradient section?

If the curve is given by g(x,y)=0, a normal vector at a point is given by gradient(g) evaluated at that point. The unit normal is grad(g)/||grad(g)||.

As an example, compute the flow of v(x,y)=x i + y j through the circle x^2+y^2=9.

In[20]:=

  Clear[v,f,r,flow,n]
  v[x_,y_]:={x,y}
  f[x_,y_]:=x^2+y^2-9

In[21]:=

  grad2[f][x,y]

Out[21]=

  {2 x, 2 y}

In[22]:=

  n=grad2[f][x,y]/norm[grad2[f][x,y]]

Out[22]=

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

In[23]:=

  Simplify[%]

Out[23]=

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

In[24]:=

  v[x,y].n

Out[24]=

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

In[25]:=

  Simplify[%]

Out[25]=

        2    2
  Sqrt[x  + y ]

To integrate v.n ds, we need the result from the section "Line Integrals":

v.n ds is v(x(t),y(t),z(t)).n(x(t), y(t), z(t)) ||r'(t)|| dt.

We must parametrize f(x,y) as r(t)=3cos[t] i + 3sin[t] j.

In[26]:=

  r[t_]:={3 Cos[t], 3 Sin[t]}

In[27]:=

  vn=v[x,y].n /.{x->3 Cos[t], y->3 Sin[t]}

Out[27]=

                    2
           18 Cos[t]
  ----------------------------- + 
                2            2
  Sqrt[36 Cos[t]  + 36 Sin[t] ]
   
                      2
             18 Sin[t]
    -----------------------------
                  2            2
    Sqrt[36 Cos[t]  + 36 Sin[t] ]

In[28]:=

  Simplify[norm[D[r[t],t]]]

Out[28]=

  3

In[29]:=

  flow=Integrate[3 vn ,{t,0,2 Pi}]

Out[29]=

  18 Pi

By the way, if the curve f(x,y) is already parametrized as r(t)={x(t),y(t)}, then r'(t)={x'(t),y'(t)} is the tangent vector, so the unit normal vector must be
n(t)={-y'(t),x(t)}/||{-y'(t),x(t)}||
or
n(t)={y'(t),-x(t)}/||{y'(t),-x(t)}||

The choice depends upon the choice of inner pointing or outer pointing normal. (Remember the vectorcalc1 notebook?)
(Check: Is r'(t).n(t)=0?)

In the above example, we have (using the gradient) that n=

In[30]:=

  Simplify[n/.{x->3 Cos[t], y->3 Sin[t]}]

Out[30]=

  {Cos[t], Sin[t]}

Using the parametrization we have n=

In[31]:=

  parametrizedn=
  D[{r[t][[2]],-r[t][[1]]},t]/norm[D[{r[t][[2]],-r[t][[1]]},t]];
  Simplify[parametrizedn]

Out[31]=

  {Cos[t], Sin[t]}

Up to 2D Flows