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

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

Remove unused unirect2/3d.components element, this is unused -- the field extents are used to determine if field is scalar or vector

File size: 4.4 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}]
104
105puts stdout "Setting attributes..."
106flush stdout
107foreach {key value} $elements {
108    $driver put $key $value
109}
110
111source demo1/data-unirect3d.tcl
112$driver put $f1.component.values $values
113
114source demo2/data-unirect2d.tcl
115$driver put $f2.component.values $values
116
117source demo3/data-dx.tcl
118set data [Rappture::encoding::encode -as zb64 "<DX>$dx"]
119$driver put $f3.component.dx $data
120
121# save the updated XML describing the run...
122Rappture::result $driver
123puts stdout "done"
124flush stdout
125exit 0
126
Note: See TracBrowser for help on using the repository browser.