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

Last change on this file since 3937 was 3937, checked in by ldelgass, 7 years ago

Convert 3rd flow example to use mesh/values instead of dx (example inside demo3
directory still uses dx for testing)

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 -opacity 1"
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 -opacity 1"
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.component.flow.axis z
91    $f3.component.flow.position 0%
92    $f3.component.flow.volume yes
93    $f3.component.flow.streams no
94    $f3.component.flow.outline no
95    $f3.component.flow.particles(left).axis x
96    $f3.component.flow.particles(left).color lightgreen
97    $f3.component.flow.particles(left).position 10%
98    $f3.component.flow.particles(right).axis x
99    $f3.component.flow.particles(right).color khaki
100    $f3.component.flow.particles(right).position 90%
101    $f3.component.style  "-color blue:red -levels 6 -opacity 1"
102    $f3.component.extents 3
103    $f3.component.mesh output.mesh(sio2)
104    output.mesh(sio2).about.label "SiO2"
105    output.mesh(sio2).dim 3
106    output.mesh(sio2).units "um"
107    output.mesh(sio2).hide yes
108    output.mesh(sio2).grid.xaxis.min 0
109    output.mesh(sio2).grid.xaxis.max 29.75206608
110    output.mesh(sio2).grid.xaxis.numpoints 121
111    output.mesh(sio2).grid.yaxis.min -1.5
112    output.mesh(sio2).grid.yaxis.max 2.82
113    output.mesh(sio2).grid.yaxis.numpoints 25
114    output.mesh(sio2).grid.zaxis.min -1
115    output.mesh(sio2).grid.zaxis.max 4.304347828
116    output.mesh(sio2).grid.zaxis.numpoints 23
117}]
118
119puts stdout "Setting attributes..."
120flush stdout
121foreach {key value} $elements {
122    $driver put $key $value
123}
124
125source demo1/data-unirect3d.tcl
126$driver put $f1.component.values $values
127
128source demo2/data-unirect2d.tcl
129$driver put $f2.component.values $values
130
131#source demo3/data-dx.tcl
132#set data [Rappture::encoding::encode -as zb64 "<DX>$dx"]
133#$driver put $f3.component.dx $data
134
135source demo3/data-values.tcl
136$driver put $f3.component.values $values
137
138# save the updated XML describing the run...
139Rappture::result $driver
140puts stdout "done"
141flush stdout
142exit 0
143
Note: See TracBrowser for help on using the repository browser.