|
Repeat |
Top Previous Next |
|
{ REPEAT.PDE } { This problem illustrates the use of the REPEAT statement to generate repetitive structures, and the string facility for labelling such domains. } title 'REPEAT and $string test'
Variables u
definitions a = 1
xc=array(1/3, 2/3, 3/3, 4/3, 5/3) { a list of X-coordinates } yc=array(1/3, 2/3, 3/3, 4/3, 5/3) { a list of Y-coordinates }
rad = 0.1 s = 0
equations div(a*grad(u)) + s = 0; { the heatflow equation }
boundaries region 1 start(0,0) value(u)=0 line to (2,0) to (2,2) to (0,2) to close region 2 a = 0.05 s = 4*magnitude(x-1,y-1) repeat i=1 to 5 { an indexed loop on X-position } repeat j=1 to 5 { an indexed loop on Y-position } { an array of circular dots at the tabulated coordinates } start 'loop'+intstring(i)+intstring(j) (xc[i]+rad,yc[j]) arc(center=xc[i],yc[j]) angle=360 endrepeat endrepeat
monitors contour(u)
plots contour(u) painted
repeat i=1 to 5 repeat j=1 to 5 elevation(u) on 'loop'+$i+$(j) endrepeat endrepeat
end |