array_boundary

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Arrays+Matrices >

array_boundary

Previous pageReturn to chapter overviewNext page

{ ARRAY_BOUNDARY.PDE  

 

 This problem demonstrates the use of data ARRAYS in boundary definition.

 Coordinate arrays are constructed by functional array definition

 and joined in a spline fit to form the system boundary.

}

title 'ARRAY_BOUNDARY test'

variables

    u

definitions

    a = 1

    rad = 1

    ! construct x and y coordinates on a semicircle

    xb =array for ang(-pi/2 by pi/10 to pi/2)  : rad*cos(ang)

    yb =array for ang(-pi/2 by pi/10 to pi/2)  : rad*sin(ang)

    ! multiplying an array by a constant

    xba = 10*xb

    yba = 10*yb

    ! adding a constant to an array

    xbb = xba+11

    s = 1

equations

    u:  div(a*grad(u)) + s  = 0;           { a heatflow equation }

boundaries

  region 1       { a half-circle built of line segments }

      start(0,-10*rad)

      value(u)=0

        line list (xba, yba)

      natural(u)=0

        line to close

  region 2       { a half-circle built of spline segments }

      start(11,-10*rad)

      value(u)=0

        spline list (xbb, yba)

      natural(u)=0

        line to close

plots

  grid(x,y)

  contour(u) painted

  surface(u)

end