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