source: trunk/examples/flow/flowtest.tcl @ 5348

Last change on this file since 5348 was 4726, checked in by ldelgass, 5 years ago

remove opacity setting from flow example

File size: 5.1 KB
Line 
1
2# Example of using unirect2d meshes in a field object in Rappture.
3
4package require Rappture
5
6
7# Open an XML run file to write into
8set driver [Rappture::library [lindex $argv 0]]
9
10# Create 3 "field" objects to display the different flows.
11
12set f1 output.field(jwire)
13set f2 output.field(half)
14set f3 output.field(si02)
15
16set elements [subst {
17    $f1.about.label "Jwire example"
18    $f1.component.flow.label "Flow 1"
19    $f1.component.flow.axis z
20    $f1.component.flow.position 0%
21    $f1.component.flow.volume yes
22    $f1.component.flow.streams no
23    $f1.component.flow.outline no
24    $f1.component.flow.particles(left).label "Left particle flow"
25    $f1.component.flow.particles(left).description {
26        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
27    }
28    $f1.component.flow.particles(left).axis x
29    $f1.component.flow.particles(left).color lightgreen
30    $f1.component.flow.particles(left).position 10%
31    $f1.component.flow.particles(right).label "Right particle flow"
32    $f1.component.flow.particles(right).description {
33        Cras elit eros,
34        ultricies vel, auctor nec, iaculis interdum, lectus. Vivamus lorem diam,
35        posuere nec, cursus ut, tempus in, tortor. Sed est eros, faucibus eu,
36        pellentesque quis, pharetra venenatis, massa.
37    }
38    $f1.component.flow.particles(right).axis x
39    $f1.component.flow.particles(right).color khaki
40    $f1.component.flow.particles(right).position 90%
41    $f1.component.style  "-color blue:red -levels 6"
42    $f1.component.flow.box(one).label "Region 1"
43    $f1.component.flow.box(one).color cyan
44    $f1.component.flow.box(one).corner(1) "0 -100 -100"
45    $f1.component.flow.box(one).corner(2) "3000 400 400"
46    $f1.component.flow.box(two).label "Region 2"
47    $f1.component.flow.box(two).color violet
48    $f1.component.flow.box(two).corner(1) "1000 -150 -100"
49    $f1.component.flow.box(two).corner(2) "3000 3000 3000"
50    $f1.component.flow.box(three).label "Region 3"
51    $f1.component.flow.box(three).color magenta
52    $f1.component.flow.box(three).corner(1) "1000 -150 -100"
53    $f1.component.flow.box(three).corner(2) "2000 450 450"
54    $f1.component.extents 3
55    $f1.component.mesh unirect3d(jwire)
56    unirect3d(jwire).xaxis.min  0
57    unirect3d(jwire).xaxis.max  6300
58    unirect3d(jwire).xaxis.numpoints  126
59    unirect3d(jwire).yaxis.min  0
60    unirect3d(jwire).yaxis.max  1500
61    unirect3d(jwire).yaxis.numpoints  30
62    unirect3d(jwire).zaxis.min  0
63    unirect3d(jwire).zaxis.max  1519.05
64    unirect3d(jwire).zaxis.numpoints  22
65    $f2.about.label "Flow 2d half"
66    $f2.component.flow.axis z
67    $f2.component.flow.position 0%
68    $f2.component.flow.volume yes
69    $f2.component.flow.streams no
70    $f2.component.flow.outline no
71    $f2.component.flow.particles(left).axis x
72    $f2.component.flow.particles(left).color yellow
73    $f2.component.flow.particles(left).position 10%
74    $f2.component.flow.particles(right).axis x
75    $f2.component.flow.particles(right).color pink
76    $f2.component.flow.particles(right).position 90%
77    $f2.component.style  "-color rainbow -levels 6"
78    $f2.camera.position {
79        qw 1 qx 0 qy 0 qz 0 pan-x 0 pan-y 0 zoom 1.0
80    }
81    $f2.component.extents 2
82    $f2.component.mesh unirect2d(half)
83    unirect2d(half).xaxis.min   -0.5
84    unirect2d(half).xaxis.max   152
85    unirect2d(half).xaxis.numpoints  305
86    unirect2d(half).yaxis.min   -22
87    unirect2d(half).yaxis.max   21.6
88    unirect2d(half).yaxis.numpoints  109
89    $f3.about.label "SiO2"
90    $f3.about.view "flowvis"
91    $f3.component.flow.axis z
92    $f3.component.flow.position 0%
93    $f3.component.flow.volume yes
94    $f3.component.flow.streams no
95    $f3.component.flow.outline no
96    $f3.component.flow.particles(left).axis x
97    $f3.component.flow.particles(left).color lightgreen
98    $f3.component.flow.particles(left).position 10%
99    $f3.component.flow.particles(right).axis x
100    $f3.component.flow.particles(right).color khaki
101    $f3.component.flow.particles(right).position 90%
102    $f3.component.style  "-color blue:red -levels 6"
103    $f3.component.elemtype vectors
104    $f3.component.elemsize 3
105    $f3.component.mesh output.mesh(sio2)
106    output.mesh(sio2).about.label "SiO2"
107    output.mesh(sio2).dim 3
108    output.mesh(sio2).units "um"
109    output.mesh(sio2).hide yes
110    output.mesh(sio2).grid.xaxis.min 0
111    output.mesh(sio2).grid.xaxis.max 29.75206608
112    output.mesh(sio2).grid.xaxis.numpoints 121
113    output.mesh(sio2).grid.yaxis.min -1.5
114    output.mesh(sio2).grid.yaxis.max 2.82
115    output.mesh(sio2).grid.yaxis.numpoints 25
116    output.mesh(sio2).grid.zaxis.min -1
117    output.mesh(sio2).grid.zaxis.max 4.304347828
118    output.mesh(sio2).grid.zaxis.numpoints 23
119}]
120
121puts stdout "Setting attributes..."
122flush stdout
123foreach {key value} $elements {
124    $driver put $key $value
125}
126
127source demo1/data-unirect3d.tcl
128$driver put $f1.component.values $values
129
130source demo2/data-unirect2d.tcl
131$driver put $f2.component.values $values
132
133#source demo3/data-dx.tcl
134#set data [Rappture::encoding::encode -as zb64 "<DX>$dx"]
135#$driver put $f3.component.dx $data
136
137source demo3/data-values.tcl
138$driver put $f3.component.values $values
139
140# save the updated XML describing the run...
141Rappture::result $driver
142puts stdout "done"
143flush stdout
144exit 0
145
Note: See TracBrowser for help on using the repository browser.