VFunTest

Top  Previous  Next

{  VFUNTEST.PDE  }

 

{******************************************************

 

This example illustrates the vector functions

 

VECTOR

MAGNITUDE

DOT

CROSS

NORMAL

TANGENTIAL

 

*******************************************************}

 

title

"vector functions"

 

select

elevationgrid=500

 

{no variables}

 

definitions

 

u= exp(-x**2+ y)              { A scalar potential, perhaps }

f= grad(u)                    { f is a vector }

df= div(f)                    { Divergence of f is a scalar}

cf= curl(f)                   { Curl of f is a new vector }

vx= -sin(y)   vy= 2*sin(x)    { vector components }

v= vector(vx,vy)              { Another vector }

mv= magnitude(v)              { Magnitude of v }

cv= curl(v)

ccv= curl(curl(v))

 

{no equations}

 

{plot domain required}

boundaries

region 1

   start "Outer" (-1,0)

   line to (1,0) to (1,1) to (-1,1) to close

 

feature

  start "inner" (-1/2,1/2) line to (1/2,1/2)

 

plots

vector(f)

elevation(normal(f)) on "Outer"

elevation(tangential(f)) on "inner"

contour(df)   as "Div F"

contour(mv)   as "Magnitude V"

contour(dot(v,vector(x,0)))

contour(cross(f,v))

contour(cv)   as "Curl V"

vector(ccv)   as "Curl Curl V"

 

end