matrix_boundary

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Arrays+Matrices >

matrix_boundary

Previous pageReturn to chapter overviewNext page

{ MATRIX_BOUNDARY.PDE

 

 This example demonstrates the use of a data MATRIX in boundary definition.

 Coordinates are constructed by functional matrix definition,

 rotated by multiplication by a rotation matrix

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

}  

 

title 'MATRIX_BOUNDARY test'  

 

Variables  

   u  

 

definitions  

   a = 1  

   rad = 1  

  ! build a 2 x 21 matrix of x and y coordinates

   mb =matrix for i(1,2)  

              for ang(-pi/2 by pi/20 to pi/2)    

              : if(i=1) then rad*cos(ang) else rad*sin(ang)  

  ! build a 2 x 2 rotation matrix

   rota=45  

   rot = matrix[2,2] ((cos(radians(rota)), -sin(radians(rota))),  

                       (sin(radians(rota)), cos(radians(rota))))  

  ! rotate the coordinate list

   mbr = rot**mb  

 

   s = 1  

 

equations  

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

 

boundaries  

  region 1  

    ! start curve at first point of rotated coordinates

    start(mbr[1,1], mbr[2,1])  

        value(u)=0  

        ! spline fit the 21-point table

        spline list (mbr)  

        natural(u)=0  

        line to close  

 

plots  

  contour(u) painted  

  surface(u)  

 

end