arrays

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Arrays+Matrices >

arrays

Previous pageReturn to chapter overviewNext page

{ ARRAYS.PDE  

 

 This example demonstrates a few uses of data ARRAYS.

 

}  

 

title 'ARRAY test'  

 

Variables  

    u  

 

definitions  

    a = 1  

 

    ! literal data specification

    v = array(0,1,2,3,4,5,6,7,8,9,10)  

    ! literal data specification with incrementation

    w = array(0 by 0.1 to 10)  

    ! functional definition

    alpha =array for x(0 by 0.1 to 10)  : sin(x)+1.1  

    ! construction of a new array by arithmetic operations

    beta = sin(w)+1.1 { this results in the same data as alpha }  

    gamma = sin(v)+0.1 { this array is sparsely defined }  

 

    rad = 0.1  

    s = 0  

 

equations  

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

 

boundaries  

    region 1  

      start(0,0)  

          value(u)=0  

      line to (2,0) to (2,2) to (0,2) to close  

 

plots  

  elevation(alpha)  

  elevation(alpha,beta) vs w  

  elevation(gamma) vs v  

summary  

  report(sizeof(w))  

   

end