<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Variable_Types >


Previous pageReturn to chapter overviewNext page



 This example demonstrates the use of Vector variables in time-dependent problems.


 A vector variable is controlled by a heat equation.  The X and Y components are given

 source terms consistent with an arbitrarily chosen final result.


 This problem is not intended to represent any real application, but is constructed

 merely to demonstrate the use of some features of vector variable support

 in FlexPDE.



title 'Vector transient heatflow'


  { declare a vector variable with components Ux and Uy.  

       Each component is expected to have a variation large compared to 0.01 }

   U(0.01) = vector(Ux,Uy)

  { declare a scalar field variable to validate the y-component }




    { Define the expected solutions for the components. }

    u0 = (1-x^2-y^2)

    u1 = (1+y+x^3)

    { Define source terms that will result in the programmed solutions }

    s = vector(4,-6*x)


    U: del2(U) +s = dt(U)

    v: del2(v) +ycomp(s) = dt(v)


    Region 1

      start 'outer' (-1,-1)

          { Apply a time ramp to the value boundary conditions, so that the

               initial boundary values agree with the initial field values. }

          value(U)=vector(u0,u1)*uramp(t, t-1)

          value(v)=u1*uramp(t, t-1)

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

time 0 to 5


    for cycle=10

      { various uses of vector variables in plot statements: }

      contour(Ux, u0)

      contour(Uy, u1)

      contour(v, u1)

      contour(Ux, Uy)



      elevation(U, v) from(-1,0) to (1,0)

      history(U, v) at(0,0)

      elevation(u1, Uy, v) on 'outer'

      elevation(u0, Ux) on 'outer'

      elevation(normal(grad(Ux)), normal(grad(u0))) on 'outer'

      elevation(normal(grad(v)), normal(grad(Uy)), normal(grad(u1))) on 'outer'