Navigation:  Sample Problems > usage > variable_arrays >

array_variables

Print this Topic Previous pageReturn to chapter overviewNext page

{ ARRAY_VARIABLES.PDE

 

   This example demonstrates the use of ARRAY VARIABLES.

   A set of heat equations is solved as a demonstration.

 

}

title 'ARRAY Variable test'

variables

   U=array[10]                 { an array of field variables }

global variables

   g(threshold=0.1) = array[10] { and an array of global variables }

definitions

   u0 = 1-x^2-y^2

   s = array(1,2,3,4,5,6,7,8,9,10) { each equation has a different source }

equations

  repeat i=1 to 10

       U[i]:   del2(u[i]) +s[i] = 0

       g[i]:   dt(g[i]) = i-g[i]

  endrepeat

boundaries

  Region 1

      start(-1,-1)

          repeat i=1 to 10    

              value(u[i])=u0  

          endrepeat

      line to (1,-1) to (1,1) to (-1,1) finish

time 0 to 10

plots

  for cycle=10

    contour(u_1)

    repeat i=1 to 10

      contour(u[i])   as "U_"+$i

    endrepeat

    history(g)

    history(u) at  (0,0) (1/4,1/4)(1/2,1/2)(3/4,3/4)

    vtk(u,g)

    cdf(u,g)

    table(u,g)

    transfer(u,g)

end

 


Page url: index.html?usage_variable_arrays_array_variables.html